]> xenbits.xensource.com Git - libvirt.git/commitdiff
libvirt-guest.init: handle domain name with spaces
authorPhilipp Hahn <hahn@univention.de>
Tue, 1 Mar 2011 17:57:01 +0000 (18:57 +0100)
committerEric Blake <eblake@redhat.com>
Fri, 11 Mar 2011 18:24:44 +0000 (11:24 -0700)
awk splits the line on consecutive spaces, which breaks getting the name
of a domain whose name contains spaces. Use sed instead to strip the
"Name:" prefix from the line

Signed-off-by: Philipp Hahn <hahn@univention.de>
tools/libvirt-guests.init.sh

index 8823d06e14b469d27618f5ef10a024c2dc3fa367..ea2189e1aa3b2b4c9b918e2414514d5a6dcc2134 100644 (file)
@@ -105,7 +105,7 @@ guest_name() {
     uuid=$2
 
     name=$(run_virsh_c $uri dominfo $uuid 2>/dev/null | \
-           awk '/^Name:/{print $2}')
+           sed -ne 's/^Name: *//p')
     [ -n "$name" ] || name=$uuid
 
     echo "$name"