]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote generator, daemon: Handle more functions
authorMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 22 Apr 2011 16:54:51 +0000 (18:54 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 6 May 2011 18:08:21 +0000 (20:08 +0200)
This covers functions that return single wrapped objects and don't
involve complexer code in the body.

daemon/remote.c
daemon/remote_dispatch_bodies.c
daemon/remote_dispatch_prototypes.h
daemon/remote_dispatch_table.h
daemon/remote_generator.pl

index 8de90e961e4154415153990eb6ec0f08e621b40d..e5e4f29cee644c12a280656f777867995c81a5a4 100644 (file)
@@ -606,36 +606,6 @@ cleanup:
     return rv;
 }
 
-
-static int
-remoteDispatchNodeGetFreeMemory(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_node_get_free_memory_ret *ret)
-{
-    unsigned long long freeMem;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if ((freeMem = virNodeGetFreeMemory(conn)) == 0)
-        goto cleanup;
-    ret->freeMem = freeMem;
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    return rv;
-}
-
-
 static int
 remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSED,
                                      struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -1119,70 +1089,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainCreateXML(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_create_xml_args *args,
-                              remote_domain_create_xml_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainCreateXML(conn, args->xml_desc, args->flags)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->dom, dom);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
-remoteDispatchDomainDefineXML(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_define_xml_args *args,
-                              remote_domain_define_xml_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainDefineXML(conn, args->xml)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->dom, dom);
-
-    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,
@@ -1493,41 +1399,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainMigrateFinish(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_migrate_finish_args *args,
-                                  remote_domain_migrate_finish_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainMigrateFinish(conn, args->dname,
-                                       args->cookie.cookie_val,
-                                       args->cookie.cookie_len,
-                                       args->uri,
-                                       args->flags)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->ddom, dom);
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
 static int
 remoteDispatchDomainMigratePrepare2(struct qemud_server *server ATTRIBUTE_UNUSED,
                                     struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -1579,43 +1450,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainMigrateFinish2(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_migrate_finish2_args *args,
-                                   remote_domain_migrate_finish2_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainMigrateFinish2(conn, args->dname,
-                                        args->cookie.cookie_val,
-                                        args->cookie.cookie_len,
-                                        args->uri,
-                                        args->flags,
-                                        args->retcode)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->ddom, dom);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
 static int
 remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_UNUSED,
                                          struct qemud_client *client,
@@ -1707,102 +1541,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainLookupById(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_lookup_by_id_args *args,
-                               remote_domain_lookup_by_id_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainLookupByID(conn, args->id)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->dom, dom);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
-remoteDispatchDomainLookupByName(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_lookup_by_name_args *args,
-                                 remote_domain_lookup_by_name_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainLookupByName(conn, args->name)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->dom, dom);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
-remoteDispatchDomainLookupByUUID(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_lookup_by_uuid_args *args,
-                                 remote_domain_lookup_by_uuid_ret *ret)
-{
-    virDomainPtr dom = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dom = virDomainLookupByUUID(conn, (unsigned char *) args->uuid)))
-        goto cleanup;
-
-    make_nonnull_domain(&ret->dom, dom);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
 static int
 remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
                             struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -2414,178 +2152,50 @@ cleanup:
     return rv;
 }
 
+/*-------------------------------------------------------------*/
+
 static int
-remoteDispatchNetworkCreateXML(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_create_xml_args *args,
-                               remote_network_create_xml_ret *ret)
+remoteDispatchListInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
+                             struct qemud_client *client ATTRIBUTE_UNUSED,
+                             virConnectPtr conn,
+                             remote_message_header *hdr ATTRIBUTE_UNUSED,
+                             remote_error *rerr,
+                             remote_list_interfaces_args *args,
+                             remote_list_interfaces_ret *ret)
 {
-    virNetworkPtr net = NULL;
     int rv = -1;
+    int len;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(net = virNetworkCreateXML(conn, args->xml)))
+    if (args->maxnames > REMOTE_INTERFACE_NAME_LIST_MAX) {
+        virNetError(VIR_ERR_INTERNAL_ERROR,
+                    "%s", _("maxnames > REMOTE_INTERFACE_NAME_LIST_MAX"));
+        goto cleanup;
+    }
+
+    /* Allocate return buffer. */
+    if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+        virReportOOMError();
         goto cleanup;
+    }
 
-    make_nonnull_network(&ret->net, net);
+    len = virConnectListInterfaces(conn,
+                                   ret->names.names_val, args->maxnames);
+    if (len < 0)
+        goto cleanup;
+    ret->names.names_len = len;
 
     rv = 0;
 
 cleanup:
-    if (rv < 0)
+    if (rv < 0) {
         remoteDispatchError(rerr);
-    if (net)
-        virNetworkFree(net);
-    return rv;
-}
-
-static int
-remoteDispatchNetworkDefineXML(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_define_xml_args *args,
-                               remote_network_define_xml_ret *ret)
-{
-    virNetworkPtr net = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(net = virNetworkDefineXML(conn, args->xml)))
-        goto cleanup;
-
-    make_nonnull_network(&ret->net, net);
-
-    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,
-                                  remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                  remote_error *rerr,
-                                  remote_network_lookup_by_name_args *args,
-                                  remote_network_lookup_by_name_ret *ret)
-{
-    virNetworkPtr net = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(net = virNetworkLookupByName(conn, args->name)))
-        goto cleanup;
-
-    make_nonnull_network(&ret->net, net);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (net)
-        virNetworkFree(net);
-    return rv;
-}
-
-static int
-remoteDispatchNetworkLookupByUUID(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_lookup_by_uuid_args *args,
-                                  remote_network_lookup_by_uuid_ret *ret)
-{
-    virNetworkPtr net = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid)))
-        goto cleanup;
-
-    make_nonnull_network(&ret->net, net);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (net)
-        virNetworkFree(net);
-    return rv;
-}
-
-/*-------------------------------------------------------------*/
-
-static int
-remoteDispatchListInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
-                             struct qemud_client *client ATTRIBUTE_UNUSED,
-                             virConnectPtr conn,
-                             remote_message_header *hdr ATTRIBUTE_UNUSED,
-                             remote_error *rerr,
-                             remote_list_interfaces_args *args,
-                             remote_list_interfaces_ret *ret)
-{
-    int rv = -1;
-    int len;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (args->maxnames > REMOTE_INTERFACE_NAME_LIST_MAX) {
-        virNetError(VIR_ERR_INTERNAL_ERROR,
-                    "%s", _("maxnames > REMOTE_INTERFACE_NAME_LIST_MAX"));
-        goto cleanup;
-    }
-
-    /* Allocate return buffer. */
-    if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
-        virReportOOMError();
-        goto cleanup;
-    }
-
-    len = virConnectListInterfaces(conn,
-                                   ret->names.names_val, args->maxnames);
-    if (len < 0)
-        goto cleanup;
-    ret->names.names_len = len;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0) {
-        remoteDispatchError(rerr);
-        VIR_FREE(ret->names.names_val);
-    }
+        VIR_FREE(ret->names.names_val);
+    }
     return rv;
 }
 
@@ -2634,102 +2244,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchInterfaceLookupByName(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_lookup_by_name_args *args,
-                                    remote_interface_lookup_by_name_ret *ret)
-{
-    virInterfacePtr iface = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(iface = virInterfaceLookupByName(conn, args->name)))
-        goto cleanup;
-
-    make_nonnull_interface(&ret->iface, iface);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (iface)
-        virInterfaceFree(iface);
-    return rv;
-}
-
-static int
-remoteDispatchInterfaceLookupByMacString(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_lookup_by_mac_string_args *args,
-                                         remote_interface_lookup_by_mac_string_ret *ret)
-{
-    virInterfacePtr iface = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(iface = virInterfaceLookupByMACString(conn, args->mac)))
-        goto cleanup;
-
-    make_nonnull_interface(&ret->iface, iface);
-
-    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,
-                                 remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                 remote_error *rerr,
-                                 remote_interface_define_xml_args *args,
-                                 remote_interface_define_xml_ret *ret)
-{
-    virInterfacePtr iface = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(iface = virInterfaceDefineXML(conn, args->xml, args->flags)))
-        goto cleanup;
-
-    make_nonnull_interface(&ret->iface, iface);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (iface)
-        virInterfaceFree(iface);
-    return rv;
-}
-
 /*-------------------------------------------------------------*/
 
 static int
