[Libguestfs] [PATCH] Converter: Prefer detected arch of OS if it's available

Richard W.M. Jones rjones at redhat.com
Tue Feb 9 10:04:31 UTC 2010


On Mon, Feb 08, 2010 at 11:29:25AM +0000, Matthew Booth wrote:
> A 32bit VMware host will boot a 64bit OS. However, 32bit KVM won't. This means
> that if you accidentally selected a 32bit machine type at VM creation time on
> ESX, then installed a 64bit OS, chances are you won't notice until you convert
> it and it doesn't work any more. To get round this, we always use the detected
> architecture of the OS if it's available. This will mean that your 32bit machine
> will become a 64bit machine if it has a 64bit OS on it.
> ---
>  lib/Sys/VirtV2V/Converter.pm |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
> index ff4bc05..81abb02 100644
> --- a/lib/Sys/VirtV2V/Converter.pm
> +++ b/lib/Sys/VirtV2V/Converter.pm
> @@ -224,9 +224,8 @@ sub _configure_os
>          $os->appendChild($type);
>      }
>  
> -    # Set type/@arch unless it's already set
> -    my $arch_attr = $type->getAttributes()->getNamedItem('arch');
> -    $type->setAttribute('arch', $arch) unless(defined($arch_attr));
> +    # Set type/@arch based on the detected OS architecture
> +    $type->setAttribute('arch', $arch) if (defined($arch));
>  }
>  

Seems sensible, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list