]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
snapshot: Saner error message for duplicate create
authorEric Blake <eblake@redhat.com>
Wed, 24 Jul 2019 05:03:24 +0000 (00:03 -0500)
committerEric Blake <eblake@redhat.com>
Wed, 24 Jul 2019 22:03:34 +0000 (17:03 -0500)
Any message that is easy to trigger (as evidenced by the testsuite
update) should not use 'internal error' as its category.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/virdomainmomentobjlist.c
tests/virsh-snapshot

index 5c147bdbbf87d1bc266061e2ff2784b3a46f092d..c8dd8f8e013a5140aba6aa45b99c6eea785b576f 100644 (file)
@@ -242,8 +242,8 @@ virDomainMomentAssignDef(virDomainMomentObjListPtr moments,
     virDomainMomentObjPtr moment;
 
     if (virHashLookup(moments->objs, def->name) != NULL) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unexpected domain moment %s already exists"),
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("domain moment %s already exists"),
                        def->name);
         return NULL;
     }
index 510904f470d731d14a47474b93237d14da586419..c31da52ef940810c5f26dfb67d921a4470b8817e 100755 (executable)
@@ -34,6 +34,7 @@ $abs_top_builddir/tools/virsh --connect test:///default >out 2>err '
   # Create a series of snapshots, with names that intentionally sort
   # differently by topology than by name. Use revert to create fanout.
   snapshot-create-as test s1
+  snapshot-create-as test s1
   snapshot-create-as test s3
   snapshot-create-as test s2
   snapshot-revert test s3
@@ -90,6 +91,7 @@ sed -n '/MarkerB/,/MarkerC/p' < out > s2.xml || fail=1
 
 cat <<\EOF > exp || fail=1
 Domain snapshot s1 created
+
 Domain snapshot s3 created
 Domain snapshot s2 created
 
@@ -171,6 +173,7 @@ EOF
 compare exp out.cooked || fail=1
 
 cat <<EOF > exp || fail=1
+error: operation failed: domain moment s1 already exists
 error: marker
 error: domain 'test' has no current snapshot
 error: marker