[libvirt] [PATCH 03/12] remote: Add support for virDomainCreateWithParams

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Wed May 9 14:56:13 UTC 2018


Add support for virDomainCreateWithParams to the remote driver.

Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi at linux.ibm.com>
---
 src/remote/remote_driver.c   |  1 +
 src/remote/remote_protocol.x | 22 +++++++++++++++++++++-
 src/remote_protocol-structs  | 12 ++++++++++++
 src/rpc/gendispatch.pl       | 18 ++++++++++++------
 4 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 95437b43657e..1bbf42c1e1b2 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8297,6 +8297,7 @@ static virHypervisorDriver hypervisor_driver = {
     .connectListDefinedDomains = remoteConnectListDefinedDomains, /* 0.3.0 */
     .connectNumOfDefinedDomains = remoteConnectNumOfDefinedDomains, /* 0.3.0 */
     .domainCreate = remoteDomainCreate, /* 0.3.0 */
+    .domainCreateWithParams = remoteDomainCreateWithParams, /* 4.4.0 */
     .domainCreateWithFlags = remoteDomainCreateWithFlags, /* 0.8.2 */
     .domainCreateWithFiles = remoteDomainCreateWithFiles, /* 1.1.1 */
     .domainDefineXML = remoteDomainDefineXML, /* 0.3.0 */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 296a0871813a..d22299879429 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -73,6 +73,9 @@ const REMOTE_IOTHREAD_INFO_MAX = 16384;
 /* Upper limit on migrate cookie. */
 const REMOTE_MIGRATE_COOKIE_MAX = 4194304;
 
+/* Upper limit on create params. */
+const REMOTE_CREATE_PARAMS_MAX = 4;
+
 /* Upper limit on lists of networks. */
 const REMOTE_NETWORK_LIST_MAX = 16384;
 
@@ -1054,6 +1057,16 @@ struct remote_domain_create_args {
     remote_nonnull_domain dom;
 };
 
+struct remote_domain_create_with_params_args {
+    remote_nonnull_domain dom;
+    remote_typed_param params<REMOTE_CREATE_PARAMS_MAX>;
+    unsigned int flags;
+};
+
+struct remote_domain_create_with_params_ret {
+    remote_nonnull_domain dom;
+};
+
 struct remote_domain_create_with_flags_args {
     remote_nonnull_domain dom;
     unsigned int flags;
@@ -6135,5 +6148,12 @@ enum remote_procedure {
      * @priority: high
      * @acl: storage_pool:getattr
      */
-    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH = 391
+    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH = 391,
+
+    /**
+     * @generate: both
+     * @acl: domain:start
+     * @acl: domain:write
+     */
+    REMOTE_PROC_DOMAIN_CREATE_WITH_PARAMS = 392
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index fe163db73f88..49ef88f07e62 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -684,6 +684,17 @@ struct remote_connect_num_of_defined_domains_ret {
 struct remote_domain_create_args {
         remote_nonnull_domain      dom;
 };
+struct remote_domain_create_with_params_args {
+        remote_nonnull_domain      dom;
+        struct {
+                u_int              params_len;
+                remote_typed_param * params_val;
+        } params;
+        u_int                      flags;
+};
+struct remote_domain_create_with_params_ret {
+        remote_nonnull_domain      dom;
+};
 struct remote_domain_create_with_flags_args {
         remote_nonnull_domain      dom;
         u_int                      flags;
@@ -3269,4 +3280,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML = 389,
         REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION = 390,
         REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH = 391,
+        REMOTE_PROC_DOMAIN_CREATE_WITH_PARAMS = 392,
 };
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index b8b83b6b40d3..1e32c10e7b7a 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -783,9 +783,12 @@ elsif ($mode eq "server") {
                 } elsif ($ret_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|node_device|secret|nwfilter|domain_snapshot) (\S+);/) {
                     my $type_name = name_to_TypeName($1);
 
-                    if ($call->{ProcName} eq "DomainCreateWithFlags") {
-                        # SPECIAL: virDomainCreateWithFlags updates the given
-                        #          domain object instead of returning a new one
+                    if ($call->{ProcName} eq "DomainCreateWithFlags" ||
+                        $call->{ProcName} eq "DomainCreateWithParams") {
+                        # SPECIAL: virDomainCreateWithFlags,
+                        # virDomainCreateWithParams,
+                        # updates the given domain object instead of
+                        # returning a new one
                         push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
                         $single_ret_var = undef;
                         $single_ret_by_ref = 1;
@@ -1576,9 +1579,12 @@ elsif ($mode eq "client") {
                     my $arg_name = $2;
                     my $type_name = name_to_TypeName($name);
 
-                    if ($call->{ProcName} eq "DomainCreateWithFlags") {
-                        # SPECIAL: virDomainCreateWithFlags updates the given
-                        #          domain object instead of returning a new one
+                    if ($call->{ProcName} eq "DomainCreateWithFlags" ||
+                        $call->{ProcName} eq "DomainCreateWithParams") {
+                        # SPECIAL: virDomainCreateWithFlags,
+                        # virDomainCreateWithParams
+                        # updates the given domain object instead of
+                        # returning a new one
                         push(@ret_list, "dom->id = ret.dom.id;");
                         push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{ret}, (char *)&ret);");
                         push(@ret_list, "rv = 0;");
-- 
2.13.4




More information about the libvir-list mailing list