[Ovirt-devel] Provisioning Windows

Justin Clacherty justin at redfish.com.au
Fri Sep 10 05:55:43 UTC 2010


>   How do I go about provisioning a windows VM?  I've added the iso to
> cobbler using the following command.
> 
> cobbler image add --name=W2k8Prov --
> file=nfs://192.168.50.190/ovirt/w2k8.iso
> 
> The image then appears in the list of Operating Systems to choose when
> creating a VM.  I select the image when I create the VM but then when I go
> to save I get the error:
> 
> undefined method `keys' for "~":String
> 
> How are people provisioning Windows VMs?
> 

My guess is that people don't.  I've spent a bit of time on this today and
have managed to get a VM booting using an installation ISO.  It seems
there's some problems with cobbler (or how it's used).  I'm still having
problems though so bear with me.

The problem with installing off ISOs are two-fold.

1) Provisioning the VM fails because Cobbler::System.find_one() does not
behave as expected.
2) The xml sent to libvirtd on the node is incorrect.

Provisioning Windows Server 2008 R2 is still a problem once this is
resolved.  This is seemingly because the version of KVM on the node doesn't
work with W2k8R2.

Here's the first two problems which I've managed to work around.  I hope
this a) helps out anyone else trying to install off an ISO, and b) helps the
developers fix the issue which as far as I can tell from the mailing list
has been around for a while.

This is the error I was seeing in rails.log

Processing VmController#update (for 192.168.42.111 at 2010-09-10 01:57:16)
[POST]
  Parameters: {"vm"=>{"nics"=>"#<Nic:0x7f9df2ec3e60>",
"provisioning_and_boot_settings"=>"image at cobbler:W2k8Prov",
"storage_volume_ids"=>["16"], "vm_resource_pool_id"=>"5",
"uuid"=>"59048cfa-d91d-bb65-27b2-edfc5e863d79",
"description"=>"Exchange2010", "memory_allocated_in_mb"=>"4096",
"num_vcpus_allocated"=>"4"}, "id"=>"8", "macs"=>["00:16:3e:76:7b:36", ""],
"networks"=>["1", ""]}

NoMethodError (undefined method `keys' for "~":String):
  (eval):9:in `find_one'
  app/services/vm_service.rb:297:in `vm_provision'
  app/services/vm_service.rb:169:in `svc_update'
  app/services/vm_service.rb:160:in `svc_update'
  app/controllers/vm_controller.rb:81:in `update'

The line in vm_provision is

System = Cobbler::System.find_one(name)

Looking at the code around it I'm guessing that the author assumed that
Cobbler::System.find_one() would return null (or is it nil in ruby?) if the
system wasn't found in cobbler.  It seems that what actually happens is that
some exception is thrown (or whatever the ruby equivalent to an exception
is) instead so everything failed.  Not knowing ruby at all and knowing that
the system wasn't there I just commented out the check and let it simply add
the system.  That allowed the VM settings to be saved and the VM was created
in the user interface.  I then put the code that I commented out back in to
see if find_one would still be a problem.  Wasn't a problem anymore, could
edit the VM and everything which is why I'm assuming that the assumptions
about what find_one does when the system isn't in cobbler are incorrect.

Now when you boot the VM it tries to boot of the cdrom as you'd expect only
it can't actually find the cdrom.  I logged on to the node and did a dump of
the xml for the vm.  The OS was set to boot off cdrom as expected, however,
there's no cdrom entry in there at all.  The ISO is described as a "disk".

To get around this I:
- started the VM
- logged in to the node running the VM
- dumped the xml for the VM to a file
- in the disk entry for the ISO I changed <disk type='block' device='disk'>
to <disk type='block' device='cdrom'>
- destroyed the running VM
- created the VM from the edited xml file

The VM boots, finds the cdrom and does its thing.

Sorry if that's all a bit long winded but I hope it helps.

Now as far as installing W2k8R2 goes, has anyone managed that?  It starts to
boot and then just stops, the VM gets destroyed so I'm assuming it crashes.
The same problem occurs with Win7 and SBS2008R2 at about the same point.  I
have installed SBS2008R2 under kvm on a RHEL5.5 box without issue.  I've
seen mention of a bug where W2k8R2 has a BSOD under KVM.  This has
apparently been fixed but perhaps it hasn't made it to the version of
qemu-kvm in ovirt.

Any help would be appreciated.

Cheers,
Justin.





More information about the ovirt-devel mailing list