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

Implement remote bits for vol wiping

This commit is contained in:
David Allan 2010-03-01 15:32:35 -05:00
parent d36b4e92ac
commit 3fdb9ba760
8 changed files with 100 additions and 1 deletions

View File

@ -4272,6 +4272,38 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
return 0;
}
static int
remoteDispatchStorageVolWipe(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_vol_wipe_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int retval = -1;
virStorageVolPtr vol;
vol = get_nonnull_storage_vol(conn, args->vol);
if (vol == NULL) {
remoteDispatchConnError(rerr, conn);
goto out;
}
if (virStorageVolWipe(vol, args->flags) == -1) {
remoteDispatchConnError(rerr, conn);
goto out;
}
retval = 0;
out:
if (vol != NULL) {
virStorageVolFree(vol);
}
return retval;
}
static int
remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,

View File

@ -140,3 +140,4 @@
remote_cpu_baseline_args val_remote_cpu_baseline_args;
remote_domain_get_job_info_args val_remote_domain_get_job_info_args;
remote_domain_abort_job_args val_remote_domain_abort_job_args;
remote_storage_vol_wipe_args val_remote_storage_vol_wipe_args;

View File

@ -1298,6 +1298,14 @@ static int remoteDispatchStorageVolLookupByPath(
remote_error *err,
remote_storage_vol_lookup_by_path_args *args,
remote_storage_vol_lookup_by_path_ret *ret);
static int remoteDispatchStorageVolWipe(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
remote_message_header *hdr,
remote_error *err,
remote_storage_vol_wipe_args *args,
void *ret);
static int remoteDispatchSupportsFeature(
struct qemud_server *server,
struct qemud_client *client,

View File

@ -827,3 +827,8 @@
.args_filter = (xdrproc_t) xdr_remote_domain_abort_job_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* StorageVolWipe => 165 */
.fn = (dispatch_fn) remoteDispatchStorageVolWipe,
.args_filter = (xdrproc_t) xdr_remote_storage_vol_wipe_args,
.ret_filter = (xdrproc_t) xdr_void,
},

View File

@ -5537,6 +5537,32 @@ done:
return rv;
}
static int
remoteStorageVolWipe(virStorageVolPtr vol,
unsigned int flags)
{
int rv = -1;
remote_storage_vol_wipe_args args;
struct private_data *priv = vol->conn->storagePrivateData;
remoteDriverLock(priv);
make_nonnull_storage_vol(&args.vol, vol);
args.flags = flags;
if (call(vol->conn, priv, 0, REMOTE_PROC_STORAGE_VOL_WIPE,
(xdrproc_t) xdr_remote_storage_vol_wipe_args, (char *) &args,
(xdrproc_t) xdr_void, (char *) NULL) == -1)
goto done;
rv = 0;
done:
remoteDriverUnlock(priv);
return rv;
}
static int
remoteStorageVolGetInfo (virStorageVolPtr vol, virStorageVolInfoPtr info)
{
@ -9202,6 +9228,7 @@ static virStorageDriver storage_driver = {
.volCreateXML = remoteStorageVolCreateXML,
.volCreateXMLFrom = remoteStorageVolCreateXMLFrom,
.volDelete = remoteStorageVolDelete,
.volWipe = remoteStorageVolWipe,
.volGetInfo = remoteStorageVolGetInfo,
.volGetXMLDesc = remoteStorageVolDumpXML,
.volGetPath = remoteStorageVolGetPath,

View File

@ -2285,6 +2285,17 @@ xdr_remote_storage_vol_delete_args (XDR *xdrs, remote_storage_vol_delete_args *o
return TRUE;
}
bool_t
xdr_remote_storage_vol_wipe_args (XDR *xdrs, remote_storage_vol_wipe_args *objp)
{
if (!xdr_remote_nonnull_storage_vol (xdrs, &objp->vol))
return FALSE;
if (!xdr_u_int (xdrs, &objp->flags))
return FALSE;
return TRUE;
}
bool_t
xdr_remote_storage_vol_dump_xml_args (XDR *xdrs, remote_storage_vol_dump_xml_args *objp)
{

View File

@ -1295,6 +1295,12 @@ struct remote_storage_vol_delete_args {
};
typedef struct remote_storage_vol_delete_args remote_storage_vol_delete_args;
struct remote_storage_vol_wipe_args {
remote_nonnull_storage_vol vol;
u_int flags;
};
typedef struct remote_storage_vol_wipe_args remote_storage_vol_wipe_args;
struct remote_storage_vol_dump_xml_args {
remote_nonnull_storage_vol vol;
u_int flags;
@ -1872,6 +1878,7 @@ enum remote_procedure {
REMOTE_PROC_CPU_BASELINE = 162,
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
REMOTE_PROC_STORAGE_VOL_WIPE = 165,
};
typedef enum remote_procedure remote_procedure;
@ -2110,6 +2117,7 @@ extern bool_t xdr_remote_storage_vol_create_xml_ret (XDR *, remote_storage_vol_
extern bool_t xdr_remote_storage_vol_create_xml_from_args (XDR *, remote_storage_vol_create_xml_from_args*);
extern bool_t xdr_remote_storage_vol_create_xml_from_ret (XDR *, remote_storage_vol_create_xml_from_ret*);
extern bool_t xdr_remote_storage_vol_delete_args (XDR *, remote_storage_vol_delete_args*);
extern bool_t xdr_remote_storage_vol_wipe_args (XDR *, remote_storage_vol_wipe_args*);
extern bool_t xdr_remote_storage_vol_dump_xml_args (XDR *, remote_storage_vol_dump_xml_args*);
extern bool_t xdr_remote_storage_vol_dump_xml_ret (XDR *, remote_storage_vol_dump_xml_ret*);
extern bool_t xdr_remote_storage_vol_get_info_args (XDR *, remote_storage_vol_get_info_args*);
@ -2393,6 +2401,7 @@ extern bool_t xdr_remote_storage_vol_create_xml_ret ();
extern bool_t xdr_remote_storage_vol_create_xml_from_args ();
extern bool_t xdr_remote_storage_vol_create_xml_from_ret ();
extern bool_t xdr_remote_storage_vol_delete_args ();
extern bool_t xdr_remote_storage_vol_wipe_args ();
extern bool_t xdr_remote_storage_vol_dump_xml_args ();
extern bool_t xdr_remote_storage_vol_dump_xml_ret ();
extern bool_t xdr_remote_storage_vol_get_info_args ();

View File

@ -1169,6 +1169,11 @@ struct remote_storage_vol_delete_args {
unsigned flags;
};
struct remote_storage_vol_wipe_args {
remote_nonnull_storage_vol vol;
unsigned flags;
};
struct remote_storage_vol_dump_xml_args {
remote_nonnull_storage_vol vol;
unsigned flags;
@ -1703,7 +1708,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
REMOTE_PROC_CPU_BASELINE = 162,
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
REMOTE_PROC_DOMAIN_ABORT_JOB = 164
REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
REMOTE_PROC_STORAGE_VOL_WIPE = 165
/*
* Notice how the entries are grouped in sets of 10 ?