On 01/25/2011 10:31 AM, Michal Privoznik wrote:
When browsing git history summaries, I don't want to have to click a URL
to see what the fix was about. Remember that your subject line will
become part of the NEWS file at the next release; browsing that file (or
doing git shortlog -30) will give you a feel for a good commit message.
Including a one-word topic followed by a short phrase works best, so
I'm retitling this:
virsh: require --mac to avoid detach-interface ambiguity
However, I'm also keeping the BZ in the body of the commit message, as
it can come in handy when viewing the full patch.
virsh simply refutes to detach-interface in case when multiple
interfaces are attached and --mac is not specified.
---
tools/virsh.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index aba7945..f965fc0 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8557,6 +8557,11 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
+ if ((!mac) && (obj->nodesetval->nodeNr > 1)) {
In my coding style, I tend to avoid the extra () around each branch of
&& for simple operations (both ! and > qualify as simple in my mind;
whereas bitwise & and | do not). But you're not the first to do that,
so I won't change it.
+ vshError(ctl, _("Domain has %d interfaces. Please
specify which one you want to detach using --mac"), obj->nodesetval->nodeNr);
Long line; I'm wrapping to 80 columns.
+ goto cleanup;
+ }
ACK; pushed as modified.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org