mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 22:03:49 +03:00
Remote protocol impl for virDomainGetBlockInfo
* daemon/remote.c: Server side dispatcher * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h, daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h: Update with new API * src/remote/remote_driver.c: Client side dispatcher * src/remote/remote_protocol.c, src/remote/remote_protocol.h: Update * src/remote/remote_protocol.x: Define new wire protocol
This commit is contained in:
parent
46bad5121f
commit
84a3269a15
@ -6434,6 +6434,40 @@ remoteDispatchNumOfNwfilters (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainGetBlockInfo (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_info_args *args,
|
||||
remote_domain_get_block_info_ret *ret)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
virDomainBlockInfo info;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainGetBlockInfo (dom, args->path, &info, args->flags) == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret->capacity = info.capacity;
|
||||
ret->allocation = info.allocation;
|
||||
ret->physical = info.physical;
|
||||
|
||||
virDomainFree(dom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----- Helpers. -----*/
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
|
@ -163,3 +163,4 @@
|
||||
remote_domain_snapshot_current_args val_remote_domain_snapshot_current_args;
|
||||
remote_domain_revert_to_snapshot_args val_remote_domain_revert_to_snapshot_args;
|
||||
remote_domain_snapshot_delete_args val_remote_domain_snapshot_delete_args;
|
||||
remote_domain_get_block_info_args val_remote_domain_get_block_info_args;
|
||||
|
@ -210,6 +210,14 @@ static int remoteDispatchDomainGetAutostart(
|
||||
remote_error *err,
|
||||
remote_domain_get_autostart_args *args,
|
||||
remote_domain_get_autostart_ret *ret);
|
||||
static int remoteDispatchDomainGetBlockInfo(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_get_block_info_args *args,
|
||||
remote_domain_get_block_info_ret *ret);
|
||||
static int remoteDispatchDomainGetInfo(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
|
@ -133,3 +133,4 @@
|
||||
remote_domain_snapshot_lookup_by_name_ret val_remote_domain_snapshot_lookup_by_name_ret;
|
||||
remote_domain_has_current_snapshot_ret val_remote_domain_has_current_snapshot_ret;
|
||||
remote_domain_snapshot_current_ret val_remote_domain_snapshot_current_ret;
|
||||
remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
|
||||
|
@ -972,3 +972,8 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_snapshot_delete_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
{ /* DomainGetBlockInfo => 194 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainGetBlockInfo,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_get_block_info_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_domain_get_block_info_ret,
|
||||
},
|
||||
|
@ -3621,6 +3621,40 @@ done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainGetBlockInfo (virDomainPtr domain,
|
||||
const char *path,
|
||||
virDomainBlockInfoPtr info,
|
||||
unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_get_block_info_args args;
|
||||
remote_domain_get_block_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;
|
||||
|
||||
memset (&ret, 0, sizeof ret);
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_INFO,
|
||||
(xdrproc_t) xdr_remote_domain_get_block_info_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_get_block_info_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
info->allocation = ret.allocation;
|
||||
info->capacity = ret.capacity;
|
||||
info->physical = ret.physical;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainManagedSave (virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
@ -10144,7 +10178,7 @@ static virDriver remote_driver = {
|
||||
remoteDomainMemoryStats, /* domainMemoryStats */
|
||||
remoteDomainBlockPeek, /* domainBlockPeek */
|
||||
remoteDomainMemoryPeek, /* domainMemoryPeek */
|
||||
NULL, /* domainBlockInfo */
|
||||
remoteDomainGetBlockInfo, /* domainGetBlockInfo */
|
||||
remoteNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
|
||||
remoteNodeGetFreeMemory, /* getFreeMemory */
|
||||
remoteDomainEventRegister, /* domainEventRegister */
|
||||
|
@ -725,6 +725,32 @@ xdr_remote_domain_memory_peek_ret (XDR *xdrs, remote_domain_memory_peek_ret *obj
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_get_block_info_args (XDR *xdrs, remote_domain_get_block_info_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
if (!xdr_remote_nonnull_string (xdrs, &objp->path))
|
||||
return FALSE;
|
||||
if (!xdr_u_int (xdrs, &objp->flags))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_get_block_info_ret (XDR *xdrs, remote_domain_get_block_info_ret *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint64_t (xdrs, &objp->allocation))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->capacity))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->physical))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_list_domains_args (XDR *xdrs, remote_list_domains_args *objp)
|
||||
{
|
||||
|
@ -389,6 +389,20 @@ struct remote_domain_memory_peek_ret {
|
||||
};
|
||||
typedef struct remote_domain_memory_peek_ret remote_domain_memory_peek_ret;
|
||||
|
||||
struct remote_domain_get_block_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_nonnull_string path;
|
||||
u_int flags;
|
||||
};
|
||||
typedef struct remote_domain_get_block_info_args remote_domain_get_block_info_args;
|
||||
|
||||
struct remote_domain_get_block_info_ret {
|
||||
uint64_t allocation;
|
||||
uint64_t capacity;
|
||||
uint64_t physical;
|
||||
};
|
||||
typedef struct remote_domain_get_block_info_ret remote_domain_get_block_info_ret;
|
||||
|
||||
struct remote_list_domains_args {
|
||||
int maxids;
|
||||
};
|
||||
@ -2191,6 +2205,7 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191,
|
||||
REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192,
|
||||
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
|
||||
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
|
||||
};
|
||||
typedef enum remote_procedure remote_procedure;
|
||||
|
||||
@ -2277,6 +2292,8 @@ extern bool_t xdr_remote_domain_block_peek_args (XDR *, remote_domain_block_pee
|
||||
extern bool_t xdr_remote_domain_block_peek_ret (XDR *, remote_domain_block_peek_ret*);
|
||||
extern bool_t xdr_remote_domain_memory_peek_args (XDR *, remote_domain_memory_peek_args*);
|
||||
extern bool_t xdr_remote_domain_memory_peek_ret (XDR *, remote_domain_memory_peek_ret*);
|
||||
extern bool_t xdr_remote_domain_get_block_info_args (XDR *, remote_domain_get_block_info_args*);
|
||||
extern bool_t xdr_remote_domain_get_block_info_ret (XDR *, remote_domain_get_block_info_ret*);
|
||||
extern bool_t xdr_remote_list_domains_args (XDR *, remote_list_domains_args*);
|
||||
extern bool_t xdr_remote_list_domains_ret (XDR *, remote_list_domains_ret*);
|
||||
extern bool_t xdr_remote_num_of_domains_ret (XDR *, remote_num_of_domains_ret*);
|
||||
@ -2607,6 +2624,8 @@ extern bool_t xdr_remote_domain_block_peek_args ();
|
||||
extern bool_t xdr_remote_domain_block_peek_ret ();
|
||||
extern bool_t xdr_remote_domain_memory_peek_args ();
|
||||
extern bool_t xdr_remote_domain_memory_peek_ret ();
|
||||
extern bool_t xdr_remote_domain_get_block_info_args ();
|
||||
extern bool_t xdr_remote_domain_get_block_info_ret ();
|
||||
extern bool_t xdr_remote_list_domains_args ();
|
||||
extern bool_t xdr_remote_list_domains_ret ();
|
||||
extern bool_t xdr_remote_num_of_domains_ret ();
|
||||
|
@ -484,6 +484,18 @@ struct remote_domain_memory_peek_ret {
|
||||
opaque buffer<REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_get_block_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
remote_nonnull_string path;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
struct remote_domain_get_block_info_ret {
|
||||
unsigned hyper allocation;
|
||||
unsigned hyper capacity;
|
||||
unsigned hyper physical;
|
||||
};
|
||||
|
||||
struct remote_list_domains_args {
|
||||
int maxids;
|
||||
};
|
||||
@ -1983,7 +1995,8 @@ enum remote_procedure {
|
||||
|
||||
REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191,
|
||||
REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192,
|
||||
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193
|
||||
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
|
||||
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
|
Loading…
x
Reference in New Issue
Block a user