Since gendisplatch can now generate "modern" *ListAll* functions, let them all be generated. Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- daemon/remote.c | 599 --------------------------------------- src/remote/remote_driver.c | 654 ------------------------------------------- src/remote/remote_protocol.x | 40 +-- 3 files changed, 20 insertions(+), 1273 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index f5ca2acc98e2..2bf9e8392252 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1512,64 +1512,6 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server ATTRIBUTE_UNUS } static int -remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_domains_args *args, - remote_connect_list_all_domains_ret *ret) -{ - virDomainPtr *doms = NULL; - int ndomains = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((ndomains = virConnectListAllDomains(priv->conn, - args->need_results ? &doms : NULL, - args->flags)) < 0) - goto cleanup; - - if (ndomains > REMOTE_DOMAIN_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domains '%d' for limit '%d'"), - ndomains, REMOTE_DOMAIN_LIST_MAX); - goto cleanup; - } - - if (doms && ndomains) { - if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0) - goto cleanup; - - ret->domains.domains_len = ndomains; - - for (i = 0; i < ndomains; i++) - make_nonnull_domain(ret->domains.domains_val + i, doms[i]); - } else { - ret->domains.domains_len = 0; - ret->domains.domains_val = NULL; - } - - ret->ret = ndomains; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (doms && ndomains > 0) - for (i = 0; i < ndomains; i++) - virObjectUnref(doms[i]); - VIR_FREE(doms); - return rv; -} - -static int remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientPtr client ATTRIBUTE_UNUSED, virNetMessagePtr msg ATTRIBUTE_UNUSED, @@ -4564,547 +4506,6 @@ remoteDispatchDomainGetDiskErrors(virNetServerPtr server ATTRIBUTE_UNUSED, return rv; } -static int -remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_domain_list_all_snapshots_args *args, - remote_domain_list_all_snapshots_ret *ret) -{ - virDomainSnapshotPtr *snaps = NULL; - int nsnaps = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - virDomainPtr dom = NULL; - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if (!(dom = get_nonnull_domain(priv->conn, args->dom))) - goto cleanup; - - if ((nsnaps = virDomainListAllSnapshots(dom, - args->need_results ? &snaps : NULL, - args->flags)) < 0) - goto cleanup; - - if (nsnaps > REMOTE_DOMAIN_SNAPSHOT_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domain snapshots '%d' for limit '%d'"), - nsnaps, REMOTE_DOMAIN_SNAPSHOT_LIST_MAX); - goto cleanup; - } - - if (snaps && nsnaps) { - if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) - goto cleanup; - - ret->snapshots.snapshots_len = nsnaps; - - for (i = 0; i < nsnaps; i++) - make_nonnull_domain_snapshot(ret->snapshots.snapshots_val + i, - snaps[i]); - } else { - ret->snapshots.snapshots_len = 0; - ret->snapshots.snapshots_val = NULL; - } - - ret->ret = nsnaps; - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - virObjectUnref(dom); - if (snaps && nsnaps > 0) - for (i = 0; i < nsnaps; i++) - virObjectUnref(snaps[i]); - VIR_FREE(snaps); - return rv; -} - -static int -remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_domain_snapshot_list_all_children_args *args, - remote_domain_snapshot_list_all_children_ret *ret) -{ - virDomainSnapshotPtr *snaps = NULL; - int nsnaps = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - virDomainPtr dom = NULL; - virDomainSnapshotPtr snapshot = NULL; - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if (!(dom = get_nonnull_domain(priv->conn, args->snapshot.dom))) - goto cleanup; - - if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snapshot))) - goto cleanup; - - if ((nsnaps = virDomainSnapshotListAllChildren(snapshot, - args->need_results ? &snaps : NULL, - args->flags)) < 0) - goto cleanup; - - if (nsnaps > REMOTE_DOMAIN_SNAPSHOT_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domain snapshots '%d' for limit '%d'"), - nsnaps, REMOTE_DOMAIN_SNAPSHOT_LIST_MAX); - goto cleanup; - } - - if (snaps && nsnaps) { - if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) - goto cleanup; - - ret->snapshots.snapshots_len = nsnaps; - - for (i = 0; i < nsnaps; i++) - make_nonnull_domain_snapshot(ret->snapshots.snapshots_val + i, - snaps[i]); - } else { - ret->snapshots.snapshots_len = 0; - ret->snapshots.snapshots_val = NULL; - } - - ret->ret = nsnaps; - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - virObjectUnref(snapshot); - virObjectUnref(dom); - if (snaps && nsnaps > 0) - for (i = 0; i < nsnaps; i++) - virObjectUnref(snaps[i]); - VIR_FREE(snaps); - return rv; -} - -static int -remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_storage_pools_args *args, - remote_connect_list_all_storage_pools_ret *ret) -{ - virStoragePoolPtr *pools = NULL; - int npools = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((npools = virConnectListAllStoragePools(priv->conn, - args->need_results ? &pools : NULL, - args->flags)) < 0) - goto cleanup; - - if (npools > REMOTE_STORAGE_POOL_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many storage pools '%d' for limit '%d'"), - npools, REMOTE_STORAGE_POOL_LIST_MAX); - goto cleanup; - } - - if (pools && npools) { - if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0) - goto cleanup; - - ret->pools.pools_len = npools; - - for (i = 0; i < npools; i++) - make_nonnull_storage_pool(ret->pools.pools_val + i, pools[i]); - } else { - ret->pools.pools_len = 0; - ret->pools.pools_val = NULL; - } - - ret->ret = npools; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (pools && npools > 0) - for (i = 0; i < npools; i++) - virObjectUnref(pools[i]); - VIR_FREE(pools); - return rv; -} - -static int -remoteDispatchStoragePoolListAllVolumes(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_storage_pool_list_all_volumes_args *args, - remote_storage_pool_list_all_volumes_ret *ret) -{ - virStorageVolPtr *vols = NULL; - virStoragePoolPtr pool = NULL; - int nvols = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if (!(pool = get_nonnull_storage_pool(priv->conn, args->pool))) - goto cleanup; - - if ((nvols = virStoragePoolListAllVolumes(pool, - args->need_results ? &vols : NULL, - args->flags)) < 0) - goto cleanup; - - if (nvols > REMOTE_STORAGE_VOL_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many storage volumes '%d' for limit '%d'"), - nvols, REMOTE_STORAGE_VOL_LIST_MAX); - goto cleanup; - } - - if (vols && nvols) { - if (VIR_ALLOC_N(ret->vols.vols_val, nvols) < 0) - goto cleanup; - - ret->vols.vols_len = nvols; - - for (i = 0; i < nvols; i++) - make_nonnull_storage_vol(ret->vols.vols_val + i, vols[i]); - } else { - ret->vols.vols_len = 0; - ret->vols.vols_val = NULL; - } - - ret->ret = nvols; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (vols && nvols > 0) - for (i = 0; i < nvols; i++) - virObjectUnref(vols[i]); - VIR_FREE(vols); - virObjectUnref(pool); - return rv; -} - -static int -remoteDispatchConnectListAllNetworks(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_networks_args *args, - remote_connect_list_all_networks_ret *ret) -{ - virNetworkPtr *nets = NULL; - int nnets = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((nnets = virConnectListAllNetworks(priv->conn, - args->need_results ? &nets : NULL, - args->flags)) < 0) - goto cleanup; - - if (nnets > REMOTE_NETWORK_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many networks '%d' for limit '%d'"), - nnets, REMOTE_NETWORK_LIST_MAX); - goto cleanup; - } - - if (nets && nnets) { - if (VIR_ALLOC_N(ret->nets.nets_val, nnets) < 0) - goto cleanup; - - ret->nets.nets_len = nnets; - - for (i = 0; i < nnets; i++) - make_nonnull_network(ret->nets.nets_val + i, nets[i]); - } else { - ret->nets.nets_len = 0; - ret->nets.nets_val = NULL; - } - - ret->ret = nnets; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (nets && nnets > 0) - for (i = 0; i < nnets; i++) - virObjectUnref(nets[i]); - VIR_FREE(nets); - return rv; -} - -static int -remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_interfaces_args *args, - remote_connect_list_all_interfaces_ret *ret) -{ - virInterfacePtr *ifaces = NULL; - int nifaces = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((nifaces = virConnectListAllInterfaces(priv->conn, - args->need_results ? &ifaces : NULL, - args->flags)) < 0) - goto cleanup; - - if (nifaces > REMOTE_INTERFACE_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many interfaces '%d' for limit '%d'"), - nifaces, REMOTE_INTERFACE_LIST_MAX); - goto cleanup; - } - - if (ifaces && nifaces) { - if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0) - goto cleanup; - - ret->ifaces.ifaces_len = nifaces; - - for (i = 0; i < nifaces; i++) - make_nonnull_interface(ret->ifaces.ifaces_val + i, ifaces[i]); - } else { - ret->ifaces.ifaces_len = 0; - ret->ifaces.ifaces_val = NULL; - } - - ret->ret = nifaces; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (ifaces && nifaces > 0) - for (i = 0; i < nifaces; i++) - virObjectUnref(ifaces[i]); - VIR_FREE(ifaces); - return rv; -} - -static int -remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_node_devices_args *args, - remote_connect_list_all_node_devices_ret *ret) -{ - virNodeDevicePtr *devices = NULL; - int ndevices = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((ndevices = virConnectListAllNodeDevices(priv->conn, - args->need_results ? &devices : NULL, - args->flags)) < 0) - goto cleanup; - - if (ndevices > REMOTE_NODE_DEVICE_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many node devices '%d' for limit '%d'"), - ndevices, REMOTE_NODE_DEVICE_LIST_MAX); - goto cleanup; - } - - if (devices && ndevices) { - if (VIR_ALLOC_N(ret->devices.devices_val, ndevices) < 0) - goto cleanup; - - ret->devices.devices_len = ndevices; - - for (i = 0; i < ndevices; i++) - make_nonnull_node_device(ret->devices.devices_val + i, devices[i]); - } else { - ret->devices.devices_len = 0; - ret->devices.devices_val = NULL; - } - - ret->ret = ndevices; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (devices && ndevices > 0) - for (i = 0; i < ndevices; i++) - virObjectUnref(devices[i]); - VIR_FREE(devices); - return rv; -} - -static int -remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_nwfilters_args *args, - remote_connect_list_all_nwfilters_ret *ret) -{ - virNWFilterPtr *filters = NULL; - int nfilters = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((nfilters = virConnectListAllNWFilters(priv->conn, - args->need_results ? &filters : NULL, - args->flags)) < 0) - goto cleanup; - - if (nfilters > REMOTE_NWFILTER_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many network filters '%d' for limit '%d'"), - nfilters, REMOTE_NWFILTER_LIST_MAX); - goto cleanup; - } - - if (filters && nfilters) { - if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0) - goto cleanup; - - ret->filters.filters_len = nfilters; - - for (i = 0; i < nfilters; i++) - make_nonnull_nwfilter(ret->filters.filters_val + i, filters[i]); - } else { - ret->filters.filters_len = 0; - ret->filters.filters_val = NULL; - } - - ret->ret = nfilters; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (filters && nfilters > 0) - for (i = 0; i < nfilters; i++) - virObjectUnref(filters[i]); - VIR_FREE(filters); - return rv; -} - -static int -remoteDispatchConnectListAllSecrets(virNetServerPtr server ATTRIBUTE_UNUSED, - virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UNUSED, - virNetMessageErrorPtr rerr, - remote_connect_list_all_secrets_args *args, - remote_connect_list_all_secrets_ret *ret) -{ - virSecretPtr *secrets = NULL; - int nsecrets = 0; - size_t i; - int rv = -1; - struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); - - if (!priv->conn) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((nsecrets = virConnectListAllSecrets(priv->conn, - args->need_results ? &secrets : NULL, - args->flags)) < 0) - goto cleanup; - - if (nsecrets > REMOTE_SECRET_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many secrets '%d' for limit '%d'"), - nsecrets, REMOTE_SECRET_LIST_MAX); - goto cleanup; - } - - if (secrets && nsecrets) { - if (VIR_ALLOC_N(ret->secrets.secrets_val, nsecrets) < 0) - goto cleanup; - - ret->secrets.secrets_len = nsecrets; - - for (i = 0; i < nsecrets; i++) - make_nonnull_secret(ret->secrets.secrets_val + i, secrets[i]); - } else { - ret->secrets.secrets_len = 0; - ret->secrets.secrets_val = NULL; - } - - ret->ret = nsecrets; - - rv = 0; - - cleanup: - if (rv < 0) - virNetMessageSaveError(rerr); - if (secrets && nsecrets > 0) - for (i = 0; i < nsecrets; i++) - virObjectUnref(secrets[i]); - VIR_FREE(secrets); - return rv; -} static int remoteDispatchNodeGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 2daa50786d22..d342227d4675 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1627,71 +1627,6 @@ remoteConnectListDomains(virConnectPtr conn, int *ids, int maxids) } static int -remoteConnectListAllDomains(virConnectPtr conn, - virDomainPtr **domains, - unsigned int flags) -{ - int rv = -1; - size_t i; - virDomainPtr *doms = NULL; - remote_connect_list_all_domains_args args; - remote_connect_list_all_domains_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!domains; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS, - (xdrproc_t) xdr_remote_connect_list_all_domains_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_domains_ret, - (char *) &ret) == -1) - goto done; - - if (ret.domains.domains_len > REMOTE_DOMAIN_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domains '%d' for limit '%d'"), - ret.domains.domains_len, REMOTE_DOMAIN_LIST_MAX); - goto cleanup; - } - - if (domains) { - if (VIR_ALLOC_N(doms, ret.domains.domains_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.domains.domains_len; i++) { - doms[i] = get_nonnull_domain(conn, ret.domains.domains_val[i]); - if (!doms[i]) - goto cleanup; - } - *domains = doms; - doms = NULL; - } - - rv = ret.ret; - - cleanup: - if (doms) { - for (i = 0; i < ret.domains.domains_len; i++) - virObjectUnref(doms[i]); - VIR_FREE(doms); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_domains_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val, u_int ret_errors_len, int limit, @@ -2945,71 +2880,6 @@ static int remoteDomainGetCPUStats(virDomainPtr domain, return rv; } -static int -remoteConnectListAllNetworks(virConnectPtr conn, - virNetworkPtr **nets, - unsigned int flags) -{ - int rv = -1; - size_t i; - virNetworkPtr *tmp_nets = NULL; - remote_connect_list_all_networks_args args; - remote_connect_list_all_networks_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!nets; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS, - (xdrproc_t) xdr_remote_connect_list_all_networks_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_networks_ret, - (char *) &ret) == -1) - goto done; - - if (ret.nets.nets_len > REMOTE_NETWORK_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many networks '%d' for limit '%d'"), - ret.nets.nets_len, REMOTE_NETWORK_LIST_MAX); - goto cleanup; - } - - if (nets) { - if (VIR_ALLOC_N(tmp_nets, ret.nets.nets_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.nets.nets_len; i++) { - tmp_nets[i] = get_nonnull_network(conn, ret.nets.nets_val[i]); - if (!tmp_nets[i]) - goto cleanup; - } - *nets = tmp_nets; - tmp_nets = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_nets) { - for (i = 0; i < ret.nets.nets_len; i++) - virObjectUnref(tmp_nets[i]); - VIR_FREE(tmp_nets); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_networks_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - static int remoteConnectNetworkEventRegisterAny(virConnectPtr conn, @@ -3202,267 +3072,6 @@ remoteConnectDomainQemuMonitorEventDeregister(virConnectPtr conn, return rv; } - -static int -remoteConnectListAllInterfaces(virConnectPtr conn, - virInterfacePtr **ifaces, - unsigned int flags) -{ - int rv = -1; - size_t i; - virInterfacePtr *tmp_ifaces = NULL; - remote_connect_list_all_interfaces_args args; - remote_connect_list_all_interfaces_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!ifaces; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES, - (xdrproc_t) xdr_remote_connect_list_all_interfaces_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_interfaces_ret, - (char *) &ret) == -1) - goto done; - - if (ret.ifaces.ifaces_len > REMOTE_INTERFACE_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many interfaces '%d' for limit '%d'"), - ret.ifaces.ifaces_len, REMOTE_INTERFACE_LIST_MAX); - goto cleanup; - } - - if (ifaces) { - if (VIR_ALLOC_N(tmp_ifaces, ret.ifaces.ifaces_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.ifaces.ifaces_len; i++) { - tmp_ifaces[i] = get_nonnull_interface(conn, ret.ifaces.ifaces_val[i]); - if (!tmp_ifaces[i]) - goto cleanup; - } - *ifaces = tmp_ifaces; - tmp_ifaces = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_ifaces) { - for (i = 0; i < ret.ifaces.ifaces_len; i++) - virObjectUnref(tmp_ifaces[i]); - } - VIR_FREE(tmp_ifaces); - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_interfaces_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int -remoteConnectListAllNodeDevices(virConnectPtr conn, - virNodeDevicePtr **devices, - unsigned int flags) -{ - int rv = -1; - size_t i; - virNodeDevicePtr *tmp_devices = NULL; - remote_connect_list_all_node_devices_args args; - remote_connect_list_all_node_devices_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!devices; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES, - (xdrproc_t) xdr_remote_connect_list_all_node_devices_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_node_devices_ret, - (char *) &ret) == -1) - goto done; - - if (ret.devices.devices_len > REMOTE_NODE_DEVICE_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many node devices '%d' for limit '%d'"), - ret.devices.devices_len, REMOTE_NODE_DEVICE_LIST_MAX); - goto cleanup; - } - - if (devices) { - if (VIR_ALLOC_N(tmp_devices, ret.devices.devices_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.devices.devices_len; i++) { - tmp_devices[i] = get_nonnull_node_device(conn, ret.devices.devices_val[i]); - if (!tmp_devices[i]) - goto cleanup; - } - *devices = tmp_devices; - tmp_devices = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_devices) { - for (i = 0; i < ret.devices.devices_len; i++) - virObjectUnref(tmp_devices[i]); - VIR_FREE(tmp_devices); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_node_devices_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int -remoteConnectListAllNWFilters(virConnectPtr conn, - virNWFilterPtr **filters, - unsigned int flags) -{ - int rv = -1; - size_t i; - virNWFilterPtr *tmp_filters = NULL; - remote_connect_list_all_nwfilters_args args; - remote_connect_list_all_nwfilters_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!filters; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS, - (xdrproc_t) xdr_remote_connect_list_all_nwfilters_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_nwfilters_ret, - (char *) &ret) == -1) - goto done; - - if (ret.filters.filters_len > REMOTE_NWFILTER_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many network filters '%d' for limit '%d'"), - ret.filters.filters_len, REMOTE_NWFILTER_LIST_MAX); - goto cleanup; - } - - if (filters) { - if (VIR_ALLOC_N(tmp_filters, ret.filters.filters_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.filters.filters_len; i++) { - tmp_filters[i] = get_nonnull_nwfilter(conn, ret.filters.filters_val[i]); - if (!tmp_filters[i]) - goto cleanup; - } - *filters = tmp_filters; - tmp_filters = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_filters) { - for (i = 0; i < ret.filters.filters_len; i++) - virObjectUnref(tmp_filters[i]); - VIR_FREE(tmp_filters); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_nwfilters_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int -remoteConnectListAllSecrets(virConnectPtr conn, - virSecretPtr **secrets, - unsigned int flags) -{ - int rv = -1; - size_t i; - virSecretPtr *tmp_secrets = NULL; - remote_connect_list_all_secrets_args args; - remote_connect_list_all_secrets_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!secrets; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_SECRETS, - (xdrproc_t) xdr_remote_connect_list_all_secrets_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_secrets_ret, - (char *) &ret) == -1) - goto done; - - if (ret.secrets.secrets_len > REMOTE_SECRET_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many secrets '%d' for limit '%d'"), - ret.secrets.secrets_len, REMOTE_SECRET_LIST_MAX); - goto cleanup; - } - - if (secrets) { - if (VIR_ALLOC_N(tmp_secrets, ret.secrets.secrets_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.secrets.secrets_len; i++) { - tmp_secrets[i] = get_nonnull_secret(conn, ret.secrets.secrets_val[i]); - if (!tmp_secrets[i]) - goto cleanup; - } - *secrets = tmp_secrets; - tmp_secrets = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_secrets) { - for (i = 0; i < ret.secrets.secrets_len; i++) - virObjectUnref(tmp_secrets[i]); - VIR_FREE(tmp_secrets); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_secrets_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - /*----------------------------------------------------------------------*/ static char * @@ -3498,138 +3107,6 @@ remoteConnectFindStoragePoolSources(virConnectPtr conn, return rv; } -static int -remoteConnectListAllStoragePools(virConnectPtr conn, - virStoragePoolPtr **pools, - unsigned int flags) -{ - int rv = -1; - size_t i; - virStoragePoolPtr *tmp_pools = NULL; - remote_connect_list_all_storage_pools_args args; - remote_connect_list_all_storage_pools_ret ret; - - struct private_data *priv = conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!pools; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(conn, - priv, - 0, - REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS, - (xdrproc_t) xdr_remote_connect_list_all_storage_pools_args, - (char *) &args, - (xdrproc_t) xdr_remote_connect_list_all_storage_pools_ret, - (char *) &ret) == -1) - goto done; - - if (ret.pools.pools_len > REMOTE_STORAGE_POOL_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many storage pools '%d' for limit '%d'"), - ret.pools.pools_len, REMOTE_STORAGE_POOL_LIST_MAX); - goto cleanup; - } - - if (pools) { - if (VIR_ALLOC_N(tmp_pools, ret.pools.pools_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.pools.pools_len; i++) { - tmp_pools[i] = get_nonnull_storage_pool(conn, ret.pools.pools_val[i]); - if (!tmp_pools[i]) - goto cleanup; - } - *pools = tmp_pools; - tmp_pools = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_pools) { - for (i = 0; i < ret.pools.pools_len; i++) - virObjectUnref(tmp_pools[i]); - VIR_FREE(tmp_pools); - } - - xdr_free((xdrproc_t) xdr_remote_connect_list_all_storage_pools_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int -remoteStoragePoolListAllVolumes(virStoragePoolPtr pool, - virStorageVolPtr **vols, - unsigned int flags) -{ - int rv = -1; - size_t i; - virStorageVolPtr *tmp_vols = NULL; - remote_storage_pool_list_all_volumes_args args; - remote_storage_pool_list_all_volumes_ret ret; - - struct private_data *priv = pool->conn->privateData; - - remoteDriverLock(priv); - - make_nonnull_storage_pool(&args.pool, pool); - args.need_results = !!vols; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(pool->conn, - priv, - 0, - REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES, - (xdrproc_t) xdr_remote_storage_pool_list_all_volumes_args, - (char *) &args, - (xdrproc_t) xdr_remote_storage_pool_list_all_volumes_ret, - (char *) &ret) == -1) - goto done; - - if (ret.vols.vols_len > REMOTE_STORAGE_VOL_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many storage volumes '%d' for limit '%d'"), - ret.vols.vols_len, REMOTE_STORAGE_VOL_LIST_MAX); - goto cleanup; - } - - if (vols) { - if (VIR_ALLOC_N(tmp_vols, ret.vols.vols_len + 1) < 0) - goto cleanup; - - for (i = 0; i < ret.vols.vols_len; i++) { - tmp_vols[i] = get_nonnull_storage_vol(pool->conn, ret.vols.vols_val[i]); - if (!tmp_vols[i]) - goto cleanup; - } - *vols = tmp_vols; - tmp_vols = NULL; - } - - rv = ret.ret; - - cleanup: - if (tmp_vols) { - for (i = 0; i < ret.vols.vols_len; i++) - virObjectUnref(tmp_vols[i]); - VIR_FREE(tmp_vols); - } - - xdr_free((xdrproc_t) xdr_remote_storage_pool_list_all_volumes_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - - /*----------------------------------------------------------------------*/ static int @@ -6616,137 +6093,6 @@ remoteDomainGetInterfaceParameters(virDomainPtr domain, return rv; } -static int -remoteDomainListAllSnapshots(virDomainPtr dom, - virDomainSnapshotPtr **snapshots, - unsigned int flags) -{ - int rv = -1; - size_t i; - virDomainSnapshotPtr *snaps = NULL; - remote_domain_list_all_snapshots_args args; - remote_domain_list_all_snapshots_ret ret; - - struct private_data *priv = dom->conn->privateData; - - remoteDriverLock(priv); - - make_nonnull_domain(&args.dom, dom); - args.need_results = !!snapshots; - args.flags = flags; - - memset(&ret, 0, sizeof(ret)); - if (call(dom->conn, - priv, - 0, - REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS, - (xdrproc_t) xdr_remote_domain_list_all_snapshots_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_list_all_snapshots_ret, - (char *) &ret) == -1) - goto done; - - if (ret.snapshots.snapshots_len > REMOTE_DOMAIN_SNAPSHOT_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domain snapshots '%d' for limit '%d'"), - ret.snapshots.snapshots_len, - REMOTE_DOMAIN_SNAPSHOT_LIST_MAX); - goto cleanup; - } - - if (snapshots) { - if (VIR_ALLOC_N(snaps, ret.snapshots.snapshots_len + 1) < 0) - goto cleanup; - for (i = 0; i < ret.snapshots.snapshots_len; i++) { - snaps[i] = get_nonnull_domain_snapshot(dom, ret.snapshots.snapshots_val[i]); - if (!snaps[i]) - goto cleanup; - } - *snapshots = snaps; - snaps = NULL; - } - - rv = ret.ret; - - cleanup: - if (snaps) { - for (i = 0; i < ret.snapshots.snapshots_len; i++) - virObjectUnref(snaps[i]); - VIR_FREE(snaps); - } - - xdr_free((xdrproc_t) xdr_remote_domain_list_all_snapshots_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} - -static int -remoteDomainSnapshotListAllChildren(virDomainSnapshotPtr parent, - virDomainSnapshotPtr **snapshots, - unsigned int flags) -{ - int rv = -1; - size_t i; - virDomainSnapshotPtr *snaps = NULL; - remote_domain_snapshot_list_all_children_args args; - remote_domain_snapshot_list_all_children_ret ret; - - struct private_data *priv = parent->domain->conn->privateData; - - remoteDriverLock(priv); - - args.need_results = !!snapshots; - args.flags = flags; - make_nonnull_domain_snapshot(&args.snapshot, parent); - - memset(&ret, 0, sizeof(ret)); - if (call(parent->domain->conn, - priv, - 0, - REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN, - (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_ret, - (char *) &ret) == -1) - goto done; - - if (ret.snapshots.snapshots_len > REMOTE_DOMAIN_SNAPSHOT_LIST_MAX) { - virReportError(VIR_ERR_RPC, - _("Too many domain snapshots '%d' for limit '%d'"), - ret.snapshots.snapshots_len, - REMOTE_DOMAIN_SNAPSHOT_LIST_MAX); - goto cleanup; - } - - if (snapshots) { - if (VIR_ALLOC_N(snaps, ret.snapshots.snapshots_len + 1) < 0) - goto cleanup; - for (i = 0; i < ret.snapshots.snapshots_len; i++) { - snaps[i] = get_nonnull_domain_snapshot(parent->domain, ret.snapshots.snapshots_val[i]); - if (!snaps[i]) - goto cleanup; - } - *snapshots = snaps; - snaps = NULL; - } - - rv = ret.ret; - - cleanup: - if (snaps) { - for (i = 0; i < ret.snapshots.snapshots_len; i++) - virObjectUnref(snaps[i]); - VIR_FREE(snaps); - } - - xdr_free((xdrproc_t) xdr_remote_domain_snapshot_list_all_children_ret, (char *) &ret); - - done: - remoteDriverUnlock(priv); - return rv; -} static int remoteNodeGetMemoryParameters(virConnectPtr conn, diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 952686c5a61b..b4cb8f110967 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -2553,7 +2553,7 @@ struct remote_domain_list_all_snapshots_args { unsigned int flags; }; -struct remote_domain_list_all_snapshots_ret { +struct remote_domain_list_all_snapshots_ret { /* insert@1 */ remote_nonnull_domain_snapshot snapshots<REMOTE_DOMAIN_SNAPSHOT_LIST_MAX>; int ret; }; @@ -2583,7 +2583,7 @@ struct remote_domain_snapshot_list_all_children_args { unsigned int flags; }; -struct remote_domain_snapshot_list_all_children_ret { +struct remote_domain_snapshot_list_all_children_ret { /* insert@1 */ remote_nonnull_domain_snapshot snapshots<REMOTE_DOMAIN_SNAPSHOT_LIST_MAX>; int ret; }; @@ -2822,7 +2822,7 @@ struct remote_connect_list_all_domains_args { unsigned int flags; }; -struct remote_connect_list_all_domains_ret { +struct remote_connect_list_all_domains_ret { /* insert@1 */ remote_nonnull_domain domains<REMOTE_DOMAIN_LIST_MAX>; unsigned int ret; }; @@ -2832,7 +2832,7 @@ struct remote_connect_list_all_storage_pools_args { unsigned int flags; }; -struct remote_connect_list_all_storage_pools_ret { +struct remote_connect_list_all_storage_pools_ret { /* insert@1 */ remote_nonnull_storage_pool pools<REMOTE_STORAGE_POOL_LIST_MAX>; unsigned int ret; }; @@ -2843,7 +2843,7 @@ struct remote_storage_pool_list_all_volumes_args { unsigned int flags; }; -struct remote_storage_pool_list_all_volumes_ret { +struct remote_storage_pool_list_all_volumes_ret { /* insert@1 */ remote_nonnull_storage_vol vols<REMOTE_STORAGE_VOL_LIST_MAX>; unsigned int ret; }; @@ -2853,7 +2853,7 @@ struct remote_connect_list_all_networks_args { unsigned int flags; }; -struct remote_connect_list_all_networks_ret { +struct remote_connect_list_all_networks_ret { /* insert@1 */ remote_nonnull_network nets<REMOTE_NETWORK_LIST_MAX>; unsigned int ret; }; @@ -2863,7 +2863,7 @@ struct remote_connect_list_all_interfaces_args { unsigned int flags; }; -struct remote_connect_list_all_interfaces_ret { +struct remote_connect_list_all_interfaces_ret { /* insert@1 */ remote_nonnull_interface ifaces<REMOTE_INTERFACE_LIST_MAX>; unsigned int ret; }; @@ -2873,7 +2873,7 @@ struct remote_connect_list_all_node_devices_args { unsigned int flags; }; -struct remote_connect_list_all_node_devices_ret { +struct remote_connect_list_all_node_devices_ret { /* insert@1 */ remote_nonnull_node_device devices<REMOTE_NODE_DEVICE_LIST_MAX>; unsigned int ret; }; @@ -2883,7 +2883,7 @@ struct remote_connect_list_all_nwfilters_args { unsigned int flags; }; -struct remote_connect_list_all_nwfilters_ret { +struct remote_connect_list_all_nwfilters_ret { /* insert@1 */ remote_nonnull_nwfilter filters<REMOTE_NWFILTER_LIST_MAX>; unsigned int ret; }; @@ -2893,7 +2893,7 @@ struct remote_connect_list_all_secrets_args { unsigned int flags; }; -struct remote_connect_list_all_secrets_ret { +struct remote_connect_list_all_secrets_ret { /* insert@1 */ remote_nonnull_secret secrets<REMOTE_SECRET_LIST_MAX>; unsigned int ret; }; @@ -5147,7 +5147,7 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA = 272, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_domains * @aclfilter: domain:getattr @@ -5155,14 +5155,14 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS = 273, /** - * @generate: none + * @generate: both * @priority: high * @acl: domain:read */ REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS = 274, /** - * @generate: none + * @generate: both * @priority: high * @acl: domain:read */ @@ -5202,7 +5202,7 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO = 280, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_storage_pools * @aclfilter: storage_pool:getattr @@ -5210,7 +5210,7 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS = 281, /** - * @generate: none + * @generate: both * @priority: high * @acl: storage_pool:search_storage_vols * @aclfilter: storage_vol:getattr @@ -5218,7 +5218,7 @@ enum remote_procedure { REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES = 282, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_networks * @aclfilter: network:getattr @@ -5226,7 +5226,7 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS = 283, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_interfaces * @aclfilter: interface:getattr @@ -5234,7 +5234,7 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES = 284, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_node_devices * @aclfilter: node_device:getattr @@ -5242,7 +5242,7 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES = 285, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_nwfilters * @aclfilter: nwfilter:getattr @@ -5250,7 +5250,7 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS = 286, /** - * @generate: none + * @generate: both * @priority: high * @acl: connect:search_secrets * @aclfilter: secret:getattr -- 2.7.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list