[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/5] remote generator, client: Add more special case handling



For virDomainDestroy and virDrvSupportsFeature.
---
 daemon/remote_generator.pl   |   14 ++++++++++
 src/remote/remote_driver.c   |   55 ------------------------------------------
 src/remote/remote_protocol.x |    4 +-
 3 files changed, 16 insertions(+), 57 deletions(-)

diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index dd5d482..a3b8421 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -1065,6 +1065,15 @@ elsif ($opt_k) {
         print "\n";
         print "    remoteDriverLock(priv);\n";
 
+        if ($call->{ProcName} eq "SupportsFeature") {
+            # SPECIAL: VIR_DRV_FEATURE_REMOTE feature is handled directly
+            print "\n";
+            print "    if (feature == VIR_DRV_FEATURE_REMOTE) {\n";
+            print "        rv = 1;\n";
+            print "        goto done;\n";
+            print "    }\n";
+        }
+
         foreach my $args_check (@args_check_list) {
             print "\n";
             print "    if ($args_check->{arg} > $args_check->{limit}) {\n";
@@ -1140,6 +1149,11 @@ elsif ($opt_k) {
             print "\n";
         }
 
+        if ($call->{ProcName} eq "DomainDestroy") {
+            # SPECIAL: virDomainDestroy needs to reset the domain id explicitly
+            print "    dom->id = -1;\n";
+        }
+
         if ($multi_ret or ! ret_list) {
             print "    rv = 0;\n";
         }
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index c2edaa2..f18523c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1590,37 +1590,6 @@ remoteClose (virConnectPtr conn)
     return ret;
 }
 
-static int
-remoteSupportsFeature (virConnectPtr conn, int feature)
-{
-    int rv = -1;
-    remote_supports_feature_args args;
-    remote_supports_feature_ret ret;
-    struct private_data *priv = conn->privateData;
-
-    remoteDriverLock(priv);
-
-    /* VIR_DRV_FEATURE_REMOTE* features are handled directly. */
-    if (feature == VIR_DRV_FEATURE_REMOTE) {
-        rv = 1;
-        goto done;
-    }
-
-    args.feature = feature;
-
-    memset (&ret, 0, sizeof ret);
-    if (call (conn, priv, 0, REMOTE_PROC_SUPPORTS_FEATURE,
-              (xdrproc_t) xdr_remote_supports_feature_args, (char *) &args,
-              (xdrproc_t) xdr_remote_supports_feature_ret, (char *) &ret) == -1)
-        goto done;
-
-    rv = ret.supported;
-
-done:
-    remoteDriverUnlock(priv);
-    return rv;
-}
-
 /* Unfortunately this function is defined to return a static string.
  * Since the remote end always answers with the same type (for a
  * single connection anyway) we cache the type in the connection's
@@ -1811,30 +1780,6 @@ done:
 }
 
 static int
-remoteDomainDestroy (virDomainPtr domain)
-{
-    int rv = -1;
-    remote_domain_destroy_args args;
-    struct private_data *priv = domain->conn->privateData;
-
-    remoteDriverLock(priv);
-
-    make_nonnull_domain (&args.dom, domain);
-
-    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_DESTROY,
-              (xdrproc_t) xdr_remote_domain_destroy_args, (char *) &args,
-              (xdrproc_t) xdr_void, (char *) NULL) == -1)
-        goto done;
-
-    rv = 0;
-    domain->id = -1;
-
-done:
-    remoteDriverUnlock(priv);
-    return rv;
-}
-
-static int
 remoteDomainSetMemoryParameters (virDomainPtr domain,
                                  virMemoryParameterPtr params,
                                  int nparams,
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 571f273..b14aee0 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1978,7 +1978,7 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_CREATE_XML = 10, /* autogen autogen */
 
     REMOTE_PROC_DOMAIN_DEFINE_XML = 11, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen skipgen */
+    REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen autogen */
     REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13, /* autogen autogen */
     REMOTE_PROC_DOMAIN_GET_XML_DESC = 14, /* autogen autogen */
     REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15, /* autogen autogen */
@@ -2030,7 +2030,7 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57, /* skipgen skipgen */
     REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58, /* skipgen skipgen */
     REMOTE_PROC_GET_HOSTNAME = 59, /* autogen autogen */
-    REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen skipgen */
+    REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen autogen */
 
     REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61, /* skipgen skipgen */
     REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62, /* autogen autogen */
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]