mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
remote generator, daemon: Handle functions that return lists
This commit is contained in:
parent
705519d8e9
commit
33148050e7
701
daemon/remote.c
701
daemon/remote.c
@ -530,53 +530,6 @@ cleanup:
|
||||
return rv;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1427,51 +1380,6 @@ cleanup:
|
||||
return rv;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1948,233 +1856,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
|
||||
@ -2979,97 +2660,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,
|
||||
@ -3109,58 +2699,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
|
||||
***************************************************************/
|
||||
@ -3207,52 +2745,6 @@ cleanup:
|
||||
* NODE INFO APIS
|
||||
**************************************************************/
|
||||
|
||||
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,
|
||||
@ -3303,57 +2795,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,
|
||||
@ -3585,50 +3026,6 @@ cleanup:
|
||||
VIR_FREE(msg);
|
||||
}
|
||||
|
||||
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,
|
||||
@ -3778,59 +3175,6 @@ cleanup:
|
||||
return rv;
|
||||
}
|
||||
|
||||
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,
|
||||
@ -3917,51 +3261,6 @@ cleanup:
|
||||
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;
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -1704,7 +1704,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(
|
||||
@ -2490,25 +2538,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;
|
||||
|
||||
/* remoteDispatchListDefinedInterfaces has to be implemented manually */
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* remoteDispatchListDefinedNetworks has to be implemented manually */
|
||||
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* remoteDispatchListDefinedStoragePools has to be implemented manually */
|
||||
/* Allocate return buffer. */
|
||||
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* remoteDispatchListDomains has to be implemented manually */
|
||||
if ((len = virConnectListDefinedDomains(conn, ret->names.names_val, args->maxnames)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* remoteDispatchListInterfaces has to be implemented manually */
|
||||
ret->names.names_len = len;
|
||||
rv = 0;
|
||||
|
||||
/* remoteDispatchListNetworks has to be implemented manually */
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
if (rv < 0)
|
||||
VIR_FREE(ret->names.names_val);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* remoteDispatchListNWFilters has to be implemented manually */
|
||||
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;
|
||||
|
||||
/* remoteDispatchListSecrets has to be implemented manually */
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* remoteDispatchListStoragePools has to be implemented manually */
|
||||
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;
|
||||
}
|
||||
|
||||
if ((len = virConnectListDomains(conn, ret->ids.ids_val, args->maxids)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret->ids.ids_len = len;
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
if (rv < 0)
|
||||
VIR_FREE(ret->ids.ids_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;
|
||||
}
|
||||
|
||||
if ((len = virConnectListInterfaces(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
|
||||
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(
|
||||
@ -3092,7 +3560,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(
|
||||
@ -3230,7 +3746,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(
|
||||
@ -3266,7 +3824,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(
|
||||
@ -4317,7 +4920,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(
|
||||
|
@ -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");
|
||||
@ -481,12 +466,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;");
|
||||
@ -574,6 +585,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;");
|
||||
@ -587,6 +615,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;");
|
||||
@ -614,6 +667,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) {
|
||||
@ -650,7 +712,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"
|
||||
@ -670,6 +733,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);
|
||||
|
Loading…
Reference in New Issue
Block a user