libvirt-guest.init: handle domain name with spaces

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>
This commit is contained in:
Philipp Hahn 2011-03-01 18:57:01 +01:00 committed by Eric Blake
parent a757e60a07
commit 2bbda1444d

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