[PATCH 06/11] ch_driver: Refactor virCHProcessStart

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

 



Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@xxxxxxxxxxxxxxxxxxx>
---
 src/ch/ch_process.c | 47 ++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index 4b360413fb..02749adfb6 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -460,6 +460,34 @@ virCHProcessSetupVcpus(virDomainObj *vm)
     return 0;
 }
 
+static int
+virCHProcessSetup(virDomainObj *vm)
+{
+    virCHDomainObjPrivate *priv = vm->privateData;
+
+    virCHDomainRefreshThreadInfo(vm);
+
+    VIR_DEBUG("Setting emulator tuning/settings");
+    if (virCHProcessSetupEmulatorThreads(vm) < 0)
+        return -1;
+
+    VIR_DEBUG("Setting iothread tuning/settings");
+    if (virCHProcessSetupIOThreads(vm) < 0)
+        return -1;
+
+    VIR_DEBUG("Setting global CPU cgroup (if required)");
+    if (virDomainCgroupSetupGlobalCpuCgroup(vm,
+                                            priv->cgroup) < 0)
+        return -1;
+
+    VIR_DEBUG("Setting vCPU tuning/settings");
+    if (virCHProcessSetupVcpus(vm) < 0)
+        return -1;
+
+    virCHProcessUpdateInfo(vm);
+    return 0;
+}
+
 
 #define PKT_TIMEOUT_MS 500 /* ms */
 
@@ -763,26 +791,9 @@ virCHProcessStart(virCHDriver *driver,
         goto cleanup;
     }
 
-    virCHDomainRefreshThreadInfo(vm);
-
-    VIR_DEBUG("Setting emulator tuning/settings");
-    if (virCHProcessSetupEmulatorThreads(vm) < 0)
-        goto cleanup;
-
-    VIR_DEBUG("Setting iothread tuning/settings");
-    if (virCHProcessSetupIOThreads(vm) < 0)
-        goto cleanup;
-
-    VIR_DEBUG("Setting global CPU cgroup (if required)");
-    if (virDomainCgroupSetupGlobalCpuCgroup(vm,
-                                            priv->cgroup) < 0)
+    if (virCHProcessSetup(vm) < 0)
         goto cleanup;
 
-    VIR_DEBUG("Setting vCPU tuning/settings");
-    if (virCHProcessSetupVcpus(vm) < 0)
-        goto cleanup;
-
-    virCHProcessUpdateInfo(vm);
     virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
 
     return 0;
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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