mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Remote protocol support for storage vol upload/download APIs
* daemon/remote.c, src/remote/remote_driver.c: Implementation of storage vol upload/download APIs * src/remote/remote_protocol.x: Wire protocol definition for upload/download * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h, daemon/remote_dispatch_table.h, src/remote/remote_protocol.h, src/remote/remote_protocol.c: Re-generate
This commit is contained in:
@@ -5831,7 +5831,99 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceFree(dev);
|
||||
return 0;
|
||||
}
|
||||
static int remoteDispatchStorageVolUpload(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *rerr,
|
||||
remote_storage_vol_upload_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int rv = -1;
|
||||
struct qemud_client_stream *stream = NULL;
|
||||
virStorageVolPtr vol;
|
||||
|
||||
vol = get_nonnull_storage_vol(conn, args->vol);
|
||||
if (vol == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
stream = remoteCreateClientStream(conn, hdr);
|
||||
if (!stream) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStorageVolUpload(vol, stream->st,
|
||||
args->offset, args->length,
|
||||
args->flags) < 0) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (remoteAddClientStream(client, stream, 0) < 0) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
virStreamAbort(stream->st);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (vol)
|
||||
virStorageVolFree(vol);
|
||||
if (stream && rv != 0)
|
||||
remoteFreeClientStream(client, stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int remoteDispatchStorageVolDownload(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *rerr,
|
||||
remote_storage_vol_download_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int rv = -1;
|
||||
struct qemud_client_stream *stream = NULL;
|
||||
virStorageVolPtr vol;
|
||||
|
||||
vol = get_nonnull_storage_vol (conn, args->vol);
|
||||
if (vol == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
stream = remoteCreateClientStream(conn, hdr);
|
||||
if (!stream) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStorageVolDownload(vol, stream->st,
|
||||
args->offset, args->length,
|
||||
args->flags) < 0) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (remoteAddClientStream(client, stream, 1) < 0) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
virStreamAbort(stream->st);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (vol)
|
||||
virStorageVolFree(vol);
|
||||
if (stream && rv != 0)
|
||||
remoteFreeClientStream(client, stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/***************************
|
||||
|
||||
@@ -176,3 +176,5 @@
|
||||
remote_domain_set_blkio_parameters_args val_remote_domain_set_blkio_parameters_args;
|
||||
remote_domain_get_blkio_parameters_args val_remote_domain_get_blkio_parameters_args;
|
||||
remote_domain_migrate_set_max_speed_args val_remote_domain_migrate_set_max_speed_args;
|
||||
remote_storage_vol_upload_args val_remote_storage_vol_upload_args;
|
||||
remote_storage_vol_download_args val_remote_storage_vol_download_args;
|
||||
|
||||
@@ -1538,6 +1538,14 @@ static int remoteDispatchStorageVolDelete(
|
||||
remote_error *err,
|
||||
remote_storage_vol_delete_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchStorageVolDownload(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_storage_vol_download_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchStorageVolDumpXml(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
@@ -1586,6 +1594,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 remoteDispatchStorageVolUpload(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_storage_vol_upload_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchStorageVolWipe(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
|
||||
@@ -1042,3 +1042,13 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_speed_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
{ /* StorageVolUpload => 208 */
|
||||
.fn = (dispatch_fn) remoteDispatchStorageVolUpload,
|
||||
.args_filter = (xdrproc_t) xdr_remote_storage_vol_upload_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
{ /* StorageVolDownload => 209 */
|
||||
.fn = (dispatch_fn) remoteDispatchStorageVolDownload,
|
||||
.args_filter = (xdrproc_t) xdr_remote_storage_vol_download_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user