virsh: require --mac to avoid detach-interface ambiguity

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.
This commit is contained in:
Michal Privoznik 2011-01-25 18:31:00 +01:00 committed by Eric Blake
parent 75da8b8505
commit cee47aace1
2 changed files with 8 additions and 1 deletions

View File

@ -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....]

View 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;