diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-07-29 09:48:08 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-07-29 12:32:01 +0100 |
commit | 06df9ec2413d7f5ae366bfab1b2177d7b3929837 (patch) | |
tree | 6990c5c60af41d580136c7401aa2cf379f7f1bb0 /inspector | |
parent | 1f65b900f0f17a700035dea9a76b910504f4507c (diff) | |
download | libguestfs-06df9ec2413d7f5ae366bfab1b2177d7b3929837.tar.gz libguestfs-06df9ec2413d7f5ae366bfab1b2177d7b3929837.tar.xz libguestfs-06df9ec2413d7f5ae366bfab1b2177d7b3929837.zip |
inspector: Determine guest architecture.
This commit adds kernel and userspace architecture detection
(fully for Linux, partially for Windows). It adds an architecture
for each kernel detected, and an architecture for each root (ie.
userspace) found.
Diffstat (limited to 'inspector')
-rwxr-xr-x | inspector/virt-inspector.pl | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl index 9148a486..d2acf062 100755 --- a/inspector/virt-inspector.pl +++ b/inspector/virt-inspector.pl @@ -357,6 +357,7 @@ sub output_text_os print $os->{os}, " " if exists $os->{os}; print $os->{distro}, " " if exists $os->{distro}; + print $os->{arch}, " " if exists $os->{arch}; print $os->{major_version} if exists $os->{major_version}; print ".", $os->{minor_version} if exists $os->{minor_version}; print " "; @@ -415,7 +416,7 @@ sub output_text_os print __" Kernels:\n"; my @kernels = @{$os->{kernels}}; foreach (@kernels) { - print " $_->{version}\n"; + print " $_->{version} ($_->{arch})\n"; my @modules = @{$_->{modules}}; foreach (@modules) { print " $_\n"; @@ -450,6 +451,7 @@ sub output_xml_os foreach ( [ "name" => "os" ], [ "distro" => "distro" ], + [ "arch" => "arch" ], [ "major_version" => "major_version" ], [ "minor_version" => "minor_version" ], [ "package_format" => "package_format" ], @@ -531,7 +533,9 @@ sub output_xml_os $xml->startTag("kernels"); my @kernels = @{$os->{kernels}}; foreach (@kernels) { - $xml->startTag("kernel", "version" => $_->{version}); + $xml->startTag("kernel", + "version" => $_->{version}, + "arch" => $_->{arch}); $xml->startTag("modules"); my @modules = @{$_->{modules}}; foreach (@modules) { @@ -591,6 +595,8 @@ sub output_query output_query_xen_domU_kernel (); output_query_xen_pv_drivers (); output_query_virtio_drivers (); + output_query_kernel_arch (); + output_query_userspace_arch (); } =item windows=(yes|no) @@ -763,6 +769,50 @@ sub output_query_virtio_drivers print "virtio_drivers=no\n"; } +=item userspace_arch=(x86_64|...) + +Print the architecture of userspace. + +NB. For multi-boot VMs this can print several lines. + +=cut + +sub output_query_userspace_arch +{ + my %arches; + + foreach my $os (keys %$oses) { + $arches{$oses->{$os}->{arch}} = 1 if exists $oses->{$os}->{arch}; + } + + foreach (sort keys %arches) { + print "userspace_arch=$_\n"; + } +} + +=item kernel_arch=(x86_64|...) + +Print the architecture of the kernel. + +NB. For multi-boot VMs this can print several lines. + +=cut + +sub output_query_kernel_arch +{ + my %arches; + + foreach my $os (keys %$oses) { + foreach my $kernel (@{$oses->{$os}->{kernels}}) { + $arches{$kernel->{arch}} = 1 if exists $kernel->{arch}; + } + } + + foreach (sort keys %arches) { + print "kernel_arch=$_\n"; + } +} + =back =head1 SEE ALSO |