---
daemon/remote.c | 1616 ------------------------------------
daemon/remote_dispatch_bodies.c | 1724 +++++++++++++++++++++++++++++++++++++--
daemon/remote_generator.pl | 215 +++++-
3 files changed, 1880 insertions(+), 1675 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 5057cfc..a588a08 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -459,32 +459,6 @@ remoteDispatchClose(struct qemud_server *server ATTRIBUTE_UNUSED,
}
static int
-remoteDispatchSupportsFeature(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_supports_feature_args *args,
remote_supports_feature_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->supported = virDrvSupportsFeature(conn, args->feature)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchGetType(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -520,153 +494,6 @@ cleanup:
}
static int
-remoteDispatchGetVersion(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_get_version_ret *ret)
-{
- unsigned long hvVer;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (virConnectGetVersion(conn, &hvVer) < 0)
- goto cleanup;
-
- ret->hv_ver = hvVer;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchGetLibVersion(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_get_lib_version_ret *ret)
-{
- unsigned long libVer;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (virConnectGetLibVersion(conn, &libVer) < 0)
- goto cleanup;
-
- ret->lib_ver = libVer;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchGetHostname(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_get_hostname_ret *ret)
-{
- char *hostname;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(hostname = virConnectGetHostname(conn)))
- goto cleanup;
-
- ret->hostname = hostname;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchGetURI(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_get_uri_ret *ret)
-{
- char *uri;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(uri = virConnectGetURI(conn)))
- goto cleanup;
-
- ret->uri = uri;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchGetSysinfo(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_get_sysinfo_args *args,
- remote_get_sysinfo_ret *ret)
-{
- unsigned int flags;
- char *sysinfo;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- flags = args->flags;
- if (!(sysinfo = virConnectGetSysinfo(conn, flags)))
- goto cleanup;
-
- ret->sysinfo = sysinfo;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -733,35 +560,6 @@ cleanup:
}
static int
-remoteDispatchGetCapabilities(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_get_capabilities_ret *ret)
-{
- char *caps;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(caps = virConnectGetCapabilities(conn)))
- goto cleanup;
-
- ret->capabilities = caps;
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchNodeGetCellsFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1384,136 +1182,6 @@ cleanup:
}
static int
-remoteDispatchDomainDumpXML(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_dump_xml_args *args,
- remote_domain_dump_xml_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virDomainGetXMLDesc(dom, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
-remoteDispatchDomainXMLFromNative(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_xml_from_native_args *args,
- remote_domain_xml_from_native_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->domainXml = virConnectDomainXMLFromNative(conn,
- args->nativeFormat,
- args->nativeConfig,
- args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchDomainXMLToNative(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_xml_to_native_args *args,
- remote_domain_xml_to_native_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->nativeConfig = virConnectDomainXMLToNative(conn,
- args->nativeFormat,
- args->domainXml,
- args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-
-static int
-remoteDispatchDomainGetAutostart(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_get_autostart_args *args,
- remote_domain_get_autostart_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if (virDomainGetAutostart(dom, &ret->autostart) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1554,72 +1222,6 @@ cleanup:
}
static int
-remoteDispatchDomainGetMaxMemory(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_get_max_memory_args *args,
- remote_domain_get_max_memory_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->memory = virDomainGetMaxMemory(dom)) == 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
-remoteDispatchDomainGetMaxVcpus(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_get_max_vcpus_args *args,
- remote_domain_get_max_vcpus_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->num = virDomainGetMaxVcpus(dom)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1711,40 +1313,6 @@ cleanup:
}
static int
-remoteDispatchDomainGetOsType(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_get_os_type_args *args,
- remote_domain_get_os_type_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this */
- if (!(ret->type = virDomainGetOSType(dom)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -1828,39 +1396,6 @@ no_memory:
}
static int
-remoteDispatchDomainGetVcpusFlags(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_get_vcpus_flags_args *args,
- remote_domain_get_vcpus_flags_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->num = virDomainGetVcpusFlags(dom, args->flags)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainMigratePrepare(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -2267,33 +1802,6 @@ cleanup:
}
static int
-remoteDispatchNumOfDefinedDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_defined_domains_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfDefinedDomains(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -2856,39 +2364,6 @@ cleanup:
}
static int
-remoteDispatchDomainHasManagedSaveImage(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_has_managed_save_image_args *args,
- remote_domain_has_managed_save_image_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->result = virDomainHasManagedSaveImage(dom, args->flags)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchListNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -2998,107 +2473,6 @@ cleanup:
}
static int
-remoteDispatchNetworkDumpXML(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_network_dump_xml_args *args,
- remote_network_dump_xml_ret *ret)
-{
- virNetworkPtr net = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(net = get_nonnull_network(conn, args->net)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virNetworkGetXMLDesc(net, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (net)
- virNetworkFree(net);
- return rv;
-}
-
-static int
-remoteDispatchNetworkGetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_network_get_autostart_args *args,
- remote_network_get_autostart_ret *ret)
-{
- virNetworkPtr net = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(net = get_nonnull_network(conn, args->net)))
- goto cleanup;
-
- if (virNetworkGetAutostart(net, &ret->autostart) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (net)
- virNetworkFree(net);
- return rv;
-}
-
-static int
-remoteDispatchNetworkGetBridgeName(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_network_get_bridge_name_args *args,
- remote_network_get_bridge_name_ret *ret)
-{
- virNetworkPtr net = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(net = get_nonnull_network(conn, args->net)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->name = virNetworkGetBridgeName(net)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (net)
- virNetworkFree(net);
- return rv;
-}
-
-static int
remoteDispatchNetworkLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -3162,118 +2536,7 @@ cleanup:
return rv;
}
-static int
-remoteDispatchNumOfDefinedNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_defined_networks_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- len = virConnectNumOfDefinedNetworks(conn);
- if (len < 0)
- goto cleanup;
- ret->num = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchNumOfDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_domains_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfDomains(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchNumOfNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_networks_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfNetworks(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-
/*-------------------------------------------------------------*/
-static int
-remoteDispatchNumOfInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_interfaces_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfInterfaces(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
static int
remoteDispatchListInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
@@ -3321,36 +2584,6 @@ cleanup:
}
static int
-remoteDispatchNumOfDefinedInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_defined_interfaces_ret *ret)
-{
- int rv = -1;
- int len;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- len = virConnectNumOfDefinedInterfaces(conn);
- if (len < 0)
- goto cleanup;
- ret->num = len;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchListDefinedInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -3460,40 +2693,6 @@ cleanup:
}
static int
-remoteDispatchInterfaceGetXMLDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_interface_get_xml_desc_args *args,
- remote_interface_get_xml_desc_ret *ret)
-{
- virInterfacePtr iface = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(iface = get_nonnull_interface(conn, args->iface)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virInterfaceGetXMLDesc(iface, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (iface)
- virInterfaceFree(iface);
- return rv;
-}
-
-static int
remoteDispatchInterfaceDefineXML(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -4555,74 +3754,6 @@ cleanup:
}
static int
-remoteDispatchStoragePoolDumpXML(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_dump_xml_args *args,
- remote_storage_pool_dump_xml_ret *ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virStoragePoolGetXMLDesc(pool, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-static int
-remoteDispatchStoragePoolGetAutostart(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_get_autostart_args *args,
- remote_storage_pool_get_autostart_ret *ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- if (virStoragePoolGetAutostart(pool, &ret->autostart) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-
-static int
remoteDispatchStoragePoolLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -4725,60 +3856,6 @@ cleanup:
}
static int
-remoteDispatchNumOfStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_storage_pools_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfStoragePools(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
-remoteDispatchNumOfDefinedStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_defined_storage_pools_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfDefinedStoragePools(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -4830,40 +3907,6 @@ cleanup:
}
-static int
-remoteDispatchStoragePoolNumOfVolumes(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_num_of_volumes_args *args,
- remote_storage_pool_num_of_volumes_ret *ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- if ((ret->num = virStoragePoolNumOfVolumes(pool)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-
/***************************************************************
* STORAGE VOL APIS
***************************************************************/
@@ -4990,76 +4033,6 @@ cleanup:
}
static int
-remoteDispatchStorageVolDumpXML(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_storage_vol_dump_xml_args *args,
- remote_storage_vol_dump_xml_ret *ret)
-{
- virStorageVolPtr vol = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virStorageVolGetXMLDesc(vol, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (vol)
- virStorageVolFree(vol);
- return rv;
-}
-
-
-static int
-remoteDispatchStorageVolGetPath(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_storage_vol_get_path_args *args,
- remote_storage_vol_get_path_ret *ret)
-{
- virStorageVolPtr vol = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->name = virStorageVolGetPath(vol)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (vol)
- virStorageVolFree(vol);
- return rv;
-}
-
-
-static int
remoteDispatchStorageVolLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -5276,42 +4249,6 @@ cleanup:
return rv;
}
-
-static int
-remoteDispatchNodeDeviceDumpXML(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_dump_xml_args *args,
- remote_node_device_dump_xml_ret *ret)
-{
- virNodeDevicePtr dev = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virNodeDeviceGetXMLDesc(dev, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dev)
- virNodeDeviceFree(dev);
- return rv;
-}
-
-
static int
remoteDispatchNodeDeviceGetParent(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -5362,41 +4299,6 @@ cleanup:
return rv;
}
-
-static int
-remoteDispatchNodeDeviceNumOfCaps(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_num_of_caps_args *args,
- remote_node_device_num_of_caps_ret *ret)
-{
- virNodeDevicePtr dev = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
- goto cleanup;
-
- if ((ret->num = virNodeDeviceNumOfCaps(dev)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dev)
- virNodeDeviceFree(dev);
- return rv;
-}
-
-
static int
remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -5712,33 +4614,6 @@ cleanup:
}
static int
-remoteDispatchNumOfSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_secrets_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfSecrets(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-static int
remoteDispatchListSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -5852,38 +4727,6 @@ cleanup:
}
static int
-remoteDispatchSecretGetXMLDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_secret_get_xml_desc_args *args,
- remote_secret_get_xml_desc_ret *ret)
-{
- virSecretPtr secret = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(secret = get_nonnull_secret(conn, args->secret)))
- goto cleanup;
- if (!(ret->xml = virSecretGetXMLDesc(secret, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (secret)
- virSecretFree(secret);
- return rv;
-}
-
-static int
remoteDispatchSecretLookupByUUID(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -5947,291 +4790,6 @@ cleanup:
return rv;
}
-
-static int remoteDispatchDomainIsActive(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_is_active_args *args,
- remote_domain_is_active_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->active = virDomainIsActive(dom)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int remoteDispatchDomainIsPersistent(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_is_persistent_args *args,
- remote_domain_is_persistent_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->persistent = virDomainIsPersistent(dom)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int remoteDispatchDomainIsUpdated(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_is_updated_args *args,
- remote_domain_is_updated_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->updated = virDomainIsUpdated(dom)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_interface_is_active_args *args,
- remote_interface_is_active_ret *ret)
-{
- virInterfacePtr iface = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(iface = get_nonnull_interface(conn, args->iface)))
- goto cleanup;
-
- if ((ret->active = virInterfaceIsActive(iface)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (iface)
- virInterfaceFree(iface);
- return rv;
-}
-
-static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_network_is_active_args *args,
- remote_network_is_active_ret *ret)
-{
- virNetworkPtr net = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(net = get_nonnull_network(conn, args->net)))
- goto cleanup;
-
- if ((ret->active = virNetworkIsActive(net)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (net)
- virNetworkFree(net);
- return rv;
-}
-
-static int remoteDispatchNetworkIsPersistent(struct qemud_server *server
ATTRIBUTE_UNUSED,
- struct qemud_client *client
ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr
ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_network_is_persistent_args *args,
- remote_network_is_persistent_ret *ret)
-{
- virNetworkPtr net = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(net = get_nonnull_network(conn, args->net)))
- goto cleanup;
-
- if ((ret->persistent = virNetworkIsPersistent(net)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (net)
- virNetworkFree(net);
- return rv;
-}
-
-static int remoteDispatchStoragePoolIsActive(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_is_active_args *args,
- remote_storage_pool_is_active_ret *ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- if ((ret->active = virStoragePoolIsActive(pool)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-static int remoteDispatchStoragePoolIsPersistent(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_is_persistent_args
*args,
- remote_storage_pool_is_persistent_ret
*ret)
-{
- virStoragePoolPtr pool = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
- goto cleanup;
-
- if ((ret->persistent = virStoragePoolIsPersistent(pool)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (pool)
- virStoragePoolFree(pool);
- return rv;
-}
-
-
-static int remoteDispatchIsSecure(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_is_secure_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->secure = virConnectIsSecure(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-
static int
remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -6382,79 +4940,6 @@ cleanup:
}
static int
-remoteDispatchDomainSnapshotDumpXML(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_dump_xml_args *args,
- remote_domain_snapshot_dump_xml_ret *ret)
-{
- virDomainPtr dom = NULL;
- virDomainSnapshotPtr snapshot = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->snap.dom)))
- goto cleanup;
-
- if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virDomainSnapshotGetXMLDesc(snapshot, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (snapshot)
- virDomainSnapshotFree(snapshot);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
-remoteDispatchDomainSnapshotNum(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_num_args *args,
- remote_domain_snapshot_num_ret *ret)
-{
- virDomainPtr dom = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- if ((ret->num = virDomainSnapshotNum(dom, args->flags)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -6546,43 +5031,6 @@ cleanup:
}
static int
-remoteDispatchDomainHasCurrentSnapshot(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_has_current_snapshot_args *args,
- remote_domain_has_current_snapshot_ret *ret)
-{
- virDomainPtr dom = NULL;
- int result;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(dom = get_nonnull_domain(conn, args->dom)))
- goto cleanup;
-
- result = virDomainHasCurrentSnapshot(dom, args->flags);
- if (result < 0)
- goto cleanup;
-
- ret->result = result;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (dom)
- virDomainFree(dom);
- return rv;
-}
-
-static int
remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -6850,70 +5298,6 @@ cleanup:
return rv;
}
-
-static int
-remoteDispatchNWFilterGetXMLDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- remote_nwfilter_get_xml_desc_args *args,
- remote_nwfilter_get_xml_desc_ret *ret)
-{
- virNWFilterPtr nwfilter = NULL;
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
- goto cleanup;
-
- /* remoteDispatchClientRequest will free this. */
- if (!(ret->xml = virNWFilterGetXMLDesc(nwfilter, args->flags)))
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- if (nwfilter)
- virNWFilterFree(nwfilter);
- return rv;
-}
-
-
-static int
-remoteDispatchNumOfNWFilters(struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client ATTRIBUTE_UNUSED,
- virConnectPtr conn,
- remote_message_header *hdr ATTRIBUTE_UNUSED,
- remote_error *rerr,
- void *args ATTRIBUTE_UNUSED,
- remote_num_of_nwfilters_ret *ret)
-{
- int rv = -1;
-
- if (!conn) {
- virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
- goto cleanup;
- }
-
- if ((ret->num = virConnectNumOfNWFilters(conn)) < 0)
- goto cleanup;
-
- rv = 0;
-
-cleanup:
- if (rv < 0)
- remoteDispatchError(rerr);
- return rv;
-}
-
-
static int
remoteDispatchDomainGetBlockInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
diff --git a/daemon/remote_dispatch_bodies.c b/daemon/remote_dispatch_bodies.c
index 6b4abec..c1959b6 100644
--- a/daemon/remote_dispatch_bodies.c
+++ b/daemon/remote_dispatch_bodies.c
@@ -300,7 +300,41 @@ cleanup:
return rv;
}
-/* remoteDispatchDomainDumpXML has to be implemented manually */
+static int
+remoteDispatchDomainDumpXML(
+ 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_dump_xml_args *args,
+ remote_domain_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((xml = virDomainGetXMLDesc(dom, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainEventsDeregister has to be implemented manually */
@@ -310,7 +344,41 @@ cleanup:
/* remoteDispatchDomainEventsRegisterAny has to be implemented manually */
-/* remoteDispatchDomainGetAutostart has to be implemented manually */
+static int
+remoteDispatchDomainGetAutostart(
+ 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_get_autostart_args *args,
+ remote_domain_get_autostart_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int autostart;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if (virDomainGetAutostart(dom, &autostart) < 0)
+ goto cleanup;
+
+ ret->autostart = autostart;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
@@ -320,13 +388,115 @@ cleanup:
/* remoteDispatchDomainGetJobInfo has to be implemented manually */
-/* remoteDispatchDomainGetMaxMemory has to be implemented manually */
+static int
+remoteDispatchDomainGetMaxMemory(
+ 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_get_max_memory_args *args,
+ remote_domain_get_max_memory_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ unsigned long memory;
-/* remoteDispatchDomainGetMaxVcpus has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((memory = virDomainGetMaxMemory(dom)) == 0)
+ goto cleanup;
+
+ ret->memory = memory;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+static int
+remoteDispatchDomainGetMaxVcpus(
+ 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_get_max_vcpus_args *args,
+ remote_domain_get_max_vcpus_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((num = virDomainGetMaxVcpus(dom)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainGetMemoryParameters has to be implemented manually */
-/* remoteDispatchDomainGetOsType has to be implemented manually */
+static int
+remoteDispatchDomainGetOsType(
+ 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_get_os_type_args *args,
+ remote_domain_get_os_type_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ char *type;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((type = virDomainGetOSType(dom)) == NULL)
+ goto cleanup;
+
+ ret->type = type;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainGetSchedulerParameters has to be implemented manually */
@@ -336,19 +506,223 @@ cleanup:
/* remoteDispatchDomainGetVcpus has to be implemented manually */
-/* remoteDispatchDomainGetVcpusFlags has to be implemented manually */
+static int
+remoteDispatchDomainGetVcpusFlags(
+ 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_get_vcpus_flags_args *args,
+ remote_domain_get_vcpus_flags_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((num = virDomainGetVcpusFlags(dom, args->flags)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+static int
+remoteDispatchDomainHasCurrentSnapshot(
+ 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_has_current_snapshot_args *args,
+ remote_domain_has_current_snapshot_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int result;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((result = virDomainHasCurrentSnapshot(dom, args->flags)) < 0)
+ goto cleanup;
+
+ ret->result = result;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+static int
+remoteDispatchDomainHasManagedSaveImage(
+ 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_has_managed_save_image_args *args,
+ remote_domain_has_managed_save_image_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int result;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchDomainHasCurrentSnapshot has to be implemented manually */
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((result = virDomainHasManagedSaveImage(dom, args->flags)) < 0)
+ goto cleanup;
+
+ ret->result = result;
+ rv = 0;
-/* remoteDispatchDomainHasManagedSaveImage has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainInterfaceStats has to be implemented manually */
-/* remoteDispatchDomainIsActive has to be implemented manually */
+static int
+remoteDispatchDomainIsActive(
+ 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_is_active_args *args,
+ remote_domain_is_active_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int active;
-/* remoteDispatchDomainIsPersistent has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchDomainIsUpdated has to be implemented manually */
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((active = virDomainIsActive(dom)) < 0)
+ goto cleanup;
+
+ ret->active = active;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+static int
+remoteDispatchDomainIsPersistent(
+ 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_is_persistent_args *args,
+ remote_domain_is_persistent_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int persistent;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((persistent = virDomainIsPersistent(dom)) < 0)
+ goto cleanup;
+
+ ret->persistent = persistent;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+static int
+remoteDispatchDomainIsUpdated(
+ 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_is_updated_args *args,
+ remote_domain_is_updated_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int updated;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((updated = virDomainIsUpdated(dom)) < 0)
+ goto cleanup;
+
+ ret->updated = updated;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainLookupById has to be implemented manually */
@@ -563,7 +937,6 @@ remoteDispatchDomainRestore(
goto cleanup;
}
-
if (virDomainRestore(conn, args->from) < 0)
goto cleanup;
@@ -572,7 +945,6 @@ remoteDispatchDomainRestore(
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
-
return rv;
}
@@ -972,13 +1344,87 @@ cleanup:
return rv;
}
-/* remoteDispatchDomainSnapshotDumpXML has to be implemented manually */
+static int
+remoteDispatchDomainSnapshotDumpXML(
+ 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_dump_xml_args *args,
+ remote_domain_snapshot_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ virDomainSnapshotPtr snapshot = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->snap.dom)))
+ goto cleanup;
+
+ if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
+ goto cleanup;
+
+ if ((xml = virDomainSnapshotGetXMLDesc(snapshot, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (snapshot)
+ virDomainSnapshotFree(snapshot);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
/* remoteDispatchDomainSnapshotListNames has to be implemented manually */
/* remoteDispatchDomainSnapshotLookupByName has to be implemented manually */
-/* remoteDispatchDomainSnapshotNum has to be implemented manually */
+static int
+remoteDispatchDomainSnapshotNum(
+ 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_num_args *args,
+ remote_domain_snapshot_num_ret *ret)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if ((num = virDomainSnapshotNum(dom, args->flags)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
static int
remoteDispatchDomainSuspend(
@@ -1082,27 +1528,251 @@ cleanup:
return rv;
}
-/* remoteDispatchDomainXMLFromNative has to be implemented manually */
+static int
+remoteDispatchDomainXMLFromNative(
+ 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_xml_from_native_args *args,
+ remote_domain_xml_from_native_ret *ret)
+{
+ int rv = -1;
+ char *domainXml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((domainXml = virConnectDomainXMLFromNative(conn, args->nativeFormat,
args->nativeConfig, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->domainXml = domainXml;
+ rv = 0;
-/* remoteDispatchDomainXMLToNative has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchDomainXMLToNative(
+ 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_xml_to_native_args *args,
+ remote_domain_xml_to_native_ret *ret)
+{
+ int rv = -1;
+ char *nativeConfig;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((nativeConfig = virConnectDomainXMLToNative(conn, args->nativeFormat,
args->domainXml, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->nativeConfig = nativeConfig;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
/* remoteDispatchFindStoragePoolSources has to be implemented manually */
-/* remoteDispatchGetCapabilities has to be implemented manually */
+static int
+remoteDispatchGetCapabilities(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_capabilities_ret *ret)
+{
+ int rv = -1;
+ char *capabilities;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchGetHostname has to be implemented manually */
+ if ((capabilities = virConnectGetCapabilities(conn)) == NULL)
+ goto cleanup;
-/* remoteDispatchGetLibVersion has to be implemented manually */
+ ret->capabilities = capabilities;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchGetHostname(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_hostname_ret *ret)
+{
+ int rv = -1;
+ char *hostname;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((hostname = virConnectGetHostname(conn)) == NULL)
+ goto cleanup;
+
+ ret->hostname = hostname;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchGetLibVersion(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_lib_version_ret *ret)
+{
+ int rv = -1;
+ unsigned long lib_ver;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (virConnectGetLibVersion(conn, &lib_ver) < 0)
+ goto cleanup;
+
+ ret->lib_ver = lib_ver;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
/* remoteDispatchGetMaxVcpus has to be implemented manually */
-/* remoteDispatchGetSysinfo has to be implemented manually */
+static int
+remoteDispatchGetSysinfo(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_get_sysinfo_args *args,
+ remote_get_sysinfo_ret *ret)
+{
+ int rv = -1;
+ char *sysinfo;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((sysinfo = virConnectGetSysinfo(conn, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->sysinfo = sysinfo;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
/* remoteDispatchGetType has to be implemented manually */
-/* remoteDispatchGetURI has to be implemented manually */
+static int
+remoteDispatchGetURI(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_uri_ret *ret)
+{
+ int rv = -1;
+ char *uri;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((uri = virConnectGetURI(conn)) == NULL)
+ goto cleanup;
+
+ ret->uri = uri;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchGetVersion(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_version_ret *ret)
+{
+ int rv = -1;
+ unsigned long hv_ver;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (virConnectGetVersion(conn, &hv_ver) < 0)
+ goto cleanup;
-/* remoteDispatchGetVersion has to be implemented manually */
+ ret->hv_ver = hv_ver;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
static int
remoteDispatchInterfaceCreate(
@@ -1174,9 +1844,77 @@ cleanup:
return rv;
}
-/* remoteDispatchInterfaceGetXMLDesc has to be implemented manually */
+static int
+remoteDispatchInterfaceGetXMLDesc(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_interface_get_xml_desc_args *args,
+ remote_interface_get_xml_desc_ret *ret)
+{
+ int rv = -1;
+ virInterfacePtr iface = NULL;
+ char *xml;
-/* remoteDispatchInterfaceIsActive has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
+ goto cleanup;
+
+ if ((xml = virInterfaceGetXMLDesc(iface, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (iface)
+ virInterfaceFree(iface);
+ return rv;
+}
+
+static int
+remoteDispatchInterfaceIsActive(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_interface_is_active_args *args,
+ remote_interface_is_active_ret *ret)
+{
+ int rv = -1;
+ virInterfacePtr iface = NULL;
+ int active;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
+ goto cleanup;
+
+ if ((active = virInterfaceIsActive(iface)) < 0)
+ goto cleanup;
+
+ ret->active = active;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (iface)
+ virInterfaceFree(iface);
+ return rv;
+}
/* remoteDispatchInterfaceLookupByMacString has to be implemented manually */
@@ -1216,7 +1954,35 @@ cleanup:
return rv;
}
-/* remoteDispatchIsSecure has to be implemented manually */
+static int
+remoteDispatchIsSecure(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_is_secure_ret *ret)
+{
+ int rv = -1;
+ int secure;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((secure = virConnectIsSecure(conn)) < 0)
+ goto cleanup;
+
+ ret->secure = secure;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
/* remoteDispatchListDefinedDomains has to be implemented manually */
@@ -1310,15 +2076,185 @@ cleanup:
return rv;
}
-/* remoteDispatchNetworkDumpXML has to be implemented manually */
+static int
+remoteDispatchNetworkDumpXML(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_network_dump_xml_args *args,
+ remote_network_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virNetworkPtr net = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchNetworkGetAutostart has to be implemented manually */
+ if (!(net = get_nonnull_network(conn, args->net)))
+ goto cleanup;
-/* remoteDispatchNetworkGetBridgeName has to be implemented manually */
+ if ((xml = virNetworkGetXMLDesc(net, args->flags)) == NULL)
+ goto cleanup;
-/* remoteDispatchNetworkIsActive has to be implemented manually */
+ ret->xml = xml;
+ rv = 0;
-/* remoteDispatchNetworkIsPersistent has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (net)
+ virNetworkFree(net);
+ return rv;
+}
+
+static int
+remoteDispatchNetworkGetAutostart(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_network_get_autostart_args *args,
+ remote_network_get_autostart_ret *ret)
+{
+ int rv = -1;
+ virNetworkPtr net = NULL;
+ int autostart;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(net = get_nonnull_network(conn, args->net)))
+ goto cleanup;
+
+ if (virNetworkGetAutostart(net, &autostart) < 0)
+ goto cleanup;
+
+ ret->autostart = autostart;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (net)
+ virNetworkFree(net);
+ return rv;
+}
+
+static int
+remoteDispatchNetworkGetBridgeName(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_network_get_bridge_name_args *args,
+ remote_network_get_bridge_name_ret *ret)
+{
+ int rv = -1;
+ virNetworkPtr net = NULL;
+ char *name;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(net = get_nonnull_network(conn, args->net)))
+ goto cleanup;
+
+ if ((name = virNetworkGetBridgeName(net)) == NULL)
+ goto cleanup;
+
+ ret->name = name;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (net)
+ virNetworkFree(net);
+ return rv;
+}
+
+static int
+remoteDispatchNetworkIsActive(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_network_is_active_args *args,
+ remote_network_is_active_ret *ret)
+{
+ int rv = -1;
+ virNetworkPtr net = NULL;
+ int active;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(net = get_nonnull_network(conn, args->net)))
+ goto cleanup;
+
+ if ((active = virNetworkIsActive(net)) < 0)
+ goto cleanup;
+
+ ret->active = active;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (net)
+ virNetworkFree(net);
+ return rv;
+}
+
+static int
+remoteDispatchNetworkIsPersistent(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_network_is_persistent_args *args,
+ remote_network_is_persistent_ret *ret)
+{
+ int rv = -1;
+ virNetworkPtr net = NULL;
+ int persistent;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(net = get_nonnull_network(conn, args->net)))
+ goto cleanup;
+
+ if ((persistent = virNetworkIsPersistent(net)) < 0)
+ goto cleanup;
+
+ ret->persistent = persistent;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (net)
+ virNetworkFree(net);
+ return rv;
+}
/* remoteDispatchNetworkLookupByName has to be implemented manually */
@@ -1462,7 +2398,41 @@ cleanup:
return rv;
}
-/* remoteDispatchNodeDeviceDumpXML has to be implemented manually */
+static int
+remoteDispatchNodeDeviceDumpXML(
+ 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_dump_xml_args *args,
+ remote_node_device_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virNodeDevicePtr dev = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+ goto cleanup;
+
+ if ((xml = virNodeDeviceGetXMLDesc(dev, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dev)
+ virNodeDeviceFree(dev);
+ return rv;
+}
/* remoteDispatchNodeDeviceGetParent has to be implemented manually */
@@ -1470,7 +2440,41 @@ cleanup:
/* remoteDispatchNodeDeviceLookupByName has to be implemented manually */
-/* remoteDispatchNodeDeviceNumOfCaps has to be implemented manually */
+static int
+remoteDispatchNodeDeviceNumOfCaps(
+ 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_num_of_caps_args *args,
+ remote_node_device_num_of_caps_ret *ret)
+{
+ int rv = -1;
+ virNodeDevicePtr dev = NULL;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+ goto cleanup;
+
+ if ((num = virNodeDeviceNumOfCaps(dev)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (dev)
+ virNodeDeviceFree(dev);
+ return rv;
+}
static int
remoteDispatchNodeDeviceReAttach(
@@ -1552,29 +2556,343 @@ cleanup:
/* remoteDispatchNodeNumOfDevices has to be implemented manually */
-/* remoteDispatchNumOfDefinedDomains has to be implemented manually */
+static int
+remoteDispatchNumOfDefinedDomains(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_defined_domains_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfDefinedDomains(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfDefinedInterfaces(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_defined_interfaces_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfDefinedInterfaces(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfDefinedNetworks(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_defined_networks_ret *ret)
+{
+ int rv = -1;
+ int num;
-/* remoteDispatchNumOfDefinedInterfaces has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchNumOfDefinedNetworks has to be implemented manually */
+ if ((num = virConnectNumOfDefinedNetworks(conn)) < 0)
+ goto cleanup;
-/* remoteDispatchNumOfDefinedStoragePools has to be implemented manually */
+ ret->num = num;
+ rv = 0;
-/* remoteDispatchNumOfDomains has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
-/* remoteDispatchNumOfInterfaces has to be implemented manually */
+static int
+remoteDispatchNumOfDefinedStoragePools(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_defined_storage_pools_ret *ret)
+{
+ int rv = -1;
+ int num;
-/* remoteDispatchNumOfNetworks has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchNumOfNWFilters has to be implemented manually */
+ if ((num = virConnectNumOfDefinedStoragePools(conn)) < 0)
+ goto cleanup;
-/* remoteDispatchNumOfSecrets has to be implemented manually */
+ ret->num = num;
+ rv = 0;
-/* remoteDispatchNumOfStoragePools has to be implemented manually */
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfDomains(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_domains_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfDomains(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfInterfaces(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_interfaces_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfInterfaces(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfNetworks(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_networks_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfNetworks(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfNWFilters(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_nwfilters_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfNWFilters(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfSecrets(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_secrets_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfSecrets(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
+
+static int
+remoteDispatchNumOfStoragePools(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_num_of_storage_pools_ret *ret)
+{
+ int rv = -1;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((num = virConnectNumOfStoragePools(conn)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
/* remoteDispatchNWFilterDefineXML has to be implemented manually */
-/* remoteDispatchNWFilterGetXMLDesc has to be implemented manually */
+static int
+remoteDispatchNWFilterGetXMLDesc(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_nwfilter_get_xml_desc_args *args,
+ remote_nwfilter_get_xml_desc_ret *ret)
+{
+ int rv = -1;
+ virNWFilterPtr nwfilter = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
+ goto cleanup;
+
+ if ((xml = virNWFilterGetXMLDesc(nwfilter, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (nwfilter)
+ virNWFilterFree(nwfilter);
+ return rv;
+}
/* remoteDispatchNWFilterLookupByName has to be implemented manually */
@@ -1620,7 +2938,41 @@ cleanup:
/* remoteDispatchSecretGetValue has to be implemented manually */
-/* remoteDispatchSecretGetXMLDesc has to be implemented manually */
+static int
+remoteDispatchSecretGetXMLDesc(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_secret_get_xml_desc_args *args,
+ remote_secret_get_xml_desc_ret *ret)
+{
+ int rv = -1;
+ virSecretPtr secret = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
+ goto cleanup;
+
+ if ((xml = virSecretGetXMLDesc(secret, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (secret)
+ virSecretFree(secret);
+ return rv;
+}
/* remoteDispatchSecretLookupByUsage has to be implemented manually */
@@ -1834,15 +3186,151 @@ cleanup:
return rv;
}
-/* remoteDispatchStoragePoolDumpXML has to be implemented manually */
+static int
+remoteDispatchStoragePoolDumpXML(
+ 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_dump_xml_args *args,
+ remote_storage_pool_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ char *xml;
-/* remoteDispatchStoragePoolGetAutostart has to be implemented manually */
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ if ((xml = virStoragePoolGetXMLDesc(pool, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ return rv;
+}
+
+static int
+remoteDispatchStoragePoolGetAutostart(
+ 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_get_autostart_args *args,
+ remote_storage_pool_get_autostart_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ int autostart;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ if (virStoragePoolGetAutostart(pool, &autostart) < 0)
+ goto cleanup;
+
+ ret->autostart = autostart;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ return rv;
+}
/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
-/* remoteDispatchStoragePoolIsActive has to be implemented manually */
+static int
+remoteDispatchStoragePoolIsActive(
+ 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_is_active_args *args,
+ remote_storage_pool_is_active_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ int active;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
-/* remoteDispatchStoragePoolIsPersistent has to be implemented manually */
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ if ((active = virStoragePoolIsActive(pool)) < 0)
+ goto cleanup;
+
+ ret->active = active;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ return rv;
+}
+
+static int
+remoteDispatchStoragePoolIsPersistent(
+ 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_is_persistent_args *args,
+ remote_storage_pool_is_persistent_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ int persistent;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ if ((persistent = virStoragePoolIsPersistent(pool)) < 0)
+ goto cleanup;
+
+ ret->persistent = persistent;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ return rv;
+}
/* remoteDispatchStoragePoolListVolumes has to be implemented manually */
@@ -1852,7 +3340,41 @@ cleanup:
/* remoteDispatchStoragePoolLookupByVolume has to be implemented manually */
-/* remoteDispatchStoragePoolNumOfVolumes has to be implemented manually */
+static int
+remoteDispatchStoragePoolNumOfVolumes(
+ 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_num_of_volumes_args *args,
+ remote_storage_pool_num_of_volumes_ret *ret)
+{
+ int rv = -1;
+ virStoragePoolPtr pool = NULL;
+ int num;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+ goto cleanup;
+
+ if ((num = virStoragePoolNumOfVolumes(pool)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (pool)
+ virStoragePoolFree(pool);
+ return rv;
+}
static int
remoteDispatchStoragePoolRefresh(
@@ -1996,11 +3518,79 @@ cleanup:
/* remoteDispatchStorageVolDownload has to be implemented manually */
-/* remoteDispatchStorageVolDumpXML has to be implemented manually */
+static int
+remoteDispatchStorageVolDumpXML(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_storage_vol_dump_xml_args *args,
+ remote_storage_vol_dump_xml_ret *ret)
+{
+ int rv = -1;
+ virStorageVolPtr vol = NULL;
+ char *xml;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
+ goto cleanup;
+
+ if ((xml = virStorageVolGetXMLDesc(vol, args->flags)) == NULL)
+ goto cleanup;
+
+ ret->xml = xml;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (vol)
+ virStorageVolFree(vol);
+ return rv;
+}
/* remoteDispatchStorageVolGetInfo has to be implemented manually */
-/* remoteDispatchStorageVolGetPath has to be implemented manually */
+static int
+remoteDispatchStorageVolGetPath(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_storage_vol_get_path_args *args,
+ remote_storage_vol_get_path_ret *ret)
+{
+ int rv = -1;
+ virStorageVolPtr vol = NULL;
+ char *name;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
+ goto cleanup;
+
+ if ((name = virStorageVolGetPath(vol)) == NULL)
+ goto cleanup;
+
+ ret->name = name;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ if (vol)
+ virStorageVolFree(vol);
+ return rv;
+}
/* remoteDispatchStorageVolLookupByKey has to be implemented manually */
@@ -2044,5 +3634,33 @@ cleanup:
return rv;
}
-/* remoteDispatchSupportsFeature has to be implemented manually */
+static int
+remoteDispatchSupportsFeature(
+ struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_supports_feature_args *args,
+ remote_supports_feature_ret *ret)
+{
+ int rv = -1;
+ int supported;
+
+ if (!conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if ((supported = virDrvSupportsFeature(conn, args->feature)) < 0)
+ goto cleanup;
+
+ ret->supported = supported;
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ remoteDispatchError(rerr);
+ return rv;
+}
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index 31af8b6..0901649 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -54,6 +54,7 @@ if ($opt_c) {
}
my $collect_args_members = 0;
+my $collect_ret_members = 0;
my $last_name;
while (<>) {
@@ -63,6 +64,12 @@ while (<>) {
} elsif ($_ =~ m/^\s*(.*\S)\s*$/) {
push(@{$calls{$name}->{args_members}}, $1);
}
+ } elsif ($collect_ret_members) {
+ if (/^};/) {
+ $collect_ret_members = 0;
+ } elsif ($_ =~ m/^\s*(.*\S)\s*$/) {
+ push(@{$calls{$name}->{ret_members}}, $1);
+ }
} elsif (/^struct ${structprefix}_(.*)_args/) {
$name = $1;
$ProcName = name_to_ProcName ($name);
@@ -80,6 +87,7 @@ while (<>) {
};
$collect_args_members = 1;
+ $collect_ret_members = 0;
$last_name = $name;
} elsif (/^struct ${structprefix}_(.*)_ret/) {
$name = $1;
@@ -93,11 +101,14 @@ while (<>) {
ProcName => $ProcName,
UC_NAME => uc $name,
args => "void",
- ret => "${structprefix}_${name}_ret"
+ ret => "${structprefix}_${name}_ret",
+ ret_members => []
}
}
$collect_args_members = 0;
+ $collect_ret_members = 1;
+ $last_name = $name;
} elsif (/^struct ${structprefix}_(.*)_msg/) {
$name = $1;
$ProcName = name_to_ProcName ($name);
@@ -110,6 +121,7 @@ while (<>) {
};
$collect_args_members = 0;
+ $collect_ret_members = 0;
} elsif (/^\s*${procprefix}_PROC_(.*?)\s+=\s+(\d+),?$/) {
$name = lc $1;
$id = $2;
@@ -118,8 +130,10 @@ while (<>) {
$calls[$id] = $calls{$name};
$collect_args_members = 0;
+ $collect_ret_members = 0;
} else {
$collect_args_members = 0;
+ $collect_ret_members = 0;
}
}
@@ -235,7 +249,96 @@ elsif ($opt_b) {
"DomainSetBlkioParameters",
"Open",
"StorageVolUpload",
- "StorageVolDownload");
+ "StorageVolDownload",
+
+ "AuthList",
+ "AuthSaslInit",
+ "AuthSaslStart",
+ "AuthSaslStep",
+ "AuthPolkit",
+
+ "CpuBaseline",
+ "CpuCompare",
+ "DomainBlockPeek",
+ "DomainBlockStats",
+ "DomainCreateWithFlags",
+ "DomainCreateXML",
+ "DomainDefineXML",
+ "DomainEventsDeregister",
+ "DomainEventsRegister",
+ "DomainGetBlkioParameters",
+ "DomainGetBlockInfo",
+ "DomainGetInfo",
+ "DomainGetJobInfo",
+ "DomainGetMemoryParameters",
+ "DomainGetSchedulerParameters",
+ "DomainGetSchedulerType",
+ "DomainGetSecurityLabel",
+ "DomainGetVcpus",
+ "DomainInterfaceStats",
+ "DomainLookupById",
+ "DomainLookupByName",
+ "DomainLookupByUUID",
+ "DomainMemoryPeek",
+ "DomainMemoryStats",
+ "DomainMigrateFinish",
+ "DomainMigrateFinish2",
+ "DomainMigratePrepare",
+ "DomainMigratePrepare2",
+ "DomainSnapshotCreateXML",
+ "DomainSnapshotCurrent",
+ "DomainSnapshotListNames",
+ "DomainSnapshotLookupByName",
+ "FindStoragePoolSources",
+ "GetMaxVcpus",
+ "GetType",
+ "InterfaceLookupByMacString",
+ "InterfaceLookupByName",
+ "InterfaceDefineXML",
+ "ListDefinedDomains",
+ "ListDefinedInterfaces",
+ "ListDefinedNetworks",
+ "ListDefinedStoragePools",
+ "ListDomains",
+ "ListInterfaces",
+ "ListNetworks",
+ "ListNWFilters",
+ "ListSecrets",
+ "ListStoragePools",
+ "NetworkLookupByName",
+ "NetworkLookupByUUID",
+ "NodeDeviceCreateXML",
+ "NetworkCreateXML",
+ "NodeDeviceGetParent",
+ "NodeDeviceListCaps",
+ "NodeDeviceLookupByName",
+ "NodeGetCellsFreeMemory",
+ "NodeGetFreeMemory",
+ "NodeGetInfo",
+ "NodeGetSecurityModel",
+ "NetworkDefineXML",
+ "NodeListDevices",
+ "NodeNumOfDevices",
+ "NWFilterLookupByName",
+ "NWFilterLookupByUUID",
+ "SecretDefineXML",
+ "SecretGetValue",
+ "NWFilterDefineXML",
+ "SecretLookupByUsage",
+ "SecretLookupByUUID",
+ "StoragePoolCreateXML",
+ "StoragePoolDefineXML",
+ "StoragePoolGetInfo",
+ "StoragePoolListVolumes",
+ "StoragePoolLookupByName",
+ "StoragePoolLookupByUUID",
+ "StoragePoolLookupByVolume",
+ "StorageVolCreateXML",
+ "StorageVolCreateXMLFrom",
+ "StorageVolGetInfo",
+ "StorageVolLookupByKey",
+ "StorageVolLookupByName",
+ "StorageVolLookupByPath");
} elsif ($structprefix eq "qemu") {
@ungeneratable = ("MonitorCommand");
}
@@ -248,8 +351,9 @@ elsif ($opt_b) {
next if $calls{$_}->{msg};
# FIXME: skip functions with explicit return value for now
- if ($calls{$_}->{ret} ne "void" or
exists($ug{$calls{$_}->{ProcName}})) {
- print "/* ${structprefix}Dispatch$calls{$_}->{ProcName} has to be
implemented manually */\n\n";
+ if (exists($ug{$calls{$_}->{ProcName}})) {
+ print "/* ${structprefix}Dispatch$calls{$_}->{ProcName} has to "
.
+ "be implemented manually */\n\n";
next;
}
@@ -281,6 +385,7 @@ elsif ($opt_b) {
my @vars_list = ();
my @getters_list = ();
my @args_list = ();
+ my @ret_list = ();
my @free_list = ();
if ($calls{$_}->{args} ne "void") {
@@ -401,6 +506,49 @@ elsif ($opt_b) {
}
}
+ my $single_ret_var = "undefined";
+ my $single_ret_by_ref = 0;
+ my $single_ret_check = " == 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");
+ } elsif ($ret_member =~ m/remote_nonnull_string (\S+);/) {
+ push(@vars_list, "char *$1");
+ push(@ret_list, "ret->$1 = $1;");
+ $single_ret_var = $1;
+ $single_ret_by_ref = 0;
+ $single_ret_check = " == NULL";
+ } elsif ($ret_member =~ m/int (\S+);/) {
+ push(@vars_list, "int $1");
+ push(@ret_list, "ret->$1 = $1;");
+ $single_ret_var = $1;
+
+ if ($calls{$_}->{ProcName} eq "DomainGetAutostart" or
+ $calls{$_}->{ProcName} eq "NetworkGetAutostart" or
+ $calls{$_}->{ProcName} eq "StoragePoolGetAutostart")
{
+ $single_ret_by_ref = 1;
+ } else {
+ $single_ret_by_ref = 0;
+ $single_ret_check = " < 0";
+ }
+ } elsif ($ret_member =~ m/hyper (\S+);/) {
+ push(@vars_list, "unsigned long $1");
+ push(@ret_list, "ret->$1 = $1;");
+ $single_ret_var = $1;
+
+ if ($calls{$_}->{ProcName} eq "DomainGetMaxMemory") {
+ $single_ret_by_ref = 0;
+ $single_ret_check = " == 0";
+ } else {
+ $single_ret_by_ref = 1;
+ }
+ }
+ }
+ }
+
foreach my $var (@vars_list) {
print " $var;\n";
}
@@ -414,7 +562,9 @@ elsif ($opt_b) {
print join("\n", @getters_list);
- print "\n";
+ if (@getters_list) {
+ print "\n";
+ }
if ($calls{$_}->{ret} eq "void") {
print " if (vir$calls{$_}->{ProcName}(";
@@ -422,6 +572,56 @@ elsif ($opt_b) {
print ") < 0)\n";
print " goto cleanup;\n";
print "\n";
+ } elsif (scalar(@{$calls{$_}->{ret_members}}) == 1) {
+ my $prefix = "";
+ my $proc_name = $calls{$_}->{ProcName};
+
+ if (! @args_list) {
+ push(@args_list, "conn");
+ $prefix = "Connect"
+ }
+
+ if ($calls{$_}->{ProcName} eq "GetSysinfo" or
+ $calls{$_}->{ProcName} eq "DomainXMLFromNative" or
+ $calls{$_}->{ProcName} eq "DomainXMLToNative") {
+ $prefix = "Connect"
+ } elsif ($calls{$_}->{ProcName} eq "SupportsFeature") {
+ $prefix = "Drv"
+ } elsif ($calls{$_}->{ProcName} eq "DomainDumpXML") {
+ $proc_name = "DomainGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "NetworkDumpXML") {
+ $proc_name = "NetworkGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "StoragePoolDumpXML") {
+ $proc_name = "StoragePoolGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "StorageVolDumpXML") {
+ $proc_name = "StorageVolGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "NodeDeviceDumpXML") {
+ $proc_name = "NodeDeviceGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "DomainSnapshotDumpXML") {
+ $proc_name = "DomainSnapshotGetXMLDesc"
+ } elsif ($calls{$_}->{ProcName} eq "DomainGetOsType") {
+ $proc_name = "DomainGetOSType"
+ }
+
+ if ($single_ret_by_ref) {
+ print " if (vir$prefix$proc_name(";
+ print join(', ', @args_list);
+ print ", &$single_ret_var) < 0)\n";
+ } else {
+ print " if (($single_ret_var = vir$prefix$proc_name(";
+ print join(', ', @args_list);
+ print "))$single_ret_check)\n";
+ }
+
+ print " goto cleanup;\n";
+ print "\n";
+
+ if (@ret_list) {
+ print " ";
+ }
+
+ print join(" \n", @ret_list);
+ print "\n";
}
print " rv = 0;\n";
@@ -432,7 +632,10 @@ elsif ($opt_b) {
print join("\n", @free_list);
- print "\n";
+ if (@free_list) {
+ print "\n";
+ }
+
print " return rv;\n";
print "}\n";
print "\n";
--
1.7.0.4