Added support for -incoming option in prepare for restore

This commit is contained in:
Daniel P. Berrange 2007-08-14 01:28:47 +00:00
parent af7378db35
commit 79a3754210
4 changed files with 21 additions and 3 deletions

View File

@ -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

View 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;

View 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 */

View 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++;