@@ -3656,70 +3170,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchStoragePoolCreateXML(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_create_xml_args *args,
-                                   remote_storage_pool_create_xml_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(pool = virStoragePoolCreateXML(conn, args->xml, args->flags)))
-        goto cleanup;
-
-    make_nonnull_storage_pool(&ret->pool, pool);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
-static int
-remoteDispatchStoragePoolDefineXML(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_define_xml_args *args,
-                                   remote_storage_pool_define_xml_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(pool = virStoragePoolDefineXML(conn, args->xml, args->flags)))
-        goto cleanup;
-
-    make_nonnull_storage_pool(&ret->pool, pool);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
 static int
 remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
                                  struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -3760,133 +3210,31 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolLookupByName(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_lookup_by_name_args *args,
-                                      remote_storage_pool_lookup_by_name_ret *ret)
+remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSED,
+                                     struct qemud_client *client ATTRIBUTE_UNUSED,
+                                     virConnectPtr conn,
+                                     remote_message_header *hdr ATTRIBUTE_UNUSED,
+                                     remote_error *rerr,
+                                     remote_storage_pool_list_volumes_args *args,
+                                     remote_storage_pool_list_volumes_ret *ret)
 {
     virStoragePoolPtr pool = NULL;
     int rv = -1;
+    int len;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(pool = virStoragePoolLookupByName(conn, args->name)))
+    if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
+        virNetError(VIR_ERR_INTERNAL_ERROR,
+                    "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
         goto cleanup;
+    }
 
-    make_nonnull_storage_pool(&ret->pool, pool);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
-static int
-remoteDispatchStoragePoolLookupByUUID(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_lookup_by_uuid_args *args,
-                                      remote_storage_pool_lookup_by_uuid_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(pool = virStoragePoolLookupByUUID(conn, (unsigned char *) args->uuid)))
-        goto cleanup;
-
-    make_nonnull_storage_pool(&ret->pool, pool);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
-static int
-remoteDispatchStoragePoolLookupByVolume(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_lookup_by_volume_args *args,
-                                        remote_storage_pool_lookup_by_volume_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    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;
-
-    if (!(pool = virStoragePoolLookupByVolume(vol)))
-        goto cleanup;
-
-    make_nonnull_storage_pool(&ret->pool, pool);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (vol)
-        virStorageVolFree(vol);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
-static int
-remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSED,
-                                     struct qemud_client *client ATTRIBUTE_UNUSED,
-                                     virConnectPtr conn,
-                                     remote_message_header *hdr ATTRIBUTE_UNUSED,
-                                     remote_error *rerr,
-                                     remote_storage_pool_list_volumes_args *args,
-                                     remote_storage_pool_list_volumes_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    int rv = -1;
-    int len;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
-        virNetError(VIR_ERR_INTERNAL_ERROR,
-                    "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
-        goto cleanup;
-    }
-
-    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
-        goto cleanup;
+    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
+        goto cleanup;
 
     /* Allocate return buffer. */
     if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
@@ -3917,89 +3265,6 @@ cleanup:
  *     STORAGE VOL APIS
  ***************************************************************/
 
-
-
-static int
-remoteDispatchStorageVolCreateXML(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_create_xml_args *args,
-                                  remote_storage_vol_create_xml_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    virStorageVolPtr vol = 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 (!(vol = virStorageVolCreateXML(pool, args->xml, args->flags)))
-        goto cleanup;
-
-    make_nonnull_storage_vol(&ret->vol, vol);
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    if (vol)
-        virStorageVolFree(vol);
-    return rv;
-}
-
-static int
-remoteDispatchStorageVolCreateXMLFrom(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_create_xml_from_args *args,
-                                      remote_storage_vol_create_xml_from_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    virStorageVolPtr clonevol = NULL;
-    virStorageVolPtr newvol = 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 (!(clonevol = get_nonnull_storage_vol(conn, args->clonevol)))
-        goto cleanup;
-
-    if (!(newvol = virStorageVolCreateXMLFrom(pool, args->xml, clonevol,
-                                              args->flags)))
-        goto cleanup;
-
-    make_nonnull_storage_vol(&ret->vol, newvol);
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (newvol)
-        virStorageVolFree(newvol);
-    if (clonevol)
-        virStorageVolFree(clonevol);
-    if (pool)
-        virStoragePoolFree(pool);
-    return rv;
-}
-
 static int
 remoteDispatchStorageVolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
                                 struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -4038,110 +3303,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchStorageVolLookupByName(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_lookup_by_name_args *args,
-                                     remote_storage_vol_lookup_by_name_ret *ret)
-{
-    virStoragePoolPtr pool = NULL;
-    virStorageVolPtr vol = 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 (!(vol = virStorageVolLookupByName(pool, args->name)))
-        goto cleanup;
-
-    make_nonnull_storage_vol(&ret->vol, vol);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (pool)
-        virStoragePoolFree(pool);
-    if (vol)
-        virStorageVolFree(vol);
-    return rv;
-}
-
-static int
-remoteDispatchStorageVolLookupByKey(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_lookup_by_key_args *args,
-                                    remote_storage_vol_lookup_by_key_ret *ret)
-{
-    virStorageVolPtr vol = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(vol = virStorageVolLookupByKey(conn, args->key)))
-        goto cleanup;
-
-    make_nonnull_storage_vol(&ret->vol, vol);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (vol)
-        virStorageVolFree(vol);
-    return rv;
-}
-
-
-static int
-remoteDispatchStorageVolLookupByPath(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_lookup_by_path_args *args,
-                                     remote_storage_vol_lookup_by_path_ret *ret)
-{
-    virStorageVolPtr vol = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(vol = virStorageVolLookupByPath(conn, args->path)))
-        goto cleanup;
-
-    make_nonnull_storage_vol(&ret->vol, vol);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (vol)
-        virStorageVolFree(vol);
-    return rv;
-}
-
-
 /***************************************************************
  *     NODE INFO APIS
  **************************************************************/
@@ -4222,39 +3383,6 @@ cleanup:
     return rv;
 }
 
-
-static int
-remoteDispatchNodeDeviceLookupByName(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_lookup_by_name_args *args,
-                                     remote_node_device_lookup_by_name_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;
-
-    make_nonnull_node_device(&ret->dev, dev);
-
-    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,
@@ -4332,57 +3460,25 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    /* Allocate return buffer. */
-    if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
-        virReportOOMError();
-        goto cleanup;
-    }
-
-    len = virNodeDeviceListCaps(dev, ret->names.names_val,
-                                args->maxnames);
-    if (len < 0)
-        goto cleanup;
-    ret->names.names_len = len;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0) {
-        remoteDispatchError(rerr);
-        VIR_FREE(ret->names.names_val);
-    }
-    if (dev)
-        virNodeDeviceFree(dev);
-    return rv;
-}
-
-static int
-remoteDispatchNodeDeviceCreateXML(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_create_xml_args *args,
-                                  remote_node_device_create_xml_ret *ret)
-{
-    virNodeDevicePtr dev = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags)))
+    /* Allocate return buffer. */
+    if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+        virReportOOMError();
         goto cleanup;
+    }
 
-    make_nonnull_node_device(&ret->dev, dev);
+    len = virNodeDeviceListCaps(dev, ret->names.names_val,
+                                args->maxnames);
+    if (len < 0)
+        goto cleanup;
+    ret->names.names_len = len;
 
     rv = 0;
 
 cleanup:
-    if (rv < 0)
+    if (rv < 0) {
         remoteDispatchError(rerr);
+        VIR_FREE(ret->names.names_val);
+    }
     if (dev)
         virNodeDeviceFree(dev);
     return rv;
@@ -4663,37 +3759,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchSecretDefineXML(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_define_xml_args *args,
-                              remote_secret_define_xml_ret *ret)
-{
-    virSecretPtr secret = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(secret = virSecretDefineXML(conn, args->xml, args->flags)))
-        goto cleanup;
-
-    make_nonnull_secret(&ret->secret, secret);
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
-    return rv;
-}
-
 static int
 remoteDispatchSecretGetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
                              struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -4732,70 +3797,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchSecretLookupByUUID(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_lookup_by_uuid_args *args,
-                                 remote_secret_lookup_by_uuid_ret *ret)
-{
-    virSecretPtr secret = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(secret = virSecretLookupByUUID(conn, (unsigned char *)args->uuid)))
-        goto cleanup;
-
-    make_nonnull_secret(&ret->secret, secret);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
-    return rv;
-}
-
-static int
-remoteDispatchSecretLookupByUsage(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_lookup_by_usage_args *args,
-                                  remote_secret_lookup_by_usage_ret *ret)
-{
-    virSecretPtr secret = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(secret = virSecretLookupByUsage(conn, args->usageType, args->usageID)))
-        goto cleanup;
-
-    make_nonnull_secret(&ret->secret, secret);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
-    return rv;
-}
-
 static int
 remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
                          struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -4907,44 +3908,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainSnapshotCreateXML(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_create_xml_args *args,
-                                      remote_domain_snapshot_create_xml_ret *ret)
-{
-    virDomainSnapshotPtr snapshot = NULL;
-    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 (!(snapshot = virDomainSnapshotCreateXML(dom, args->xml_desc, args->flags)))
-        goto cleanup;
-
-    make_nonnull_domain_snapshot(&ret->snap, snapshot);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (snapshot)
-        virDomainSnapshotFree(snapshot);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
 static int
 remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUSED,
                                       struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -4998,82 +3961,6 @@ cleanup:
     return rv;
 }
 
