[libvirt] [PATCH 1/4] libvirt-guest.init: handle domain name with spaces
Eric Blake
eblake at redhat.com
Fri Mar 11 18:30:31 UTC 2011
On 03/01/2011 10:57 AM, Philipp Hahn wrote:
> 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 at univention.de>
> ---
> tools/libvirt-guests.init.sh | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
> index 8823d06..ea2189e 100644
> --- a/tools/libvirt-guests.init.sh
> +++ b/tools/libvirt-guests.init.sh
> @@ -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"
ACK - this patch is independently useful from Jirka's patch to not use
$name in virsh, because we also use the output of guest_name in
informational messages and should not truncate there. I've pushed it.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110311/770644a4/attachment-0001.sig>
More information about the libvir-list
mailing list