1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Add virDomainBlockPull support to the remote driver

The generator can handle everything except virDomainGetBlockJobInfo().

* src/remote/remote_protocol.x: provide defines for the new entry points
* src/remote/remote_driver.c daemon/remote.c: implement the client and
  server side for virDomainGetBlockJobInfo.
* src/remote_protocol-structs: structure definitions for protocol verification
* src/rpc/gendispatch.pl: Permit some unsigned long parameters
This commit is contained in:
Adam Litke 2011-07-22 13:31:16 +08:00 committed by Daniel Veillard
parent 72082a054b
commit 4daeefac60
5 changed files with 158 additions and 1 deletions

View File

@ -1587,6 +1587,48 @@ no_memory:
goto cleanup;
}
static int
remoteDispatchDomainGetBlockJobInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client ATTRIBUTE_UNUSED,
virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr,
remote_domain_get_block_job_info_args *args,
remote_domain_get_block_job_info_ret *ret)
{
virDomainPtr dom = NULL;
virDomainBlockJobInfo tmp;
int rv = -1;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!priv->conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
goto cleanup;
rv = virDomainGetBlockJobInfo(dom, args->path, &tmp, args->flags);
if (rv <= 0)
goto cleanup;
ret->type = tmp.type;
ret->bandwidth = tmp.bandwidth;
ret->cur = tmp.cur;
ret->end = tmp.end;
ret->found = 1;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/*-------------------------------------------------------------*/
static int

View File

@ -1997,6 +1997,44 @@ done:
return rv;
}
static int remoteDomainGetBlockJobInfo(virDomainPtr domain,
const char *path,
virDomainBlockJobInfoPtr info,
unsigned int flags)
{
int rv = -1;
remote_domain_get_block_job_info_args args;
remote_domain_get_block_job_info_ret ret;
struct private_data *priv = domain->conn->privateData;
remoteDriverLock(priv);
make_nonnull_domain(&args.dom, domain);
args.path = (char *)path;
args.flags = flags;
if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO,
(xdrproc_t)xdr_remote_domain_get_block_job_info_args,
(char *)&args,
(xdrproc_t)xdr_remote_domain_get_block_job_info_ret,
(char *)&ret) == -1)
goto done;
if (ret.found) {
info->type = ret.type;
info->bandwidth = ret.bandwidth;
info->cur = ret.cur;
info->end = ret.end;
rv = 1;
} else {
rv = 0;
}
done:
remoteDriverUnlock(priv);
return rv;
}
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
@ -4262,6 +4300,10 @@ static virDriver remote_driver = {
.domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */
.domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */
.domainSendKey = remoteDomainSendKey, /* 0.9.3 */
.domainBlockJobAbort = remoteDomainBlockJobAbort, /* 0.9.4 */
.domainGetBlockJobInfo = remoteDomainGetBlockJobInfo, /* 0.9.4 */
.domainBlockJobSetSpeed = remoteDomainBlockJobSetSpeed, /* 0.9.4 */
.domainBlockPull = remoteDomainBlockPull, /* 0.9.4 */
};
static virNetworkDriver network_driver = {

View File

@ -1018,6 +1018,40 @@ struct remote_domain_set_autostart_args {
int autostart;
};
struct remote_domain_block_job_abort_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
unsigned int flags;
};
struct remote_domain_get_block_job_info_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
unsigned int flags;
};
struct remote_domain_get_block_job_info_ret {
int found;
int type;
unsigned hyper bandwidth;
unsigned hyper cur;
unsigned hyper end;
};
struct remote_domain_block_job_set_speed_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
unsigned hyper bandwidth;
unsigned int flags;
};
struct remote_domain_block_pull_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
unsigned hyper bandwidth;
unsigned int flags;
};
/* Network calls: */
struct remote_num_of_networks_ret {
@ -2428,7 +2462,11 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_RESTORE_FLAGS = 233, /* autogen autogen */
REMOTE_PROC_DOMAIN_DESTROY_FLAGS = 234, /* autogen autogen */
REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235, /* autogen autogen */
REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML = 236 /* autogen autogen */
REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML = 236, /* autogen autogen */
REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT = 237, /* autogen autogen */
REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO = 238, /* skipgen skipgen */
REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED = 239, /* autogen autogen */
REMOTE_PROC_DOMAIN_BLOCK_PULL = 240 /* autogen autogen */
/*
* Notice how the entries are grouped in sets of 10 ?

View File

@ -711,6 +711,35 @@ struct remote_domain_set_autostart_args {
remote_nonnull_domain dom;
int autostart;
};
struct remote_domain_block_job_abort_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
u_int flags;
};
struct remote_domain_get_block_job_info_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
u_int flags;
};
struct remote_domain_get_block_job_info_ret {
int found;
int type;
uint64_t bandwidth;
uint64_t cur;
uint64_t end;
};
struct remote_domain_block_job_set_speed_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
uint64_t bandwidth;
u_int flags;
};
struct remote_domain_block_pull_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
uint64_t bandwidth;
u_int flags;
};
struct remote_num_of_networks_ret {
int num;
};
@ -1896,4 +1925,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_DESTROY_FLAGS = 234,
REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235,
REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML = 236,
REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT = 237,
REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO = 238,
REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED = 239,
REMOTE_PROC_DOMAIN_BLOCK_PULL = 240,
};

View File

@ -220,6 +220,8 @@ my $long_legacy = {
GetLibVersion => { ret => { lib_ver => 1 } },
GetVersion => { ret => { hv_ver => 1 } },
NodeGetInfo => { ret => { memory => 1 } },
DomainBlockPull => { arg => { bandwidth => 1 } },
DomainBlockJobSetSpeed => { arg => { bandwidth => 1 } },
};
sub hyper_to_long