]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Clean up snapshot retrieval to use the new helper
authorPeter Krempa <pkrempa@redhat.com>
Thu, 11 Oct 2012 09:59:40 +0000 (11:59 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Sat, 3 Nov 2012 10:26:39 +0000 (11:26 +0100)
Two other places were left with the old code to look up snapshots.
Change them to use the snapshot lookup helper.

src/qemu/qemu_driver.c

index 7480765167945c08b69193fe68ed392a0448ce92..649742e376c78f57cb98cb12d5b3cf97e6de54c1 100644 (file)
@@ -11832,13 +11832,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
         goto cleanup;
     }
 
-    snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
-    if (!snap) {
-        virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
-                       _("no domain snapshot with matching name '%s'"),
-                       snapshot->name);
+    if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
         goto cleanup;
-    }
 
     if (!vm->persistent &&
         snap->def->state != VIR_DOMAIN_RUNNING &&
@@ -12200,13 +12195,8 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
         goto cleanup;
     }
 
-    snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
-    if (!snap) {
-        virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
-                       _("no domain snapshot with matching name '%s'"),
-                       snapshot->name);
+    if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
         goto cleanup;
-    }
 
     if (!(flags & VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY)) {
         if (!(flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) &&