---
daemon/remote.c | 701 ---------------------------------------
daemon/remote_dispatch_bodies.c | 681 +++++++++++++++++++++++++++++++++++++-
daemon/remote_generator.pl | 111 +++++-
3 files changed, 758 insertions(+), 735 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index f42e2db..4c05567 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -531,53 +531,6 @@ cleanup:
}
static int
-remoteDispatchNodeGetCellsFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_node_get_cells_free_memory_args *args,
- remote_node_get_cells_free_memory_ret *ret)
-{
- int len;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxCells > REMOTE_NODE_MAX_CELLS) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxCells > REMOTE_NODE_MAX_CELLS"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->freeMems.freeMems_val, args->maxCells) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virNodeGetCellsFreeMemory(conn,
- (unsigned long long *)ret->freeMems.freeMems_val,
- args->startCell,
- args->maxCells);
- if (len <= 0)
- goto cleanup;
- ret->freeMems.freeMems_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->freeMems.freeMems_val);
- }
- return rv;
-}
-
-static int
remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1426,51 +1379,6 @@ cleanup:
}
static int
-remoteDispatchListDefinedDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_defined_domains_args *args,
- remote_list_defined_domains_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_DOMAIN_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListDefinedDomains(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1942,233 +1850,6 @@ no_memory:
goto cleanup;
}
-static int
-remoteDispatchListDefinedNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_defined_networks_args *args,
- remote_list_defined_networks_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_NETWORK_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListDefinedNetworks(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
-remoteDispatchListDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_domains_args *args,
- remote_list_domains_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxids >
REMOTE_DOMAIN_ID_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->ids.ids_val, args->maxids) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListDomains(conn,
- ret->ids.ids_val, args->maxids);
- if (len < 0)
- goto cleanup;
- ret->ids.ids_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->ids.ids_val);
- }
- return rv;
-}
-
-static int
-remoteDispatchListNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_networks_args *args,
- remote_list_networks_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_NETWORK_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListNetworks(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-/*-------------------------------------------------------------*/
-
-static int
-remoteDispatchListInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_interfaces_args *args,
- remote_list_interfaces_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_INTERFACE_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_INTERFACE_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListInterfaces(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
-remoteDispatchListDefinedInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_defined_interfaces_args *args,
- remote_list_defined_interfaces_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListDefinedInterfaces(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
/*-------------------------------------------------------------*/
static int
@@ -2973,97 +2654,6 @@ remoteDispatchAuthPolkit(struct qemud_server *server
ATTRIBUTE_UNUSED,
* STORAGE POOL APIS
***************************************************************/
-
-static int
-remoteDispatchListDefinedStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_defined_storage_pools_args *args,
- remote_list_defined_storage_pools_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListDefinedStoragePools(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
-remoteDispatchListStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_storage_pools_args *args,
- remote_list_storage_pools_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListStoragePools(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
static int
remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -3103,58 +2693,6 @@ cleanup:
return rv;
}
-static int
-remoteDispatchStoragePoolListVolumes(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_pool_list_volumes_args *args,
- remote_storage_pool_list_volumes_ret *ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virStoragePoolListVolumes(pool,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-
/***************************************************************
* STORAGE VOL APIS
***************************************************************/
@@ -3202,52 +2740,6 @@ cleanup:
**************************************************************/
static int
-remoteDispatchNodeListDevices(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_node_list_devices_args *args,
- remote_node_list_devices_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virNodeListDevices(conn,
- args->cap ? *args->cap : NULL,
- ret->names.names_val, args->maxnames,
args->flags);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
remoteDispatchNodeDeviceGetParent(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -3297,57 +2789,6 @@ cleanup:
return rv;
}
-static int
-remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_node_device_list_caps_args *args,
- remote_node_device_list_caps_ret *ret)
-{
- virNodeDevicePtr dev = NULL;
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
- goto cleanup;
-
- if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virNodeDeviceListCaps(dev, ret->names.names_val,
- args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- if (dev)
- virNodeDeviceFree(dev);
- return rv;
-}
-
static int remoteDispatchStorageVolUpload(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
virConnectPtr conn,
@@ -3580,50 +3021,6 @@ cleanup:
}
static int
-remoteDispatchListSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_secrets_args *args,
- remote_list_secrets_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxuuids > REMOTE_SECRET_UUID_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("maxuuids > REMOTE_SECRET_UUID_LIST_MAX"));
- goto cleanup;
- }
-
- if (VIR_ALLOC_N(ret->uuids.uuids_val, args->maxuuids) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListSecrets(conn, ret->uuids.uuids_val,
- args->maxuuids);
- if (len < 0)
- goto cleanup;
- ret->uuids.uuids_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->uuids.uuids_val);
- }
- return rv;
-}
-
-static int
remoteDispatchSecretGetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -3773,59 +3170,6 @@ cleanup:
}
static int
-remoteDispatchDomainSnapshotListNames(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_snapshot_list_names_args *args,
- remote_domain_snapshot_list_names_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_DOMAIN_SNAPSHOT_LIST_NAMES_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("maxnames > REMOTE_DOMAIN_SNAPSHOT_LIST_NAMES_MAX"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virDomainSnapshotListNames(dom,
- ret->names.names_val,
- args->maxnames,
- args->flags);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -3912,51 +3256,6 @@ cleanup:
}
static int
-remoteDispatchListNWFilters(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_list_nwfilters_args *args,
- remote_list_nwfilters_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (args->maxnames > REMOTE_NWFILTER_NAME_LIST_MAX) {
- virNetError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("maxnames >
REMOTE_NWFILTER_NAME_LIST_MAX"));
- goto cleanup;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- len = virConnectListNWFilters(conn,
- ret->names.names_val, args->maxnames);
- if (len < 0)
- goto cleanup;
- ret->names.names_len = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0) {
- remoteDispatchError(rerr);
- VIR_FREE(ret->names.names_val);
- }
- return rv;
-}
-
-static int
remoteDispatchDomainGetBlockInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
diff --git a/daemon/remote_dispatch_bodies.c b/daemon/remote_dispatch_bodies.c
index 77b7db4..d12988e 100644
--- a/daemon/remote_dispatch_bodies.c
+++ b/daemon/remote_dispatch_bodies.c
@@ -1703,7 +1703,55 @@ cleanup:
return rv;
}
-/* remoteDispatchDomainSnapshotListNames has to be implemented manually */
+static int
+remoteDispatchDomainSnapshotListNames(
+ 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_snapshot_list_names_args *args,
+ remote_domain_snapshot_list_names_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_DOMAIN_SNAPSHOT_LIST_NAMES_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_DOMAIN_SNAPSHOT_LIST_NAMES_MAX"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virDomainSnapshotListNames(dom, ret->names.names_val,
args->maxnames, args->flags)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
static int
remoteDispatchDomainSnapshotLookupByName(
@@ -2489,25 +2537,445 @@ cleanup:
return rv;
}
-/* remoteDispatchListDefinedDomains has to be implemented manually */
+static int
+remoteDispatchListDefinedDomains(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_defined_domains_args *args,
+ remote_list_defined_domains_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_DOMAIN_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListDefinedDomains(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListDefinedInterfaces(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_defined_interfaces_args *args,
+ remote_list_defined_interfaces_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListDefinedInterfaces(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListDefinedNetworks(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_defined_networks_args *args,
+ remote_list_defined_networks_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_NETWORK_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListDefinedNetworks(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListDefinedStoragePools(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_defined_storage_pools_args *args,
+ remote_list_defined_storage_pools_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListDefinedStoragePools(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListDomains(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_domains_args *args,
+ remote_list_domains_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxids >
REMOTE_DOMAIN_ID_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->ids.ids_val, args->maxids) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
-/* remoteDispatchListDefinedInterfaces has to be implemented manually */
+ if ((len = virConnectListDomains(conn, ret->ids.ids_val, args->maxids)) <
0)
+ goto cleanup;
-/* remoteDispatchListDefinedNetworks has to be implemented manually */
+ ret->ids.ids_len = len;
+ rv = 0;
-/* remoteDispatchListDefinedStoragePools has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->ids.ids_val);
+ return rv;
+}
-/* remoteDispatchListDomains has to be implemented manually */
+static int
+remoteDispatchListInterfaces(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_interfaces_args *args,
+ remote_list_interfaces_ret *ret)
+{
+ int rv = -1;
+ int len;
-/* remoteDispatchListInterfaces has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchListNetworks has to be implemented manually */
+ if (args->maxnames > REMOTE_INTERFACE_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_INTERFACE_NAME_LIST_MAX"));
+ goto cleanup;
+ }
-/* remoteDispatchListNWFilters has to be implemented manually */
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
-/* remoteDispatchListSecrets has to be implemented manually */
+ if ((len = virConnectListInterfaces(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
-/* remoteDispatchListStoragePools has to be implemented manually */
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListNetworks(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_networks_args *args,
+ remote_list_networks_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_NETWORK_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListNetworks(conn, ret->names.names_val, args->maxnames))
< 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListNWFilters(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_nwfilters_args *args,
+ remote_list_nwfilters_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_NWFILTER_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_NWFILTER_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListNWFilters(conn, ret->names.names_val, args->maxnames))
< 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
+
+static int
+remoteDispatchListSecrets(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_secrets_args *args,
+ remote_list_secrets_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxuuids > REMOTE_SECRET_UUID_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxuuids >
REMOTE_SECRET_UUID_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->uuids.uuids_val, args->maxuuids) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListSecrets(conn, ret->uuids.uuids_val, args->maxuuids))
< 0)
+ goto cleanup;
+
+ ret->uuids.uuids_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->uuids.uuids_val);
+ return rv;
+}
+
+static int
+remoteDispatchListStoragePools(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_list_storage_pools_args *args,
+ remote_list_storage_pools_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virConnectListStoragePools(conn, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
static int
remoteDispatchNetworkCreate(
@@ -3091,7 +3559,55 @@ cleanup:
/* remoteDispatchNodeDeviceGetParent has to be implemented manually */
-/* remoteDispatchNodeDeviceListCaps has to be implemented manually */
+static int
+remoteDispatchNodeDeviceListCaps(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_node_device_list_caps_args *args,
+ remote_node_device_list_caps_ret *ret)
+{
+ int rv = -1;
+ virNodeDevicePtr dev = NULL;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_NODE_DEVICE_CAPS_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_NODE_DEVICE_CAPS_LIST_MAX"));
+ goto cleanup;
+ }
+
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+ goto cleanup;
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virNodeDeviceListCaps(dev, ret->names.names_val, args->maxnames))
< 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dev)
+ virNodeDeviceFree(dev);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
static int
remoteDispatchNodeDeviceLookupByName(
@@ -3229,7 +3745,49 @@ cleanup:
return rv;
}
-/* remoteDispatchNodeGetCellsFreeMemory has to be implemented manually */
+static int
+remoteDispatchNodeGetCellsFreeMemory(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_node_get_cells_free_memory_args *args,
+ remote_node_get_cells_free_memory_ret *ret)
+{
+ int rv = -1;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxCells > REMOTE_NODE_MAX_CELLS) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxfreeMems >
REMOTE_NODE_MAX_CELLS"));
+ goto cleanup;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->freeMems.freeMems_val, args->maxCells) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virNodeGetCellsFreeMemory(conn, (unsigned long long
*)ret->freeMems.freeMems_val, args->startCell, args->maxCells)) <= 0)
+ goto cleanup;
+
+ ret->freeMems.freeMems_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->freeMems.freeMems_val);
+ return rv;
+}
static int
remoteDispatchNodeGetFreeMemory(
@@ -3265,7 +3823,52 @@ cleanup:
/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
-/* remoteDispatchNodeListDevices has to be implemented manually */
+static int
+remoteDispatchNodeListDevices(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_node_list_devices_args *args,
+ remote_node_list_devices_ret *ret)
+{
+ int rv = -1;
+ char *cap;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ cap = args->cap ? *args->cap : NULL;
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virNodeListDevices(conn, cap, ret->names.names_val, args->maxnames,
args->flags)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
static int
remoteDispatchNodeNumOfDevices(
@@ -4316,7 +4919,55 @@ cleanup:
return rv;
}
-/* remoteDispatchStoragePoolListVolumes has to be implemented manually */
+static int
+remoteDispatchStoragePoolListVolumes(
+ 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_pool_list_volumes_args *args,
+ remote_storage_pool_list_volumes_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ int len;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("maxnames >
REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
+ goto cleanup;
+ }
+
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if ((len = virStoragePoolListVolumes(pool, ret->names.names_val,
args->maxnames)) < 0)
+ goto cleanup;
+
+ ret->names.names_len = len;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ if (rv < 0)
+ VIR_FREE(ret->names.names_val);
+ return rv;
+}
static int
remoteDispatchStoragePoolLookupByName(
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index b3cb9b5..e9a60bc 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -278,27 +278,12 @@ elsif ($opt_b) {
"DomainMemoryStats",
"DomainMigratePrepare",
"DomainMigratePrepare2",
- "DomainSnapshotListNames",
"GetType",
- "ListDefinedDomains",
- "ListDefinedInterfaces",
- "ListDefinedNetworks",
- "ListDefinedStoragePools",
- "ListDomains",
- "ListInterfaces",
- "ListNetworks",
- "ListNWFilters",
- "ListSecrets",
- "ListStoragePools",
"NodeDeviceGetParent",
- "NodeDeviceListCaps",
- "NodeGetCellsFreeMemory",
"NodeGetInfo",
"NodeGetSecurityModel",
- "NodeListDevices",
"SecretGetValue",
"StoragePoolGetInfo",
- "StoragePoolListVolumes",
"StorageVolGetInfo");
} elsif ($structprefix eq "qemu") {
@ungeneratable = ("MonitorCommand");
@@ -480,12 +465,38 @@ elsif ($opt_b) {
my $single_ret_var = "undefined";
my $single_ret_by_ref = 0;
my $single_ret_check = " == undefined";
+ my $single_ret_as_list = 0;
+ my $single_ret_list_name = "undefined";
+ my $single_ret_list_max_var = "undefined";
+ my $single_ret_list_max_define = "undefined";
if ($calls{$_}->{ret} ne "void") {
foreach my $ret_member (@{$calls{$_}->{ret_members}}) {
- if ($ret_member =~ m/(\S+)<\S+>;/) {
- push(@ret_list, "ret->$1.$1_val");
- push(@ret_list, "ret->$1.$1_len");
+ if ($ret_member =~ m/remote_nonnull_string (\S+)<(\S+)>;/) {
+ push(@vars_list, "int len");
+ push(@ret_list, "ret->$1.$1_len = len;");
+ push(@free_list,
+ " if (rv < 0)\n" .
+ " VIR_FREE(ret->$1.$1_val);");
+ $single_ret_var = "len";
+ $single_ret_by_ref = 0;
+ $single_ret_check = " < 0";
+ $single_ret_as_list = 1;
+ $single_ret_list_name = $1;
+ $single_ret_list_max_var = "max$1";
+ $single_ret_list_max_define = $2;
+
+ if ($calls{$_}->{ProcName} eq "NodeListDevices") {
+ my $conn = shift(@args_list);
+ my $cap = shift(@args_list);
+ unshift(@args_list, "ret->$1.$1_val");
+ unshift(@args_list, $cap);
+ unshift(@args_list, $conn);
+ } else {
+ my $conn = shift(@args_list);
+ unshift(@args_list, "ret->$1.$1_val");
+ unshift(@args_list, $conn);
+ }
} elsif ($ret_member =~ m/remote_nonnull_string (\S+);/) {
push(@vars_list, "char *$1");
push(@ret_list, "ret->$1 = $1;");
@@ -573,6 +584,23 @@ elsif ($opt_b) {
$single_ret_var = $1;
$single_ret_by_ref = 0;
$single_ret_check = " == NULL";
+ } elsif ($ret_member =~ m/int (\S+)<(\S+)>;/) {
+ push(@vars_list, "int len");
+ push(@ret_list, "ret->$1.$1_len = len;");
+ push(@free_list,
+ " if (rv < 0)\n" .
+ " VIR_FREE(ret->$1.$1_val);");
+ $single_ret_var = "len";
+ $single_ret_by_ref = 0;
+ $single_ret_check = " < 0";
+ $single_ret_as_list = 1;
+ $single_ret_list_name = $1;
+ $single_ret_list_max_var = "max$1";
+ $single_ret_list_max_define = $2;
+
+ my $conn = shift(@args_list);
+ unshift(@args_list, "ret->$1.$1_val");
+ unshift(@args_list, $conn);
} elsif ($ret_member =~ m/int (\S+);/) {
push(@vars_list, "int $1");
push(@ret_list, "ret->$1 = $1;");
@@ -586,6 +614,31 @@ elsif ($opt_b) {
$single_ret_by_ref = 0;
$single_ret_check = " < 0";
}
+ } elsif ($ret_member =~ m/hyper (\S+)<(\S+)>;/) {
+ push(@vars_list, "int len");
+ push(@ret_list, "ret->$1.$1_len = len;");
+ push(@free_list,
+ " if (rv < 0)\n" .
+ " VIR_FREE(ret->$1.$1_val);");
+ $single_ret_var = "len";
+ $single_ret_by_ref = 0;
+ $single_ret_as_list = 1;
+ $single_ret_list_name = $1;
+ $single_ret_list_max_define = $2;
+
+ my $conn = shift(@args_list);
+
+ if ($calls{$_}->{ProcName} eq "NodeGetCellsFreeMemory")
{
+ $single_ret_check = " <= 0";
+ $single_ret_list_max_var = "maxCells";
+ unshift(@args_list, "(unsigned long long
*)ret->$1.$1_val");
+ } else {
+ $single_ret_check = " < 0";
+ $single_ret_list_max_var = "max$1";
+ unshift(@args_list, "ret->$1.$1_val");
+ }
+
+ unshift(@args_list, $conn);
} elsif ($ret_member =~ m/hyper (\S+);/) {
push(@vars_list, "unsigned long $1");
push(@ret_list, "ret->$1 = $1;");
@@ -613,6 +666,15 @@ elsif ($opt_b) {
print " }\n";
print "\n";
+ if ($single_ret_as_list) {
+ print " if (args->$single_ret_list_max_var >
$single_ret_list_max_define) {\n";
+ print " virNetError(VIR_ERR_INTERNAL_ERROR,\n";
+ print " \"%s\",
_(\"max$single_ret_list_name > $single_ret_list_max_define\"));\n";
+ print " goto cleanup;\n";
+ print " }\n";
+ print "\n";
+ }
+
print join("\n", @getters_list);
if (@getters_list) {
@@ -649,7 +711,8 @@ elsif ($opt_b) {
$calls{$_}->{ProcName} eq "GetMaxVcpus" or
$calls{$_}->{ProcName} eq "DomainXMLFromNative" or
$calls{$_}->{ProcName} eq "DomainXMLToNative" or
- $calls{$_}->{ProcName} eq "FindStoragePoolSources") {
+ $calls{$_}->{ProcName} eq "FindStoragePoolSources" or
+ $calls{$_}->{ProcName} =~ m/^List/) {
$prefix = "Connect"
} elsif ($calls{$_}->{ProcName} eq "SupportsFeature") {
$prefix = "Drv"
@@ -669,6 +732,16 @@ elsif ($opt_b) {
$proc_name = "DomainGetOSType"
}
+ if ($single_ret_as_list) {
+ print " /* Allocate return buffer. */\n";
+ print " if
(VIR_ALLOC_N(ret->$single_ret_list_name.${single_ret_list_name}_val," .
+ " args->$single_ret_list_max_var) < 0) {\n";
+ print " virReportOOMError();\n";
+ print " goto cleanup;\n";
+ print " }\n";
+ print "\n";
+ }
+
if ($single_ret_by_ref) {
print " if (vir$prefix$proc_name(";
print join(', ', @args_list);
--
1.7.0.4