]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Added support for -incoming option in prepare for restore
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 14 Aug 2007 01:28:47 +0000 (01:28 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 14 Aug 2007 01:28:47 +0000 (01:28 +0000)
ChangeLog
src/qemu_conf.c
src/qemu_conf.h
src/qemu_driver.c

index 648cd10b4b4cd0341c6ffe4b2d335becc4b05dc4..5705e77906071fc85d2f5894cc588440bd11872f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 13 21:26:48 EST 2007 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/qemu_conf.c, src/qemu_conf.h, src/qemu_driver.c: Add support
+       for passing -incoming option to QEMU for migration/restore.
+
 Mon Aug 13 21:18:48 EST 2007 Daniel P. Berrange <berrange@redhat.com>
 
        * src/util.h, src/util.c: Allow a file descriptor to be supplied
index 79dd18002b7c50b0c5b9e4e644c87179a590681f..2bbd07253cc21e1ca6bdafbdb68376ea59570a19 100644 (file)
@@ -1518,7 +1518,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
         (vm->def->os.initrd[0] ? 2 : 0) + /* initrd */
         (vm->def->os.cmdline[0] ? 2 : 0) + /* cmdline */
         (vm->def->graphicsType == QEMUD_GRAPHICS_VNC ? 2 :
-         (vm->def->graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)); /* graphics */
+         (vm->def->graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)) + /* graphics */
+        (vm->migrateFrom[0] ? 3 : 0); /* migrateFrom */
 
     snprintf(memory, sizeof(memory), "%d", vm->def->memory/1024);
     snprintf(vcpus, sizeof(vcpus), "%d", vm->def->vcpus);
@@ -1767,6 +1768,15 @@ int qemudBuildCommandLine(virConnectPtr conn,
         /* SDL is the default. no args needed */
     }
 
+    if (vm->migrateFrom[0]) {
+        if (!((*argv)[++n] = strdup("-S")))
+            goto no_memory;
+        if (!((*argv)[++n] = strdup("-incoming")))
+            goto no_memory;
+        if (!((*argv)[++n] = strdup(vm->migrateFrom)))
+            goto no_memory;
+    }
+
     (*argv)[++n] = NULL;
 
     return 0;
@@ -1884,6 +1894,7 @@ qemudAssignVMDef(virConnectPtr conn,
         return NULL;
     }
 
+    vm->stdin = -1;
     vm->stdout = -1;
     vm->stderr = -1;
     vm->monitor = -1;
index 60a38b7ada8ca2bdf0a8dec9621432c3c6d0c4f3..4a9b1ae415485140fce9841e9065dbdd01522327 100644 (file)
@@ -199,6 +199,7 @@ struct qemud_vm_def {
 
 /* Guest VM runtime state */
 struct qemud_vm {
+    int stdin;
     int stdout;
     int stderr;
     int monitor;
@@ -212,6 +213,7 @@ struct qemud_vm {
 
     char configFile[PATH_MAX];
     char autostartLink[PATH_MAX];
+    char migrateFrom[PATH_MAX];
 
     struct qemud_vm_def *def; /* The current definition */
     struct qemud_vm_def *newDef; /* New definition to activate at shutdown */
index 15b94b84650069b5fb51c0ce023ee56cfe2bb214..e649060087ef470e147f82708483b138c45d405f 100644 (file)
@@ -656,9 +656,9 @@ static int qemudStartVMDaemon(virConnectPtr conn,
                  errno, strerror(errno));
 
     if (virExecNonBlock(conn, argv, &vm->pid,
-                        -1, &vm->stdout, &vm->stderr) == 0) {
+                        vm->stdin, &vm->stdout, &vm->stderr) == 0) {
         vm->id = driver->nextvmid++;
-        vm->state = VIR_DOMAIN_RUNNING;
+        vm->state = vm->migrateFrom[0] ? VIR_DOMAIN_PAUSED : VIR_DOMAIN_RUNNING;
 
         driver->ninactivevms--;
         driver->nactivevms++;