1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Fix startupPolicy for snapshot-revert

Currently, startupPolicy='requisite' was determining cold boot
by migrateFrom != NULL. That means, if domain was started up
with migrateFrom set we didn't require disk source path and allowed
it to be dropped. However, on snapshot-revert domain wasn't migrated
but according to documentation, requisite should drop disk source
as well.
This commit is contained in:
Michal Privoznik 2012-03-07 19:15:01 +01:00
parent 210ed0e871
commit b819b3b7cf
4 changed files with 13 additions and 9 deletions

View File

@ -1358,7 +1358,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0) if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; /* XXXX free the 'vm' we created ? */ goto cleanup; /* XXXX free the 'vm' we created ? */
if (qemuProcessStart(conn, driver, vm, NULL, if (qemuProcessStart(conn, driver, vm, NULL, true,
(flags & VIR_DOMAIN_START_PAUSED) != 0, (flags & VIR_DOMAIN_START_PAUSED) != 0,
(flags & VIR_DOMAIN_START_AUTODESTROY) != 0, (flags & VIR_DOMAIN_START_AUTODESTROY) != 0,
-1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE) < 0) { -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE) < 0) {
@ -4109,8 +4109,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
} }
/* Set the migration source and start it up. */ /* Set the migration source and start it up. */
ret = qemuProcessStart(conn, driver, vm, "stdio", true, ret = qemuProcessStart(conn, driver, vm, "stdio", false, true,
false, *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE); false, *fd, path, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
if (intermediatefd != -1) { if (intermediatefd != -1) {
if (ret < 0) { if (ret < 0) {
@ -4711,8 +4712,9 @@ qemuDomainObjStart(virConnectPtr conn,
} }
} }
ret = qemuProcessStart(conn, driver, vm, NULL, start_paused, ret = qemuProcessStart(conn, driver, vm, NULL, true, start_paused,
autodestroy, -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE); autodestroy, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "booted", ret >= 0); virDomainAuditStart(vm, "booted", ret >= 0);
if (ret >= 0) { if (ret >= 0) {
virDomainEventPtr event = virDomainEventPtr event =
@ -10790,7 +10792,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virDomainObjAssignDef(vm, config, false); virDomainObjAssignDef(vm, config, false);
rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL, rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
true, false, -1, NULL, snap, false, true, false, -1, NULL, snap,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE); VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "from-snapshot", rc >= 0); virDomainAuditStart(vm, "from-snapshot", rc >= 0);
detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
@ -10880,7 +10882,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (event) if (event)
qemuDomainEventQueue(driver, event); qemuDomainEventQueue(driver, event);
rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL, rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
paused, false, -1, NULL, NULL, false, paused, false, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE); VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "from-snapshot", rc >= 0); virDomainAuditStart(vm, "from-snapshot", rc >= 0);
if (rc < 0) { if (rc < 0) {

View File

@ -1229,7 +1229,7 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
/* Start the QEMU daemon, with the same command-line arguments plus /* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom * -incoming $migrateFrom
*/ */
if (qemuProcessStart(dconn, driver, vm, migrateFrom, true, if (qemuProcessStart(dconn, driver, vm, migrateFrom, false, true,
true, dataFD[0], NULL, NULL, true, dataFD[0], NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) { VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) {
virDomainAuditStart(vm, "migrated", false); virDomainAuditStart(vm, "migrated", false);

View File

@ -3072,6 +3072,7 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver, struct qemud_driver *driver,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *migrateFrom, const char *migrateFrom,
bool cold_boot,
bool start_paused, bool start_paused,
bool autodestroy, bool autodestroy,
int stdin_fd, int stdin_fd,
@ -3227,7 +3228,7 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup; goto cleanup;
VIR_DEBUG("Checking for CDROM and floppy presence"); VIR_DEBUG("Checking for CDROM and floppy presence");
if (qemuDomainCheckDiskPresence(driver, vm, migrateFrom != NULL) < 0) if (qemuDomainCheckDiskPresence(driver, vm, cold_boot) < 0)
goto cleanup; goto cleanup;
VIR_DEBUG("Setting up domain cgroup (if required)"); VIR_DEBUG("Setting up domain cgroup (if required)");

View File

@ -48,6 +48,7 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver, struct qemud_driver *driver,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *migrateFrom, const char *migrateFrom,
bool cold_boot,
bool start_paused, bool start_paused,
bool autodestroy, bool autodestroy,
int stdin_fd, int stdin_fd,