vmbuilder fails to start if there is a guest running in libvirt

Bug #284746 reported by Mathias Gug
2
Affects Status Importance Assigned to Milestone
VMBuilder
Fix Released
Undecided
Unassigned
vm-builder (Ubuntu)
Fix Released
High
Unassigned

Bug Description

If there is *any* domain running in the target libvirt daemon, vmbuilder fails to start:

mathiaz@mathiaz-srv2:~$ virsh list
Connecting to uri: qemu:///system
 Id Name State
----------------------------------
 24 hardy-virtual-i386 running

mathiaz@mathiaz-srv2:~$ sudo vmbuilder kvm ubuntu --hostname does-not-exist
2008-10-16 22:45:00,597 CRITICAL Oh, dear, an exception occurred
2008-10-16 22:45:00,597 INFO Cleaning up
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 29, in <module>
    VMBuilder.run()
  File "/usr/lib/python2.5/site-packages/VMBuilder/__init__.py", line 66, in run
    frontend.run()
  File "/usr/lib/python2.5/site-packages/VMBuilder/plugins/cli/__init__.py", line 61, in run
    vm.create()
  File "/usr/lib/python2.5/site-packages/VMBuilder/vm.py", line 426, in create
    self.preflight_check()
  File "/usr/lib/python2.5/site-packages/VMBuilder/vm.py", line 390, in preflight_check
    self.call_hooks('preflight_check')
  File "/usr/lib/python2.5/site-packages/VMBuilder/vm.py", line 163, in call_hooks
    getattr(plugin, func)()
  File "/usr/lib/python2.5/site-packages/VMBuilder/plugins/libvirt/__init__.py", line 41, in preflight_check
    if self.vm.hostname in self.all_domains() and not self.vm.overwrite:
  File "/usr/lib/python2.5/site-packages/VMBuilder/plugins/libvirt/__init__.py", line 32, in all_domains
    return self.conn.listDefinedDomains() + [self.conn.lookupById(id).name for id in self.conn.listDomainsID()]
AttributeError: virConnect instance has no attribute 'lookupById'

Related branches

Revision history for this message
Nick Barcet (nijaba) wrote :

Definitely a problem in the libvirt plugin

Changed in vm-builder:
importance: Undecided → High
status: New → Confirmed
Changed in vmbuilder:
status: New → Confirmed
Revision history for this message
Nick Barcet (nijaba) wrote :

Added a method isDomain(name) to replace all_domains in VMBuilder/plugins/libvirt/__init__.py as it was failing as soon as a domain was defined.
Pushed to trunk

Changed in vm-builder:
status: Confirmed → Fix Committed
Changed in vmbuilder:
status: Confirmed → Fix Committed
Revision history for this message
Bryan McLellan (btm) wrote :

This is caused by a typo in VMBuilder/plugins/libvirt/__init__.py. It should be lookupByID, not lookupById. See attached patch against trunk.

Revision history for this message
Nick Barcet (nijaba) wrote :

Bryan, thanks for the patch, but I had already fixed this bug using a simpler/more appropriate lookupByName.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vm-builder - 0.9-0ubuntu3

---------------
vm-builder (0.9-0ubuntu3) intrepid; urgency=low

  [ Johan Euphrosine ]
  * Fix exception when suite provided does not exist (LP: #281801)
    and provide unit test for it.

  [ Chuck Short ]
  * Added parameters required for EC2 plugin.
  * Use ec2_name instead of hostname when submitting an AMI.
  * Update xen_kernel_path and xen_ramdisk_path for intrepid.
  * Default to amazon kernels/ramdisk pairs for now.
  * Split out ec2 module into its own package. (LP: #284762)

  [ Nicolas Barcet ]
  * Error out if domain is undefined (LP: #280125)
  * Fix --dest so that it is actually used now (LP: #280091)
  * Fix -c handling, values are now used (LP: #279159)
  * Create /var/run/network to fix bug LP: #276365
  * Handle fsimage type vms (Xen) in fstab and (hopefully) libvirt (LP: #282109)
  * Components where not parsed correctly (LP: #283263)
  * preflight_check() was called twice in a row in vm.py for no aparant
    reasons
  * Change default suite to intrepid
  * Intrepid needs groot=uuid, else update-grub tries to outsmart us later on
    and it won't boot as it cannot guess the uuid right.
  * Couple fixes when calling devletters, which is a function
  * Double parenthesis removed in devicemap.tmpl
  * Added function isDomain to fix bug LP: #284746
  * Documented unusual conf name value in help to fix bug LP: #284614
  * Fixed a bug in set_defaults occuring on reading untyped value from the
    configuration file
  * Match ec2 vocabulary by adding option name and clarifying help
    (LP: #284765, LP: #285170, LP: #285165)
  * Added a check for xen hypervisor when ec2 is selected (LP: #285191)
  * Added checks for presence of bucket, access key and secret key for ec2
    (LP: #284757)
  * Older suite need 128 bit inode for grub to recognize os. Thanks to Albert
    Damen for the pointer (LP: #285093)
  * The libvirt plugin now errors out if used with something else than KVM, as
    nothing else is supported yet.
  * Write out disk info in vmware's .vmx, converting it to use template while
    at it (LP: #286487)
  * Add 'config.version = "8"' to vmware.tmpl to fix LP: #286531

  [ Mathias Gug ]
  * Fix --templates option.

  [ Soren Hansen ]
  * Create /var/{run,lock} on the root filesystem, just like d-i.

 -- Soren Hansen <email address hidden> Fri, 24 Oct 2008 13:15:23 +0200

Changed in vm-builder:
status: Fix Committed → Fix Released
Nick Barcet (nijaba)
Changed in vmbuilder:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.