mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Add virDomainBlockPull support to the remote driver
The generator can handle DomainBlockPullAll and DomainBlockPullAbort. DomainBlockPull and DomainBlockPullInfo must be written by hand. * 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 * src/remote_protocol-structs: structure definitions for protocol verification Signed-off-by: Adam Litke <agl@us.ibm.com>
This commit is contained in:
parent
6419f596e1
commit
d1693bb160
@ -1670,6 +1670,77 @@ no_memory:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchDomainBlockPull(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error * rerr,
|
||||||
|
remote_domain_block_pull_args *args,
|
||||||
|
remote_domain_block_pull_ret *ret)
|
||||||
|
{
|
||||||
|
virDomainPtr dom = NULL;
|
||||||
|
virDomainBlockPullInfo tmp;
|
||||||
|
int rv = -1;
|
||||||
|
|
||||||
|
if (!conn) {
|
||||||
|
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainBlockPull(dom, args->path, &tmp, args->flags) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
ret->cur = tmp.cur;
|
||||||
|
ret->end = tmp.end;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (rv < 0)
|
||||||
|
remoteDispatchError(rerr);
|
||||||
|
if (dom)
|
||||||
|
virDomainFree(dom);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchDomainGetBlockPullInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error * rerr,
|
||||||
|
remote_domain_get_block_pull_info_args *args,
|
||||||
|
remote_domain_get_block_pull_info_ret *ret)
|
||||||
|
{
|
||||||
|
virDomainPtr dom = NULL;
|
||||||
|
virDomainBlockPullInfo tmp;
|
||||||
|
int rv = -1;
|
||||||
|
|
||||||
|
if (!conn) {
|
||||||
|
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainGetBlockPullInfo(dom, args->path, &tmp, args->flags) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
ret->cur = tmp.cur;
|
||||||
|
ret->end = tmp.end;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (rv < 0)
|
||||||
|
remoteDispatchError(rerr);
|
||||||
|
if (dom)
|
||||||
|
virDomainFree(dom);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2639,6 +2639,70 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int remoteDomainBlockPull(virDomainPtr domain,
|
||||||
|
const char *path,
|
||||||
|
virDomainBlockPullInfoPtr info,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_domain_block_pull_args args;
|
||||||
|
remote_domain_block_pull_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_BLOCK_PULL,
|
||||||
|
(xdrproc_t)xdr_remote_domain_block_pull_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_block_pull_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
if (info) {
|
||||||
|
info->cur = ret.cur;
|
||||||
|
info->end = ret.end;
|
||||||
|
}
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDomainGetBlockPullInfo(virDomainPtr domain,
|
||||||
|
const char *path,
|
||||||
|
virDomainBlockPullInfoPtr info,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_domain_get_block_pull_info_args args;
|
||||||
|
remote_domain_get_block_pull_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_PULL_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_block_pull_info_args,
|
||||||
|
(char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_block_pull_info_ret,
|
||||||
|
(char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
info->cur = ret.cur;
|
||||||
|
info->end = ret.end;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
||||||
@ -6471,6 +6535,10 @@ static virDriver remote_driver = {
|
|||||||
.domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */
|
.domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */
|
||||||
.domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */
|
.domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */
|
||||||
.domainSendKey = remoteDomainSendKey, /* 0.9.3 */
|
.domainSendKey = remoteDomainSendKey, /* 0.9.3 */
|
||||||
|
.domainBlockPull = remoteDomainBlockPull, /* 0.9.3 */
|
||||||
|
.domainBlockPullAll = remoteDomainBlockPullAll, /* 0.9.3 */
|
||||||
|
.domainBlockPullAbort = remoteDomainBlockPullAbort, /* 0.9.3 */
|
||||||
|
.domainGetBlockPullInfo = remoteDomainGetBlockPullInfo, /* 0.9.3 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static virNetworkDriver network_driver = {
|
static virNetworkDriver network_driver = {
|
||||||
|
@ -969,6 +969,40 @@ struct remote_domain_set_autostart_args {
|
|||||||
int autostart;
|
int autostart;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_domain_block_pull_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_block_pull_ret {
|
||||||
|
unsigned hyper cur;
|
||||||
|
unsigned hyper end;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_block_pull_all_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_block_pull_abort_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_get_block_pull_info_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_get_block_pull_info_ret {
|
||||||
|
unsigned hyper cur;
|
||||||
|
unsigned hyper end;
|
||||||
|
};
|
||||||
|
|
||||||
/* Network calls: */
|
/* Network calls: */
|
||||||
|
|
||||||
struct remote_num_of_networks_ret {
|
struct remote_num_of_networks_ret {
|
||||||
@ -2359,7 +2393,12 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225, /* skipgen autogen */
|
REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225, /* skipgen autogen */
|
||||||
REMOTE_PROC_DOMAIN_SEND_KEY = 226, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_SEND_KEY = 226, /* autogen autogen */
|
||||||
REMOTE_PROC_NODE_GET_CPU_STATS = 227, /* skipgen skipgen */
|
REMOTE_PROC_NODE_GET_CPU_STATS = 227, /* skipgen skipgen */
|
||||||
REMOTE_PROC_NODE_GET_MEMORY_STATS = 228 /* skipgen skipgen */
|
REMOTE_PROC_NODE_GET_MEMORY_STATS = 228, /* skipgen skipgen */
|
||||||
|
REMOTE_PROC_DOMAIN_BLOCK_PULL = 229, /* skipgen skipgen */
|
||||||
|
REMOTE_PROC_DOMAIN_BLOCK_PULL_ALL = 230, /* autogen autogen */
|
||||||
|
|
||||||
|
REMOTE_PROC_DOMAIN_BLOCK_PULL_ABORT = 231, /* autogen autogen */
|
||||||
|
REMOTE_PROC_DOMAIN_GET_BLOCK_PULL_INFO = 232 /* skipgen skipgen */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice how the entries are grouped in sets of 10 ?
|
* Notice how the entries are grouped in sets of 10 ?
|
||||||
|
@ -654,6 +654,34 @@ struct remote_domain_set_autostart_args {
|
|||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
int autostart;
|
int autostart;
|
||||||
};
|
};
|
||||||
|
struct remote_domain_block_pull_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_block_pull_ret {
|
||||||
|
uint64_t cur;
|
||||||
|
uint64_t end;
|
||||||
|
};
|
||||||
|
struct remote_domain_block_pull_all_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_block_pull_abort_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_get_block_pull_info_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
remote_nonnull_string path;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_get_block_pull_info_ret {
|
||||||
|
uint64_t cur;
|
||||||
|
uint64_t end;
|
||||||
|
};
|
||||||
struct remote_num_of_networks_ret {
|
struct remote_num_of_networks_ret {
|
||||||
int num;
|
int num;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user