提交 b819b3b7 编写于 作者: M Michal Privoznik

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.
上级 210ed0e8
......@@ -1358,7 +1358,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
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_AUTODESTROY) != 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. */
ret = qemuProcessStart(conn, driver, vm, "stdio", true,
false, *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
ret = qemuProcessStart(conn, driver, vm, "stdio", false, true,
false, *fd, path, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
if (intermediatefd != -1) {
if (ret < 0) {
......@@ -4711,8 +4712,9 @@ qemuDomainObjStart(virConnectPtr conn,
}
}
ret = qemuProcessStart(conn, driver, vm, NULL, start_paused,
autodestroy, -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
ret = qemuProcessStart(conn, driver, vm, NULL, true, start_paused,
autodestroy, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "booted", ret >= 0);
if (ret >= 0) {
virDomainEventPtr event =
......@@ -10790,7 +10792,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virDomainObjAssignDef(vm, config, false);
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);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
......@@ -10880,7 +10882,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (event)
qemuDomainEventQueue(driver, event);
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);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
if (rc < 0) {
......
......@@ -1229,7 +1229,7 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
/* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom
*/
if (qemuProcessStart(dconn, driver, vm, migrateFrom, true,
if (qemuProcessStart(dconn, driver, vm, migrateFrom, false, true,
true, dataFD[0], NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) {
virDomainAuditStart(vm, "migrated", false);
......
......@@ -3072,6 +3072,7 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
bool cold_boot,
bool start_paused,
bool autodestroy,
int stdin_fd,
......@@ -3227,7 +3228,7 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Checking for CDROM and floppy presence");
if (qemuDomainCheckDiskPresence(driver, vm, migrateFrom != NULL) < 0)
if (qemuDomainCheckDiskPresence(driver, vm, cold_boot) < 0)
goto cleanup;
VIR_DEBUG("Setting up domain cgroup (if required)");
......
......@@ -48,6 +48,7 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
bool cold_boot,
bool start_paused,
bool autodestroy,
int stdin_fd,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册