-static int
-remoteDispatchDomainSnapshotLookupByName(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_lookup_by_name_args *args,
-                                         remote_domain_snapshot_lookup_by_name_ret *ret)
-{
-    virDomainSnapshotPtr snapshot = NULL;
-    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 (!(snapshot = virDomainSnapshotLookupByName(dom, args->name, args->flags)))
-        goto cleanup;
-
-    make_nonnull_domain_snapshot(&ret->snap, snapshot);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (snapshot)
-        virDomainSnapshotFree(snapshot);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
-static int
-remoteDispatchDomainSnapshotCurrent(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_current_args *args,
-                                    remote_domain_snapshot_current_ret *ret)
-{
-    virDomainSnapshotPtr snapshot = NULL;
-    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 (!(snapshot = virDomainSnapshotCurrent(dom, args->flags)))
-        goto cleanup;
-
-    make_nonnull_domain_snapshot(&ret->snap, snapshot);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (snapshot)
-        virDomainSnapshotFree(snapshot);
-    if (dom)
-        virDomainFree(dom);
-    return rv;
-}
-
 static int
 remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUSED,
                                       struct qemud_client *client ATTRIBUTE_UNUSED,
@@ -5160,105 +4047,6 @@ cleanup:
     return rv;
 }
 
-
-
-static int
-remoteDispatchNWFilterLookupByName(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_lookup_by_name_args *args,
-                                   remote_nwfilter_lookup_by_name_ret *ret)
-{
-    virNWFilterPtr nwfilter = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(nwfilter = virNWFilterLookupByName(conn, args->name)))
-        goto cleanup;
-
-    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (nwfilter)
-        virNWFilterFree(nwfilter);
-    return rv;
-}
-
-static int
-remoteDispatchNWFilterLookupByUUID(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_lookup_by_uuid_args *args,
-                                   remote_nwfilter_lookup_by_uuid_ret *ret)
-{
-    virNWFilterPtr nwfilter = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(nwfilter = virNWFilterLookupByUUID(conn, (unsigned char *) args->uuid)))
-        goto cleanup;
-
-    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (nwfilter)
-        virNWFilterFree(nwfilter);
-    return rv;
-}
-
-
-static int
-remoteDispatchNWFilterDefineXML(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_define_xml_args *args,
-                                remote_nwfilter_define_xml_ret *ret)
-{
-    virNWFilterPtr nwfilter = NULL;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(nwfilter = virNWFilterDefineXML(conn, args->xml)))
-        goto cleanup;
-
-    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    if (nwfilter)
-        virNWFilterFree(nwfilter);
-    return rv;
-}
-
 static int
 remoteDispatchListNWFilters(struct qemud_server *server ATTRIBUTE_UNUSED,
                             struct qemud_client *client ATTRIBUTE_UNUSED,
index 0ae342da74769ee4e2c0031450c234bc9527c47d..0d35a9b24c76ede9dca8331717b15bf7a7b1a74b 100644 (file)
@@ -195,9 +195,69 @@ cleanup:
 
 /* remoteDispatchDomainCreateWithFlags has to be implemented manually */
 
-/* remoteDispatchDomainCreateXML has to be implemented manually */
+static int
+remoteDispatchDomainCreateXML(
+    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_create_xml_args *args,
+    remote_domain_create_xml_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dom = virDomainCreateXML(conn, args->xml_desc, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->dom, dom);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainDefineXML(
+    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_define_xml_args *args,
+    remote_domain_define_xml_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dom = virDomainDefineXML(conn, args->xml)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->dom, dom);
+    rv = 0;
 
-/* remoteDispatchDomainDefineXML has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
 
 static int
 remoteDispatchDomainDestroy(
@@ -725,11 +785,101 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchDomainLookupById has to be implemented manually */
+static int
+remoteDispatchDomainLookupByID(
+    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_lookup_by_id_args *args,
+    remote_domain_lookup_by_id_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dom = virDomainLookupByID(conn, args->id)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->dom, dom);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainLookupByName(
+    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_lookup_by_name_args *args,
+    remote_domain_lookup_by_name_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dom = virDomainLookupByName(conn, args->name)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->dom, dom);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainLookupByUUID(
+    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_lookup_by_uuid_args *args,
+    remote_domain_lookup_by_uuid_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dom = virDomainLookupByUUID(conn, (unsigned char *) args->uuid)) == NULL)
+        goto cleanup;
 
-/* remoteDispatchDomainLookupByName has to be implemented manually */
+    make_nonnull_domain(&ret->dom, dom);
+    rv = 0;
 
-/* remoteDispatchDomainLookupByUUID has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
 
 static int
 remoteDispatchDomainManagedSave(
@@ -803,9 +953,69 @@ cleanup:
 
 /* remoteDispatchDomainMemoryStats has to be implemented manually */
 
-/* remoteDispatchDomainMigrateFinish has to be implemented manually */
+static int
+remoteDispatchDomainMigrateFinish(
+    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_migrate_finish_args *args,
+    remote_domain_migrate_finish_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr ddom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((ddom = virDomainMigrateFinish(conn, args->dname, args->cookie.cookie_val, args->cookie.cookie_len, args->uri, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->ddom, ddom);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (ddom)
+        virDomainFree(ddom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainMigrateFinish2(
+    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_migrate_finish2_args *args,
+    remote_domain_migrate_finish2_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr ddom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((ddom = virDomainMigrateFinish2(conn, args->dname, args->cookie.cookie_val, args->cookie.cookie_len, args->uri, args->flags, args->retcode)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain(&ret->ddom, ddom);
+    rv = 0;
 
-/* remoteDispatchDomainMigrateFinish2 has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (ddom)
+        virDomainFree(ddom);
+    return rv;
+}
 
 /* remoteDispatchDomainMigratePerform has to be implemented manually */
 
@@ -1301,9 +1511,81 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchDomainSnapshotCreateXML has to be implemented manually */
+static int
+remoteDispatchDomainSnapshotCreateXML(
+    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_create_xml_args *args,
+    remote_domain_snapshot_create_xml_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainSnapshotPtr snap = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if ((snap = virDomainSnapshotCreateXML(dom, args->xml_desc, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain_snapshot(&ret->snap, snap);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    if (snap)
+        virDomainSnapshotFree(snap);
+    return rv;
+}
+
+static int
+remoteDispatchDomainSnapshotCurrent(
+    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_current_args *args,
+    remote_domain_snapshot_current_ret *ret)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+    virDomainSnapshotPtr snap = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if ((snap = virDomainSnapshotCurrent(dom, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_domain_snapshot(&ret->snap, snap);
+    rv = 0;
 
-/* remoteDispatchDomainSnapshotCurrent has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    if (snap)
+        virDomainSnapshotFree(snap);
+    return rv;
+}
 
 static int
 remoteDispatchDomainSnapshotDelete(
@@ -1389,21 +1671,19 @@ cleanup:
 
 /* remoteDispatchDomainSnapshotListNames has to be implemented manually */
 
-/* remoteDispatchDomainSnapshotLookupByName has to be implemented manually */
-
 static int
-remoteDispatchDomainSnapshotNum(
+remoteDispatchDomainSnapshotLookupByName(
     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)
+    remote_domain_snapshot_lookup_by_name_args *args,
+    remote_domain_snapshot_lookup_by_name_ret *ret)
 {
     int rv = -1;
     virDomainPtr dom = NULL;
-    int num;
+    virDomainSnapshotPtr snap = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -1413,10 +1693,10 @@ remoteDispatchDomainSnapshotNum(
     if (!(dom = get_nonnull_domain(conn, args->dom)))
         goto cleanup;
 
-    if ((num = virDomainSnapshotNum(dom, args->flags)) < 0)
+    if ((snap = virDomainSnapshotLookupByName(dom, args->name, args->flags)) == NULL)
         goto cleanup;
 
-    ret->num = num;
+    make_nonnull_domain_snapshot(&ret->snap, snap);
     rv = 0;
 
 cleanup:
@@ -1424,21 +1704,24 @@ cleanup:
         remoteDispatchError(rerr);
     if (dom)
         virDomainFree(dom);
+    if (snap)
+        virDomainSnapshotFree(snap);
     return rv;
 }
 
 static int
-remoteDispatchDomainSuspend(
+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_suspend_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    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"));
@@ -1448,9 +1731,10 @@ remoteDispatchDomainSuspend(
     if (!(dom = get_nonnull_domain(conn, args->dom)))
         goto cleanup;
 
-    if (virDomainSuspend(dom) < 0)
+    if ((num = virDomainSnapshotNum(dom, args->flags)) < 0)
         goto cleanup;
 
+    ret->num = num;
     rv = 0;
 
 cleanup:
@@ -1462,13 +1746,13 @@ cleanup:
 }
 
 static int
-remoteDispatchDomainUndefine(
+remoteDispatchDomainSuspend(
     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_undefine_args *args,
+    remote_domain_suspend_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
@@ -1482,7 +1766,41 @@ remoteDispatchDomainUndefine(
     if (!(dom = get_nonnull_domain(conn, args->dom)))
         goto cleanup;
 
-    if (virDomainUndefine(dom) < 0)
+    if (virDomainSuspend(dom) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
+remoteDispatchDomainUndefine(
+    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_undefine_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virDomainPtr dom = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainUndefine(dom) < 0)
         goto cleanup;
 
     rv = 0;
@@ -1809,7 +2127,37 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchInterfaceDefineXML has to be implemented manually */
+static int
+remoteDispatchInterfaceDefineXML(
+    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_define_xml_args *args,
+    remote_interface_define_xml_ret *ret)
+{
+    int rv = -1;
+    virInterfacePtr iface = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((iface = virInterfaceDefineXML(conn, args->xml, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_interface(&ret->iface, iface);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (iface)
+        virInterfaceFree(iface);
+    return rv;
+}
 
 static int
 remoteDispatchInterfaceDestroy(
@@ -1917,9 +2265,69 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchInterfaceLookupByMacString has to be implemented manually */
+static int
+remoteDispatchInterfaceLookupByMACString(
+    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_lookup_by_mac_string_args *args,
+    remote_interface_lookup_by_mac_string_ret *ret)
+{
+    int rv = -1;
+    virInterfacePtr iface = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((iface = virInterfaceLookupByMACString(conn, args->mac)) == NULL)
+        goto cleanup;
+
+    make_nonnull_interface(&ret->iface, iface);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (iface)
+        virInterfaceFree(iface);
+    return rv;
+}
+
+static int
+remoteDispatchInterfaceLookupByName(
+    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_lookup_by_name_args *args,
+    remote_interface_lookup_by_name_ret *ret)
+{
+    int rv = -1;
+    virInterfacePtr iface = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((iface = virInterfaceLookupByName(conn, args->name)) == NULL)
+        goto cleanup;
+
+    make_nonnull_interface(&ret->iface, iface);
+    rv = 0;
 
-/* remoteDispatchInterfaceLookupByName has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (iface)
+        virInterfaceFree(iface);
+    return rv;
+}
 
 static int
 remoteDispatchInterfaceUndefine(
@@ -2039,9 +2447,69 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNetworkCreateXML has to be implemented manually */
+static int
+remoteDispatchNetworkCreateXML(
+    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_create_xml_args *args,
+    remote_network_create_xml_ret *ret)
+{
+    int rv = -1;
+    virNetworkPtr net = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((net = virNetworkCreateXML(conn, args->xml)) == NULL)
+        goto cleanup;
+
+    make_nonnull_network(&ret->net, net);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (net)
+        virNetworkFree(net);
+    return rv;
+}
+
+static int
+remoteDispatchNetworkDefineXML(
+    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_define_xml_args *args,
+    remote_network_define_xml_ret *ret)
+{
+    int rv = -1;
+    virNetworkPtr net = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((net = virNetworkDefineXML(conn, args->xml)) == NULL)
+        goto cleanup;
+
+    make_nonnull_network(&ret->net, net);
+    rv = 0;
 
-/* remoteDispatchNetworkDefineXML has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (net)
+        virNetworkFree(net);
+    return rv;
+}
 
 static int
 remoteDispatchNetworkDestroy(
@@ -2257,19 +2725,15 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNetworkLookupByName has to be implemented manually */
-
-/* remoteDispatchNetworkLookupByUUID has to be implemented manually */
-
 static int
-remoteDispatchNetworkSetAutostart(
+remoteDispatchNetworkLookupByName(
     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_set_autostart_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_network_lookup_by_name_args *args,
+    remote_network_lookup_by_name_ret *ret)
 {
     int rv = -1;
     virNetworkPtr net = NULL;
@@ -2279,12 +2743,10 @@ remoteDispatchNetworkSetAutostart(
         goto cleanup;
     }
 
-    if (!(net = get_nonnull_network(conn, args->net)))
-        goto cleanup;
-
-    if (virNetworkSetAutostart(net, args->autostart) < 0)
+    if ((net = virNetworkLookupByName(conn, args->name)) == NULL)
         goto cleanup;
 
+    make_nonnull_network(&ret->net, net);
     rv = 0;
 
 cleanup:
@@ -2296,14 +2758,14 @@ cleanup:
 }
 
 static int
-remoteDispatchNetworkUndefine(
+remoteDispatchNetworkLookupByUUID(
     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_undefine_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_network_lookup_by_uuid_args *args,
+    remote_network_lookup_by_uuid_ret *ret)
 {
     int rv = -1;
     virNetworkPtr net = NULL;
@@ -2313,12 +2775,10 @@ remoteDispatchNetworkUndefine(
         goto cleanup;
     }
 
-    if (!(net = get_nonnull_network(conn, args->net)))
-        goto cleanup;
-
-    if (virNetworkUndefine(net) < 0)
+    if ((net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid)) == NULL)
         goto cleanup;
 
+    make_nonnull_network(&ret->net, net);
     rv = 0;
 
 cleanup:
@@ -2329,30 +2789,28 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNodeDeviceCreateXML has to be implemented manually */
-
 static int
-remoteDispatchNodeDeviceDestroy(
+remoteDispatchNetworkSetAutostart(
     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_destroy_args *args,
+    remote_network_set_autostart_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
-    virNodeDevicePtr dev = NULL;
+    virNetworkPtr net = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+    if (!(net = get_nonnull_network(conn, args->net)))
         goto cleanup;
 
-    if (virNodeDeviceDestroy(dev) < 0)
+    if (virNetworkSetAutostart(net, args->autostart) < 0)
         goto cleanup;
 
     rv = 0;
@@ -2360,33 +2818,33 @@ remoteDispatchNodeDeviceDestroy(
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
-    if (dev)
-        virNodeDeviceFree(dev);
+    if (net)
+        virNetworkFree(net);
     return rv;
 }
 
 static int
-remoteDispatchNodeDeviceDettach(
+remoteDispatchNetworkUndefine(
     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_dettach_args *args,
+    remote_network_undefine_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
-    virNodeDevicePtr dev = NULL;
+    virNetworkPtr net = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+    if (!(net = get_nonnull_network(conn, args->net)))
         goto cleanup;
 
-    if (virNodeDeviceDettach(dev) < 0)
+    if (virNetworkUndefine(net) < 0)
         goto cleanup;
 
     rv = 0;
@@ -2394,37 +2852,33 @@ remoteDispatchNodeDeviceDettach(
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
-    if (dev)
-        virNodeDeviceFree(dev);
+    if (net)
+        virNetworkFree(net);
     return rv;
 }
 
 static int
-remoteDispatchNodeDeviceDumpXML(
+remoteDispatchNodeDeviceCreateXML(
     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)
+    remote_node_device_create_xml_args *args,
+    remote_node_device_create_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)
+    if ((dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags)) == NULL)
         goto cleanup;
 
-    ret->xml = xml;
+    make_nonnull_node_device(&ret->dev, dev);
     rv = 0;
 
 cleanup:
@@ -2435,25 +2889,18 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNodeDeviceGetParent has to be implemented manually */
-
-/* remoteDispatchNodeDeviceListCaps has to be implemented manually */
-
-/* remoteDispatchNodeDeviceLookupByName has to be implemented manually */
-
 static int
-remoteDispatchNodeDeviceNumOfCaps(
+remoteDispatchNodeDeviceDestroy(
     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)
+    remote_node_device_destroy_args *args,
+    void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
     virNodeDevicePtr dev = NULL;
-    int num;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -2463,10 +2910,9 @@ remoteDispatchNodeDeviceNumOfCaps(
     if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
         goto cleanup;
 
-    if ((num = virNodeDeviceNumOfCaps(dev)) < 0)
+    if (virNodeDeviceDestroy(dev) < 0)
         goto cleanup;
 
-    ret->num = num;
     rv = 0;
 
 cleanup:
@@ -2478,13 +2924,13 @@ cleanup:
 }
 
 static int
-remoteDispatchNodeDeviceReAttach(
+remoteDispatchNodeDeviceDettach(
     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_re_attach_args *args,
+    remote_node_device_dettach_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
@@ -2498,7 +2944,7 @@ remoteDispatchNodeDeviceReAttach(
     if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
         goto cleanup;
 
-    if (virNodeDeviceReAttach(dev) < 0)
+    if (virNodeDeviceDettach(dev) < 0)
         goto cleanup;
 
     rv = 0;
@@ -2512,17 +2958,18 @@ cleanup:
 }
 
 static int
-remoteDispatchNodeDeviceReset(
+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_reset_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    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"));
@@ -2532,9 +2979,10 @@ remoteDispatchNodeDeviceReset(
     if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
         goto cleanup;
 
-    if (virNodeDeviceReset(dev) < 0)
+    if ((xml = virNodeDeviceGetXMLDesc(dev, args->flags)) == NULL)
         goto cleanup;
 
+    ret->xml = xml;
     rv = 0;
 
 cleanup:
@@ -2545,13 +2993,181 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNodeGetCellsFreeMemory has to be implemented manually */
-
-/* remoteDispatchNodeGetFreeMemory has to be implemented manually */
+/* remoteDispatchNodeDeviceGetParent has to be implemented manually */
 
-/* remoteDispatchNodeGetInfo has to be implemented manually */
+/* remoteDispatchNodeDeviceListCaps has to be implemented manually */
 
-/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
+static int
+remoteDispatchNodeDeviceLookupByName(
+    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_lookup_by_name_args *args,
+    remote_node_device_lookup_by_name_ret *ret)
+{
+    int rv = -1;
+    virNodeDevicePtr dev = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((dev = virNodeDeviceLookupByName(conn, args->name)) == NULL)
+        goto cleanup;
+
+    make_nonnull_node_device(&ret->dev, dev);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dev)
+        virNodeDeviceFree(dev);
+    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)
+{
+    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(
+    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_re_attach_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virNodeDevicePtr dev = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+        goto cleanup;
+
+    if (virNodeDeviceReAttach(dev) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dev)
+        virNodeDeviceFree(dev);
+    return rv;
+}
+
+static int
+remoteDispatchNodeDeviceReset(
+    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_reset_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virNodeDevicePtr dev = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
+        goto cleanup;
+
+    if (virNodeDeviceReset(dev) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dev)
+        virNodeDeviceFree(dev);
+    return rv;
+}
+
+/* remoteDispatchNodeGetCellsFreeMemory has to be implemented manually */
+
+static int
+remoteDispatchNodeGetFreeMemory(
+    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_node_get_free_memory_ret *ret)
+{
+    int rv = -1;
+    unsigned long freeMem;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((freeMem = virNodeGetFreeMemory(conn)) == 0)
+        goto cleanup;
+
+    ret->freeMem = freeMem;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    return rv;
+}
+
+/* remoteDispatchNodeGetInfo has to be implemented manually */
+
+/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
 
 /* remoteDispatchNodeListDevices has to be implemented manually */
 
@@ -2857,7 +3473,37 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNWFilterDefineXML has to be implemented manually */
+static int
+remoteDispatchNWFilterDefineXML(
+    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_define_xml_args *args,
+    remote_nwfilter_define_xml_ret *ret)
+{
+    int rv = -1;
+    virNWFilterPtr nwfilter = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((nwfilter = virNWFilterDefineXML(conn, args->xml)) == NULL)
+        goto cleanup;
+
+    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (nwfilter)
+        virNWFilterFree(nwfilter);
+    return rv;
+}
 
 static int
 remoteDispatchNWFilterGetXMLDesc(
@@ -2895,9 +3541,69 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchNWFilterLookupByName has to be implemented manually */
+static int
+remoteDispatchNWFilterLookupByName(
+    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_lookup_by_name_args *args,
+    remote_nwfilter_lookup_by_name_ret *ret)
+{
+    int rv = -1;
+    virNWFilterPtr nwfilter = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((nwfilter = virNWFilterLookupByName(conn, args->name)) == NULL)
+        goto cleanup;
+
+    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (nwfilter)
+        virNWFilterFree(nwfilter);
+    return rv;
+}
+
+static int
+remoteDispatchNWFilterLookupByUUID(
+    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_lookup_by_uuid_args *args,
+    remote_nwfilter_lookup_by_uuid_ret *ret)
+{
+    int rv = -1;
+    virNWFilterPtr nwfilter = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((nwfilter = virNWFilterLookupByUUID(conn, (unsigned char *) args->uuid)) == NULL)
+        goto cleanup;
+
+    make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
+    rv = 0;
 
-/* remoteDispatchNWFilterLookupByUUID has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (nwfilter)
+        virNWFilterFree(nwfilter);
+    return rv;
+}
 
 static int
 remoteDispatchNWFilterUndefine(
@@ -2935,72 +3641,396 @@ cleanup:
 
 /* remoteDispatchOpen has to be implemented manually */
 
-/* remoteDispatchSecretDefineXML has to be implemented manually */
-
-/* remoteDispatchSecretGetValue has to be implemented manually */
-
 static int
-remoteDispatchSecretGetXMLDesc(
+remoteDispatchSecretDefineXML(
     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)
+    remote_secret_define_xml_args *args,
+    remote_secret_define_xml_ret *ret)
+{
+    int rv = -1;
+    virSecretPtr secret = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((secret = virSecretDefineXML(conn, args->xml, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_secret(&ret->secret, secret);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (secret)
+        virSecretFree(secret);
+    return rv;
+}
+
+/* remoteDispatchSecretGetValue 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;
+}
+
+static int
+remoteDispatchSecretLookupByUsage(
+    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_lookup_by_usage_args *args,
+    remote_secret_lookup_by_usage_ret *ret)
+{
+    int rv = -1;
+    virSecretPtr secret = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((secret = virSecretLookupByUsage(conn, args->usageType, args->usageID)) == NULL)
+        goto cleanup;
+
+    make_nonnull_secret(&ret->secret, secret);
+    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,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_secret_lookup_by_uuid_args *args,
+    remote_secret_lookup_by_uuid_ret *ret)
+{
+    int rv = -1;
+    virSecretPtr secret = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((secret = virSecretLookupByUUID(conn, (unsigned char *) args->uuid)) == NULL)
+        goto cleanup;
+
+    make_nonnull_secret(&ret->secret, secret);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (secret)
+        virSecretFree(secret);
+    return rv;
+}
+
+static int
+remoteDispatchSecretSetValue(
+    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_set_value_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virSecretPtr secret = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(secret = get_nonnull_secret(conn, args->secret)))
+        goto cleanup;
+
+    if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val, args->value.value_len, args->flags) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (secret)
+        virSecretFree(secret);
+    return rv;
+}
+
+static int
+remoteDispatchSecretUndefine(
+    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_undefine_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virSecretPtr secret = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (!(secret = get_nonnull_secret(conn, args->secret)))
+        goto cleanup;
+
+    if (virSecretUndefine(secret) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (secret)
+        virSecretFree(secret);
+    return rv;
+}
+
+static int
+remoteDispatchStoragePoolBuild(
+    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_build_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+
+    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 (virStoragePoolBuild(pool, args->flags) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    return rv;
+}
+
+static int
+remoteDispatchStoragePoolCreate(
+    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_create_args *args,
+    void *ret ATTRIBUTE_UNUSED)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+
+    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 (virStoragePoolCreate(pool, args->flags) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    return rv;
+}
+
+static int
+remoteDispatchStoragePoolCreateXML(
+    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_create_xml_args *args,
+    remote_storage_pool_create_xml_ret *ret)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((pool = virStoragePoolCreateXML(conn, args->xml, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_storage_pool(&ret->pool, pool);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    return rv;
+}
+
+static int
+remoteDispatchStoragePoolDefineXML(
+    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_define_xml_args *args,
+    remote_storage_pool_define_xml_ret *ret)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((pool = virStoragePoolDefineXML(conn, args->xml, args->flags)) == NULL)
+        goto cleanup;
+
+    make_nonnull_storage_pool(&ret->pool, pool);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    return rv;
+}
+
+static int
+remoteDispatchStoragePoolDelete(
+    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_delete_args *args,
+    void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
-    virSecretPtr secret = NULL;
-    char *xml;
+    virStoragePoolPtr pool = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(secret = get_nonnull_secret(conn, args->secret)))
+    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if ((xml = virSecretGetXMLDesc(secret, args->flags)) == NULL)
+    if (virStoragePoolDelete(pool, args->flags) < 0)
         goto cleanup;
 
-    ret->xml = xml;
     rv = 0;
 
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
+    if (pool)
+        virStoragePoolFree(pool);
     return rv;
 }
 
-/* remoteDispatchSecretLookupByUsage has to be implemented manually */
-
-/* remoteDispatchSecretLookupByUUID has to be implemented manually */
-
 static int
-remoteDispatchSecretSetValue(
+remoteDispatchStoragePoolDestroy(
     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_set_value_args *args,
+    remote_storage_pool_destroy_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
-    virSecretPtr secret = NULL;
+    virStoragePoolPtr pool = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(secret = get_nonnull_secret(conn, args->secret)))
+    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val, args->value.value_len, args->flags) < 0)
+    if (virStoragePoolDestroy(pool) < 0)
         goto cleanup;
 
     rv = 0;
@@ -3008,57 +4038,60 @@ remoteDispatchSecretSetValue(
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
+    if (pool)
+        virStoragePoolFree(pool);
     return rv;
 }
 
 static int
-remoteDispatchSecretUndefine(
+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_secret_undefine_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_storage_pool_dump_xml_args *args,
+    remote_storage_pool_dump_xml_ret *ret)
 {
     int rv = -1;
-    virSecretPtr secret = NULL;
+    virStoragePoolPtr pool = NULL;
+    char *xml;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
         goto cleanup;
     }
 
-    if (!(secret = get_nonnull_secret(conn, args->secret)))
+    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virSecretUndefine(secret) < 0)
+    if ((xml = virStoragePoolGetXMLDesc(pool, args->flags)) == NULL)
         goto cleanup;
 
+    ret->xml = xml;
     rv = 0;
 
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
-    if (secret)
-        virSecretFree(secret);
+    if (pool)
+        virStoragePoolFree(pool);
     return rv;
 }
 
 static int
-remoteDispatchStoragePoolBuild(
+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_build_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    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"));
@@ -3068,9 +4101,10 @@ remoteDispatchStoragePoolBuild(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolBuild(pool, args->flags) < 0)
+    if (virStoragePoolGetAutostart(pool, &autostart) < 0)
         goto cleanup;
 
+    ret->autostart = autostart;
     rv = 0;
 
 cleanup:
@@ -3081,18 +4115,21 @@ cleanup:
     return rv;
 }
 
+/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
+
 static int
-remoteDispatchStoragePoolCreate(
+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_create_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    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"));
@@ -3102,9 +4139,10 @@ remoteDispatchStoragePoolCreate(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolCreate(pool, args->flags) < 0)
+    if ((active = virStoragePoolIsActive(pool)) < 0)
         goto cleanup;
 
+    ret->active = active;
     rv = 0;
 
 cleanup:
@@ -3115,22 +4153,19 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchStoragePoolCreateXML has to be implemented manually */
-
-/* remoteDispatchStoragePoolDefineXML has to be implemented manually */
-
 static int
-remoteDispatchStoragePoolDelete(
+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_delete_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    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"));
@@ -3140,9 +4175,10 @@ remoteDispatchStoragePoolDelete(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolDelete(pool, args->flags) < 0)
+    if ((persistent = virStoragePoolIsPersistent(pool)) < 0)
         goto cleanup;
 
+    ret->persistent = persistent;
     rv = 0;
 
 cleanup:
@@ -3153,15 +4189,17 @@ cleanup:
     return rv;
 }
 
+/* remoteDispatchStoragePoolListVolumes has to be implemented manually */
+
 static int
-remoteDispatchStoragePoolDestroy(
+remoteDispatchStoragePoolLookupByName(
     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_destroy_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_storage_pool_lookup_by_name_args *args,
+    remote_storage_pool_lookup_by_name_ret *ret)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
@@ -3171,12 +4209,10 @@ remoteDispatchStoragePoolDestroy(
         goto cleanup;
     }
 
-    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
-        goto cleanup;
-
-    if (virStoragePoolDestroy(pool) < 0)
+    if ((pool = virStoragePoolLookupByName(conn, args->name)) == NULL)
         goto cleanup;
 
+    make_nonnull_storage_pool(&ret->pool, pool);
     rv = 0;
 
 cleanup:
@@ -3188,31 +4224,27 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolDumpXML(
+remoteDispatchStoragePoolLookupByUUID(
     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)
+    remote_storage_pool_lookup_by_uuid_args *args,
+    remote_storage_pool_lookup_by_uuid_ret *ret)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
-    char *xml;
 
     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)
+    if ((pool = virStoragePoolLookupByUUID(conn, (unsigned char *) args->uuid)) == NULL)
         goto cleanup;
 
-    ret->xml = xml;
+    make_nonnull_storage_pool(&ret->pool, pool);
     rv = 0;
 
 cleanup:
@@ -3224,56 +4256,56 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolGetAutostart(
+remoteDispatchStoragePoolLookupByVolume(
     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)
+    remote_storage_pool_lookup_by_volume_args *args,
+    remote_storage_pool_lookup_by_volume_ret *ret)
 {
     int rv = -1;
+    virStorageVolPtr vol = NULL;
     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)))
+    if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
         goto cleanup;
 
-    if (virStoragePoolGetAutostart(pool, &autostart) < 0)
+    if ((pool = virStoragePoolLookupByVolume(vol)) == NULL)
         goto cleanup;
 
-    ret->autostart = autostart;
+    make_nonnull_storage_pool(&ret->pool, pool);
     rv = 0;
 
 cleanup:
     if (rv < 0)
         remoteDispatchError(rerr);
+    if (vol)
+        virStorageVolFree(vol);
     if (pool)
         virStoragePoolFree(pool);
     return rv;
 }
 
-/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
-
 static int
-remoteDispatchStoragePoolIsActive(
+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_is_active_args *args,
-    remote_storage_pool_is_active_ret *ret)
+    remote_storage_pool_num_of_volumes_args *args,
+    remote_storage_pool_num_of_volumes_ret *ret)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
-    int active;
+    int num;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -3283,10 +4315,10 @@ remoteDispatchStoragePoolIsActive(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if ((active = virStoragePoolIsActive(pool)) < 0)
+    if ((num = virStoragePoolNumOfVolumes(pool)) < 0)
         goto cleanup;
 
-    ret->active = active;
+    ret->num = num;
     rv = 0;
 
 cleanup:
@@ -3298,18 +4330,17 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolIsPersistent(
+remoteDispatchStoragePoolRefresh(
     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)
+    remote_storage_pool_refresh_args *args,
+    void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
-    int persistent;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -3319,10 +4350,9 @@ remoteDispatchStoragePoolIsPersistent(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if ((persistent = virStoragePoolIsPersistent(pool)) < 0)
+    if (virStoragePoolRefresh(pool, args->flags) < 0)
         goto cleanup;
 
-    ret->persistent = persistent;
     rv = 0;
 
 cleanup:
@@ -3333,27 +4363,18 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchStoragePoolListVolumes has to be implemented manually */
-
-/* remoteDispatchStoragePoolLookupByName has to be implemented manually */
-
-/* remoteDispatchStoragePoolLookupByUUID has to be implemented manually */
-
-/* remoteDispatchStoragePoolLookupByVolume has to be implemented manually */
-
 static int
-remoteDispatchStoragePoolNumOfVolumes(
+remoteDispatchStoragePoolSetAutostart(
     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)
+    remote_storage_pool_set_autostart_args *args,
+    void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
-    int num;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -3363,10 +4384,9 @@ remoteDispatchStoragePoolNumOfVolumes(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if ((num = virStoragePoolNumOfVolumes(pool)) < 0)
+    if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
         goto cleanup;
 
-    ret->num = num;
     rv = 0;
 
 cleanup:
@@ -3378,13 +4398,13 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolRefresh(
+remoteDispatchStoragePoolUndefine(
     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_refresh_args *args,
+    remote_storage_pool_undefine_args *args,
     void *ret ATTRIBUTE_UNUSED)
 {
     int rv = -1;
@@ -3398,7 +4418,7 @@ remoteDispatchStoragePoolRefresh(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolRefresh(pool, args->flags) < 0)
+    if (virStoragePoolUndefine(pool) < 0)
         goto cleanup;
 
     rv = 0;
@@ -3412,17 +4432,18 @@ cleanup:
 }
 
 static int
-remoteDispatchStoragePoolSetAutostart(
+remoteDispatchStorageVolCreateXML(
     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_set_autostart_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_storage_vol_create_xml_args *args,
+    remote_storage_vol_create_xml_ret *ret)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
+    virStorageVolPtr vol = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -3432,9 +4453,10 @@ remoteDispatchStoragePoolSetAutostart(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
+    if ((vol = virStorageVolCreateXML(pool, args->xml, args->flags)) == NULL)
         goto cleanup;
 
+    make_nonnull_storage_vol(&ret->vol, vol);
     rv = 0;
 
 cleanup:
@@ -3442,21 +4464,25 @@ cleanup:
         remoteDispatchError(rerr);
     if (pool)
         virStoragePoolFree(pool);
+    if (vol)
+        virStorageVolFree(vol);
     return rv;
 }
 
 static int
-remoteDispatchStoragePoolUndefine(
+remoteDispatchStorageVolCreateXMLFrom(
     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_undefine_args *args,
-    void *ret ATTRIBUTE_UNUSED)
+    remote_storage_vol_create_xml_from_args *args,
+    remote_storage_vol_create_xml_from_ret *ret)
 {
     int rv = -1;
     virStoragePoolPtr pool = NULL;
+    virStorageVolPtr clonevol = NULL;
+    virStorageVolPtr vol = NULL;
 
     if (!conn) {
         virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
@@ -3466,9 +4492,13 @@ remoteDispatchStoragePoolUndefine(
     if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
         goto cleanup;
 
-    if (virStoragePoolUndefine(pool) < 0)
+    if (!(clonevol = get_nonnull_storage_vol(conn, args->clonevol)))
+        goto cleanup;
+
+    if ((vol = virStorageVolCreateXMLFrom(pool, args->xml, clonevol, args->flags)) == NULL)
         goto cleanup;
 
+    make_nonnull_storage_vol(&ret->vol, vol);
     rv = 0;
 
 cleanup:
@@ -3476,13 +4506,13 @@ cleanup:
         remoteDispatchError(rerr);
     if (pool)
         virStoragePoolFree(pool);
+    if (clonevol)
+        virStorageVolFree(clonevol);
+    if (vol)
+        virStorageVolFree(vol);
     return rv;
 }
 
-/* remoteDispatchStorageVolCreateXML has to be implemented manually */
-
-/* remoteDispatchStorageVolCreateXMLFrom has to be implemented manually */
-
 static int
 remoteDispatchStorageVolDelete(
     struct qemud_server *server ATTRIBUTE_UNUSED,
@@ -3593,11 +4623,107 @@ cleanup:
     return rv;
 }
 
-/* remoteDispatchStorageVolLookupByKey has to be implemented manually */
+static int
+remoteDispatchStorageVolLookupByKey(
+    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_lookup_by_key_args *args,
+    remote_storage_vol_lookup_by_key_ret *ret)
+{
+    int rv = -1;
+    virStorageVolPtr vol = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((vol = virStorageVolLookupByKey(conn, args->key)) == NULL)
+        goto cleanup;
+
+    make_nonnull_storage_vol(&ret->vol, vol);
+    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,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_storage_vol_lookup_by_name_args *args,
+    remote_storage_vol_lookup_by_name_ret *ret)
+{
+    int rv = -1;
+    virStoragePoolPtr pool = NULL;
+    virStorageVolPtr vol = NULL;
+
+    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 ((vol = virStorageVolLookupByName(pool, args->name)) == NULL)
+        goto cleanup;
+
+    make_nonnull_storage_vol(&ret->vol, vol);
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (pool)
+        virStoragePoolFree(pool);
+    if (vol)
+        virStorageVolFree(vol);
+    return rv;
+}
+
+static int
+remoteDispatchStorageVolLookupByPath(
+    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_lookup_by_path_args *args,
+    remote_storage_vol_lookup_by_path_ret *ret)
+{
+    int rv = -1;
+    virStorageVolPtr vol = NULL;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((vol = virStorageVolLookupByPath(conn, args->path)) == NULL)
+        goto cleanup;
 
-/* remoteDispatchStorageVolLookupByName has to be implemented manually */
+    make_nonnull_storage_vol(&ret->vol, vol);
+    rv = 0;
 
-/* remoteDispatchStorageVolLookupByPath has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (vol)
+        virStorageVolFree(vol);
+    return rv;
+}
 
 /* remoteDispatchStorageVolUpload has to be implemented manually */
 
index dff84d7bd73292909a94cd3e5babd746b84432fd..1e3be4806a7d6a9bc69ea8d1e3111ac6c6a961fb 100644 (file)
@@ -370,7 +370,7 @@ static int remoteDispatchDomainIsUpdated(
     remote_error *rerr,
     remote_domain_is_updated_args *args,
     remote_domain_is_updated_ret *ret);
-static int remoteDispatchDomainLookupById(
+static int remoteDispatchDomainLookupByID(
     struct qemud_server *server,
     struct qemud_client *client,
     virConnectPtr conn,
@@ -834,7 +834,7 @@ static int remoteDispatchInterfaceIsActive(
     remote_error *rerr,
     remote_interface_is_active_args *args,
     remote_interface_is_active_ret *ret);
-static int remoteDispatchInterfaceLookupByMacString(
+static int remoteDispatchInterfaceLookupByMACString(
     struct qemud_server *server,
     struct qemud_client *client,
     virConnectPtr conn,
index 627331e6e9eef99dc23cdc8447624b462be182c1..357d1de0cad79a0ef15d53ce84027d97805ff97f 100644 (file)
     .args_filter = (xdrproc_t) xdr_remote_list_defined_domains_args,
     .ret_filter = (xdrproc_t) xdr_remote_list_defined_domains_ret,
 },
-{   /* DomainLookupById => 22 */
-    .fn = (dispatch_fn) remoteDispatchDomainLookupById,
+{   /* DomainLookupByID => 22 */
+    .fn = (dispatch_fn) remoteDispatchDomainLookupByID,
     .args_filter = (xdrproc_t) xdr_remote_domain_lookup_by_id_args,
     .ret_filter = (xdrproc_t) xdr_remote_domain_lookup_by_id_ret,
 },
     .args_filter = (xdrproc_t) xdr_remote_interface_lookup_by_name_args,
     .ret_filter = (xdrproc_t) xdr_remote_interface_lookup_by_name_ret,
 },
-{   /* InterfaceLookupByMacString => 129 */
-    .fn = (dispatch_fn) remoteDispatchInterfaceLookupByMacString,
+{   /* InterfaceLookupByMACString => 129 */
+    .fn = (dispatch_fn) remoteDispatchInterfaceLookupByMACString,
     .args_filter = (xdrproc_t) xdr_remote_interface_lookup_by_mac_string_args,
     .ret_filter = (xdrproc_t) xdr_remote_interface_lookup_by_mac_string_ret,
 },
index 3fd3f970c4eac81d776617963443b57144b38db0..9621db5154e408b69cecf55fdf01198a9e95cf6f 100755 (executable)
@@ -33,7 +33,8 @@ sub name_to_ProcName {
     my @elems = split /_/, $name;
     @elems = map ucfirst, @elems;
     @elems = map { $_ =~ s/Nwfilter/NWFilter/; $_ =~ s/Xml/XML/;
-                   $_ =~ s/Uri/URI/; $_ =~ s/Uuid/UUID/; $_ } @elems;
+                   $_ =~ s/Uri/URI/; $_ =~ s/Uuid/UUID/; $_ =~ s/Id/ID/;
+                   $_ =~ s/Mac/MAC/; $_ } @elems;
     join "", @elems
 }
 
@@ -262,8 +263,6 @@ elsif ($opt_b) {
                           "DomainBlockPeek",
                           "DomainBlockStats",
                           "DomainCreateWithFlags",
-                          "DomainCreateXML",
-                          "DomainDefineXML",
                           "DomainEventsDeregister",
                           "DomainEventsRegister",
                           "DomainGetBlkioParameters",
@@ -276,25 +275,14 @@ elsif ($opt_b) {
                           "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",
@@ -305,40 +293,17 @@ elsif ($opt_b) {
                           "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");
+                          "StorageVolGetInfo");
     } elsif ($structprefix eq "qemu") {
         @ungeneratable = ("MonitorCommand");
     }
@@ -350,7 +315,6 @@ elsif ($opt_b) {
         # skip things which are REMOTE_MESSAGE
         next if $calls{$_}->{msg};
 
-        # FIXME: skip functions with explicit return value for now
         if (exists($ug{$calls{$_}->{ProcName}})) {
             print "\n/* ${structprefix}Dispatch$calls{$_}->{ProcName} has " .
                   "to be implemented manually */\n";
@@ -391,7 +355,9 @@ elsif ($opt_b) {
 
         if ($calls{$_}->{args} ne "void") {
             # node device is special, as it's identified by name
-            if ($calls{$_}->{args} =~ m/^remote_node_device/) {
+            if ($calls{$_}->{args} =~ m/^remote_node_device_/ and
+                !($calls{$_}->{args} =~ m/^remote_node_device_lookup_by_name_/) and
+                !($calls{$_}->{args} =~ m/^remote_node_device_create_xml_/)) {
                 $has_node_device = 1;
                 push(@vars_list, "virNodeDevicePtr dev = NULL");
                 push(@getters_list,
@@ -407,69 +373,69 @@ elsif ($opt_b) {
                 if ($args_member =~ m/^remote_nonnull_string name;/ and $has_node_device) {
                     # ignore the name arg for node devices
                     next
-                } elsif ($args_member =~ m/^remote_nonnull_domain /) {
-                    push(@vars_list, "virDomainPtr dom = NULL");
+                } elsif ($args_member =~ m/^remote_nonnull_domain (\S+);/) {
+                    push(@vars_list, "virDomainPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(dom = get_nonnull_domain(conn, args->dom)))\n" .
+                         "    if (!($1 = get_nonnull_domain(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "dom");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (dom)\n" .
-                         "        virDomainFree(dom);");
-                } elsif ($args_member =~ m/^remote_nonnull_network /) {
-                    push(@vars_list, "virNetworkPtr net = NULL");
+                         "    if ($1)\n" .
+                         "        virDomainFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_network (\S+);/) {
+                    push(@vars_list, "virNetworkPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(net = get_nonnull_network(conn, args->net)))\n" .
+                         "    if (!($1 = get_nonnull_network(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "net");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (net)\n" .
-                         "        virNetworkFree(net);");
-                } elsif ($args_member =~ m/^remote_nonnull_storage_pool /) {
-                    push(@vars_list, "virStoragePoolPtr pool = NULL");
+                         "    if ($1)\n" .
+                         "        virNetworkFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_storage_pool (\S+);/) {
+                    push(@vars_list, "virStoragePoolPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(pool = get_nonnull_storage_pool(conn, args->pool)))\n" .
+                         "    if (!($1 = get_nonnull_storage_pool(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "pool");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (pool)\n" .
-                         "        virStoragePoolFree(pool);");
-                } elsif ($args_member =~ m/^remote_nonnull_storage_vol /) {
-                    push(@vars_list, "virStorageVolPtr vol = NULL");
+                         "    if ($1)\n" .
+                         "        virStoragePoolFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_storage_vol (\S+);/) {
+                    push(@vars_list, "virStorageVolPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(vol = get_nonnull_storage_vol(conn, args->vol)))\n" .
+                         "    if (!($1 = get_nonnull_storage_vol(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "vol");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (vol)\n" .
-                         "        virStorageVolFree(vol);");
-                } elsif ($args_member =~ m/^remote_nonnull_interface /) {
-                    push(@vars_list, "virInterfacePtr iface = NULL");
+                         "    if ($1)\n" .
+                         "        virStorageVolFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_interface (\S+);/) {
+                    push(@vars_list, "virInterfacePtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(iface = get_nonnull_interface(conn, args->iface)))\n" .
+                         "    if (!($1 = get_nonnull_interface(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "iface");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (iface)\n" .
-                         "        virInterfaceFree(iface);");
-                } elsif ($args_member =~ m/^remote_nonnull_secret /) {
-                    push(@vars_list, "virSecretPtr secret = NULL");
+                         "    if ($1)\n" .
+                         "        virInterfaceFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_secret (\S+);/) {
+                    push(@vars_list, "virSecretPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(secret = get_nonnull_secret(conn, args->secret)))\n" .
+                         "    if (!($1 = get_nonnull_secret(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "secret");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (secret)\n" .
-                         "        virSecretFree(secret);");
-                } elsif ($args_member =~ m/^remote_nonnull_nwfilter /) {
-                    push(@vars_list, "virNWFilterPtr nwfilter = NULL");
+                         "    if ($1)\n" .
+                         "        virSecretFree($1);");
+                } elsif ($args_member =~ m/^remote_nonnull_nwfilter (\S+);/) {
+                    push(@vars_list, "virNWFilterPtr $1 = NULL");
                     push(@getters_list,
-                         "    if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))\n" .
+                         "    if (!($1 = get_nonnull_nwfilter(conn, args->$1)))\n" .
                          "        goto cleanup;\n");
-                    push(@args_list, "nwfilter");
+                    push(@args_list, "$1");
                     push(@free_list,
-                         "    if (nwfilter)\n" .
-                         "        virNWFilterFree(nwfilter);");
+                         "    if ($1)\n" .
+                         "        virNWFilterFree($1);");
                 } elsif ($args_member =~ m/^remote_nonnull_domain_snapshot /) {
                     push(@vars_list, "virDomainPtr dom = NULL");
                     push(@vars_list, "virDomainSnapshotPtr snapshot = NULL");
@@ -497,12 +463,16 @@ elsif ($opt_b) {
                     }
 
                     push(@args_list, "args->$1.$1_len");
-                } elsif ($args_member =~ m/.* (\S+);/) {
+                } elsif ($args_member =~ m/(\S+) (\S+);/) {
                     if (! @args_list) {
                         push(@args_list, "conn");
                     }
 
-                    push(@args_list, "args->$1");
+                    if ($1 eq "remote_uuid") {
+                        push(@args_list, "(unsigned char *) args->$2");
+                    } else {
+                        push(@args_list, "args->$2");
+                    }
                 }
             }
         }
@@ -522,6 +492,87 @@ elsif ($opt_b) {
                     $single_ret_var = $1;
                     $single_ret_by_ref = 0;
                     $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_domain (\S+);/) {
+                    push(@vars_list, "virDomainPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_domain(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virDomainFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_network (\S+);/) {
+                    push(@vars_list, "virNetworkPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_network(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virNetworkFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_storage_pool (\S+);/) {
+                    push(@vars_list, "virStoragePoolPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_storage_pool(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virStoragePoolFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_storage_vol (\S+);/) {
+                    push(@vars_list, "virStorageVolPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_storage_vol(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virStorageVolFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_interface (\S+);/) {
+                    push(@vars_list, "virInterfacePtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_interface(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virInterfaceFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_node_device (\S+);/) {
+                    push(@vars_list, "virNodeDevicePtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_node_device(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virNodeDeviceFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_secret (\S+);/) {
+                    push(@vars_list, "virSecretPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_secret(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virSecretFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_nwfilter (\S+);/) {
+                    push(@vars_list, "virNWFilterPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_nwfilter(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virNWFilterFree($1);");
+                    $single_ret_var = $1;
+                    $single_ret_by_ref = 0;
+                    $single_ret_check = " == NULL";
+                } elsif ($ret_member =~ m/remote_nonnull_domain_snapshot (\S+);/) {
+                    push(@vars_list, "virDomainSnapshotPtr $1 = NULL");
+                    push(@ret_list, "make_nonnull_domain_snapshot(&ret->$1, $1);");
+                    push(@free_list,
+                         "    if ($1)\n" .
+                         "        virDomainSnapshotFree($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;");
@@ -540,7 +591,8 @@ elsif ($opt_b) {
                     push(@ret_list, "ret->$1 = $1;");
                     $single_ret_var = $1;
 
-                    if ($calls{$_}->{ProcName} eq "DomainGetMaxMemory") {
+                    if ($calls{$_}->{ProcName} eq "DomainGetMaxMemory" or
+                        $calls{$_}->{ProcName} eq "NodeGetFreeMemory") {
                         $single_ret_by_ref = 0;
                         $single_ret_check = " == 0";
                     } else {
@@ -579,7 +631,10 @@ elsif ($opt_b) {
 
             if (! @args_list) {
                 push(@args_list, "conn");
-                $prefix = "Connect"
+
+                if ($calls{$_}->{ProcName} ne "NodeGetFreeMemory") {
+                    $prefix = "Connect"
+                }
             }
 
             if ($calls{$_}->{ProcName} eq "GetSysinfo" or