virt-df: Ignore domains which have ID 0.
authorRichard Jones <rjones@redhat.com>
Tue, 17 Nov 2009 14:21:54 +0000 (14:21 +0000)
committerRichard Jones <rjones@redhat.com>
Tue, 17 Nov 2009 14:21:54 +0000 (14:21 +0000)
This is the remainder of the fix for RHBZ#538041.  Domains
which have ID 0 are special domains.  libvirt defines it as
the "control plane OS".  Only Xen and HyperV have this
behaviour, and in both cases we should ignore those domains
for the purposes of virt-df (user can just run "df" if they
need that information for the dom0).

tools/virt-df

index 6157e21..81e17cd 100755 (executable)
@@ -160,6 +160,9 @@ if (@ARGV == 0) {
     my @doms = $conn->list_defined_domains ();
     push @doms, $conn->list_domains ();
 
     my @doms = $conn->list_defined_domains ();
     push @doms, $conn->list_domains ();
 
+    # https://bugzilla.redhat.com/show_bug.cgi?id=538041
+    @doms = grep { $_->get_id () != 0 } @doms;
+
     my @domnames = map { $_->get_name () } @doms;
 
     if (@domnames) {
     my @domnames = map { $_->get_name () } @doms;
 
     if (@domnames) {