]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: require --mac to avoid detach-interface ambiguity
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Jan 2011 17:31:00 +0000 (18:31 +0100)
committerEric Blake <eblake@redhat.com>
Tue, 25 Jan 2011 17:47:28 +0000 (10:47 -0700)
bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050

virsh simply refutes to detach-interface in case when multiple
interfaces are attached and --mac is not specified.

AUTHORS
tools/virsh.c

diff --git a/AUTHORS b/AUTHORS
index c704a416264b8fe8ad2a9c2b8077e1aa57d37068..4bc02b65b6e2ace7f5120e9fcf0dcf55546795a0 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -23,7 +23,7 @@ The primary maintainers and people with commit access rights:
   Guido Günther        <agx@sigxcpu.org>
   John Levon           <john.levon@sun.com>
   Matthias Bolte       <matthias.bolte@googlemail.com>
-  Jiri Denemark        <jdenemar@redhat.com>
+  Jiří Denemark        <jdenemar@redhat.com>
   Dave Allan           <dallan@redhat.com>
   Laine Stump          <laine@redhat.com>
   Stefan Berger        <stefanb@us.ibm.com>
@@ -144,6 +144,7 @@ Patches have also been contributed by:
   Paweł Krześniak      <pawel.krzesniak@gmail.com>
   Kay Schubert         <kayegypt@web.de>
   Marc-André Lureau    <marcandre.lureau@redhat.com>
+  Michal Prívozník     <mprivozn@redhat.com>
 
   [....send patches to get your name here....]
 
index aba794520b4d04dde060977ddea85d4e48dce5c4..4533d3899e3f4bfff57f701a1c8356e43dc594ed 100644 (file)
@@ -8557,6 +8557,12 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
         goto cleanup;
     }
 
+    if ((!mac) && (obj->nodesetval->nodeNr > 1)) {
+        vshError(ctl, _("Domain has %d interfaces. Please specify which one "
+                        "to detach using --mac"), obj->nodesetval->nodeNr);
+        goto cleanup;
+    }
+
     if (!mac)
         goto hit;