On 11/01/2012 10:22 AM, Peter Krempa wrote:
Some of the pre-snapshot check have restrictions wired in regarding
configuration options that influence taking of external checkpoints.
This patch removes restrictions that would inhibit taking of such a
snapshot.
---
src/qemu/qemu_driver.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
- if (!found) {
+ /* external snapshot is possible without specifying a disk to snapshot */
+ if (!found &&
+ !(def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)) {
'!(a == b)' is awkward; write it 'a != b'
@@ -11459,9 +11455,10 @@ qemuDomainSnapshotCreateXML(virDomainPtr
domain,
def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
} else {
def->state = virDomainObjGetState(vm, NULL);
- def->memory = (def->state == VIR_DOMAIN_SHUTOFF ?
- VIR_DOMAIN_SNAPSHOT_LOCATION_NONE :
- VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL);
+ if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
+ align_match = false;
+ align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
+ }
This hunk is removing too much.
ACK with this squashed in:
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index ce77b27..ef9771e 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -10839,7 +10839,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
virDomainSnapshotDefPtr def,
/* external snapshot is possible without specifying a disk to
snapshot */
if (!found &&
- !(def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)) {
+ def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("internal and disk-only snapshots require at
least "
"one disk to be selected for snapshot"));
@@ -11460,12 +11460,15 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
align_match = false;
def->state = VIR_DOMAIN_DISK_SNAPSHOT;
def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
+ } else if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
+ def->state = virDomainObjGetState(vm, NULL);
+ align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
+ align_match = false;
} else {
def->state = virDomainObjGetState(vm, NULL);
- if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
- align_match = false;
- align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
- }
+ def->memory = (def->state == VIR_DOMAIN_SHUTOFF ?
+ VIR_DOMAIN_SNAPSHOT_LOCATION_NONE :
+ VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL);
}
if (virDomainSnapshotAlignDisks(def, align_location,
align_match) < 0 ||
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org