1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu_domain: fix startup policy for disks

https://bugzilla.redhat.com/show_bug.cgi?id=1086121

We now support startupPolicy='optional' for disks, but this
should work only for cold boot, not for restore or migrate.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2014-06-27 16:34:07 +02:00
parent 636d66e628
commit 5098f671f0

View File

@ -2230,11 +2230,19 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
{
char uuid[VIR_UUID_STRING_BUFLEN];
int startupPolicy = vm->def->disks[diskIndex]->startupPolicy;
int device = vm->def->disks[diskIndex]->device;
virUUIDFormat(vm->def->uuid, uuid);
switch ((virDomainStartupPolicy) startupPolicy) {
case VIR_DOMAIN_STARTUP_POLICY_OPTIONAL:
/* Once started with an optional disk, qemu saves its section
* in the migration stream, so later, when restoring from it
* we must make sure the sections match. */
if (!cold_boot &&
device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
device != VIR_DOMAIN_DISK_DEVICE_CDROM)
goto error;
break;
case VIR_DOMAIN_STARTUP_POLICY_MANDATORY: