mirror of
https://github.com/libvirt/libvirt.git
synced 2025-01-08 23:24:01 -06:00
qemu_snapshot: create: don't require disk-only flag for offline external snapshot
Historically creating offline external snapshot required disk-only flag as well. Now when user requests new snapshot for offline VM and at least one disk is specified to use external snapshot we will no longer require disk-only flag as all other not specified disk will use external snapshots as well. Resolves: https://issues.redhat.com/browse/RHEL-22797 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
faa2e3bb54
commit
189fdeff10
@ -1582,15 +1582,27 @@ qemuSnapshotCreateXMLValidateDef(virDomainObj *vm,
|
|||||||
* to internal snapshots.
|
* to internal snapshots.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
qemuSnapshotCreateUseExternal(virDomainSnapshotDef *def,
|
qemuSnapshotCreateUseExternal(virDomainObj *vm,
|
||||||
|
virDomainSnapshotDef *def,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
|
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!virDomainObjIsActive(vm)) {
|
||||||
|
/* No need to check all disks as function qemuSnapshotPrepare() guarantees
|
||||||
|
* that we don't have a combination of internal and external location. */
|
||||||
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
|
if (def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,7 +1635,7 @@ qemuSnapshotCreateAlignDisks(virDomainObj *vm,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuSnapshotCreateUseExternal(def, flags)) {
|
if (qemuSnapshotCreateUseExternal(vm, def, flags)) {
|
||||||
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
|
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
|
||||||
def->state = virDomainObjGetState(vm, NULL);
|
def->state = virDomainObjGetState(vm, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user