[dbus PATCH 1/9] Process input arguments before getting libvirt object

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/connect.c |  6 +++---
 src/domain.c  | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/connect.c b/src/connect.c
index 0025023..3d2be96 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1046,14 +1046,14 @@ virtDBusConnectNodeSetMemoryParameters(GVariant *inArgs,
 
     g_variant_get(inArgs, "(a{sv}u)", &iter, &flags);
 
-    if (!virtDBusConnectOpen(connect, error))
-        return;
-
     if (!virtDBusUtilGVariantToTypedParams(iter, &params.params,
                                            &params.nparams, error)) {
         return;
     }
 
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
     if (virNodeSetMemoryParameters(connect->connection, params.params,
                                    params.nparams, flags) < 0) {
         virtDBusUtilSetLastVirtError(error);
diff --git a/src/domain.c b/src/domain.c
index 262ebe2..17231bd 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1995,10 +1995,6 @@ virtDBusDomainPinEmulator(GVariant *inArgs,
 
     g_variant_get(inArgs, "(abu)", &iter, &flags);
 
-    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
-    if (!domain)
-        return;
-
     cpus = g_variant_iter_n_children(iter);
     cpumaplen = VIR_CPU_MAPLEN(cpus);
     cpumap = g_new0(guchar, cpumaplen);
@@ -2008,6 +2004,10 @@ virtDBusDomainPinEmulator(GVariant *inArgs,
         cnt++;
     }
 
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
     if (virDomainPinEmulator(domain, cpumap, cpumaplen, flags) < 0)
         virtDBusUtilSetLastVirtError(error);
 }
@@ -2035,10 +2035,6 @@ virtDBusDomainPinIOThread(GVariant *inArgs,
 
     g_variant_get(inArgs, "(uabu)", &iothreadId, &iter, &flags);
 
-    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
-    if (!domain)
-        return;
-
     cpus = g_variant_iter_n_children(iter);
     cpumaplen = VIR_CPU_MAPLEN(cpus);
     cpumap = g_new0(guchar, cpumaplen);
@@ -2048,6 +2044,10 @@ virtDBusDomainPinIOThread(GVariant *inArgs,
         cnt++;
     }
 
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
     if (virDomainPinIOThread(domain, iothreadId, cpumap, cpumaplen, flags) < 0)
         virtDBusUtilSetLastVirtError(error);
 }
@@ -2075,10 +2075,6 @@ virtDBusDomainPinVcpu(GVariant *inArgs,
 
     g_variant_get(inArgs, "(uabu)", &vcpu, &iter, &flags);
 
-    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
-    if (!domain)
-        return;
-
     cpus = g_variant_iter_n_children(iter);
     cpumaplen = VIR_CPU_MAPLEN(cpus);
     cpumap = g_new0(guchar, cpumaplen);
@@ -2088,6 +2084,10 @@ virtDBusDomainPinVcpu(GVariant *inArgs,
         cnt++;
     }
 
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
     if (virDomainPinVcpuFlags(domain, vcpu, cpumap, cpumaplen, flags) < 0)
         virtDBusUtilSetLastVirtError(error);
 }
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux