ganeti2 can not determine kvm version

Bug #932166 reported by Dennis Olsson
64
This bug affects 13 people
Affects Status Importance Assigned to Milestone
ganeti (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

root@terra:~# lsb_release -rd
Description: Ubuntu precise (development branch)
Release: 12.04

root@terra:~# apt-cache policy ganeti2 kvm qemu-kvm
ganeti2:
  Installed: 2.4.5-1
  Candidate: 2.4.5-1
  Version table:
 *** 2.4.5-1 0
        500 http://se.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status
kvm:
  Installed: 1:84+dfsg-0ubuntu16+1.0+noroms+0ubuntu4
  Candidate: 1:84+dfsg-0ubuntu16+1.0+noroms+0ubuntu4
  Version table:
 *** 1:84+dfsg-0ubuntu16+1.0+noroms+0ubuntu4 0
        500 http://se.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
qemu-kvm:
  Installed: 1.0+noroms-0ubuntu4
  Candidate: 1.0+noroms-0ubuntu4
  Version table:
 *** 1.0+noroms-0ubuntu4 0
        500 http://se.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

== What I did ==

Installed ganeti2 (and thereby kvm). configured stuff (I don't think that's important), ran the following:

root@terra:~# gnt-instance add -n terra.example.com -o debootstrap+default -t plain --disk 0:size=30g -B memory=512 --net 0:bridge=srv-br0 machine.example.com
Tue Feb 14 16:24:33 2012 * disk 0, vg terra_data, name e62f5874-4465-49b6-9090-367d53f3ec4a.disk0
Tue Feb 14 16:24:33 2012 * creating instance disks...
Tue Feb 14 16:24:34 2012 adding instance machine.example.com to cluster config
Tue Feb 14 16:24:36 2012 - INFO: Waiting for instance machine.example.com to sync disks.
Tue Feb 14 16:24:36 2012 - INFO: Instance machine.example.com's disks are in sync.
Tue Feb 14 16:24:37 2012 * running the instance OS create scripts...
Tue Feb 14 16:31:24 2012 * starting instance...
Failure: command execution error:
Could not start instance: Hypervisor error: Unable to get KVM version

== Investigating ==

root@terra:/tmp# apt-get source ganeti2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'ganeti' as source package instead of 'ganeti2'
NOTICE: 'ganeti' packaging is maintained in the 'Git' version control system at:
git://git.debian.org/pkg-ganeti/ganeti.git
Need to get 1,839 kB of source archives.
Get:1 http://se.archive.ubuntu.com/ubuntu/ precise/universe ganeti 2.4.5-1 (dsc) [2,062 B]
Get:2 http://se.archive.ubuntu.com/ubuntu/ precise/universe ganeti 2.4.5-1 (tar) [1,828 kB]
Get:3 http://se.archive.ubuntu.com/ubuntu/ precise/universe ganeti 2.4.5-1 (diff) [8,738 B]
Fetched 1,839 kB in 0s (6,103 kB/s)
sh: 1: dpkg-source: not found
Unpack command 'dpkg-source -x ganeti_2.4.5-1.dsc' failed.
Check if the 'dpkg-dev' package is installed.
E: Child process failed
root@terra:/tmp# tar xf ganeti_2.4.5.orig.tar.gz
root@terra:/tmp# tar xf ganeti_2.4.5-1.debian.tar.gz
root@terra:/tmp# grep 'Unable to get KVM version' -rn .
./ganeti-2.4.5/lib/hypervisor/hv_kvm.py:513: raise errors.HypervisorError("Unable to get KVM version")
./ganeti-2.4.5/lib/hypervisor/hv_kvm.py:789: raise errors.HypervisorError("Unable to get KVM version")

Both lines lead to:
 927 def _GetKVMVersion(cls):
which has:
 933 result = utils.RunCmd([constants.KVM_PATH, "--help"])
 934 if result.failed:
 935 return None
 936 match = cls._VERSION_RE.search(result.output.splitlines()[0])

_VERSION_RE is defined as:
root@terra:/tmp# grep _VERSION_RE\ = * -rn | grep kvm
ganeti-2.4.5/lib/hypervisor/hv_kvm.py:202: _VERSION_RE = re.compile(r"\b(\d+)\.(\d+)\.(\d+)\b")

Testing:
root@terra:/tmp# kvm --help | head -n1
QEMU emulator version 1.0 (qemu-kvm-1.0), Copyright (c) 2003-2008 Fabrice Bellard

There you go. Ganeti expects three fields, kvm in Ubuntu only has two.

Revision history for this message
Iustin Pop (iustin) wrote :

Hi,

This was fixed in newer version (2.5), which should be released soon. Not sure right now if backporting it is easy and can be integrated; see http://git.ganeti.org/?p=ganeti.git;a=commit;h=585c8187c08a31e40a741c6fddadb6a6191e5c99

Revision history for this message
Dennis Olsson (cyberdo) wrote :

Thanks. Hand patching for now.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ganeti (Ubuntu):
status: New → Confirmed
Revision history for this message
Ralf Spenneberg (ralq) wrote :

This patch fixes it:
http://groups.google.com/group/ganeti/attach/95e8de340d1b4b70/fix-qemu-1.0-compat.patch?part=2

--- a/lib/hypervisor/hv_kvm.py 2012-02-01 13:14:28.556767386 +0000
+++ b/lib/hypervisor/hv_kvm.py 2012-02-01 13:17:02.431087060 +0000
@@ -199,7 +199,7 @@
   _MIGRATION_INFO_MAX_BAD_ANSWERS = 5
   _MIGRATION_INFO_RETRY_DELAY = 2

- _VERSION_RE = re.compile(r"\b(\d+)\.(\d+)\.(\d+)\b")
+ _VERSION_RE = re.compile(r"\b(\d+)\.(\d+)(\.(\d+))?\b")

   ANCILLARY_FILES = [
     _KVM_NETWORK_SCRIPT,
@@ -924,21 +924,40 @@
     return result

   @classmethod
+ def _ParseKVMVersion(cls, text):
+ """Parse the KVM version from the --help output.
+
+ @type text: string
+ @param text: output of kvm --help
+ @return: (version, v_maj, v_min, v_rev)
+ @raise L{errors.HypervisorError}: when the KVM version cannot be retrieved
+
+ """
+ match = cls._VERSION_RE.search(text.splitlines()[0])
+ if not match:
+ raise errors.HypervisorError("Unable to get KVM version")
+
+ v_all = match.group(0)
+ v_maj = int(match.group(1))
+ v_min = int(match.group(2))
+ if match.group(4):
+ v_rev = int(match.group(4))
+ else:
+ v_rev = 0
+ return (v_all, v_maj, v_min, v_rev)
+
+ @classmethod
   def _GetKVMVersion(cls):
     """Return the installed KVM version

     @return: (version, v_maj, v_min, v_rev), or None
+ @raise L{errors.HypervisorError}: when the KVM version cannot be retrieved

     """
     result = utils.RunCmd([constants.KVM_PATH, "--help"])
     if result.failed:
- return None
- match = cls._VERSION_RE.search(result.output.splitlines()[0])
- if not match:
- return None
-
- return (match.group(0), int(match.group(1)), int(match.group(2)),
- int(match.group(3)))
+ raise errors.HypervisorError("Unable to get KVM version")
+ return cls._ParseKVMVersion(result.output)

   def StopInstance(self, instance, force=False, retry=False, name=None):
     """Stop an instance.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fix-qemu-1.0-compat.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
andrew bezella (abezella) wrote :

i can confirm that the patch allows an instance to start.

Revision history for this message
Devin Vance (devin-p) wrote :

I also can confirm that after applying this patch, and restarting ganeti I am able to startup instances again.

Revision history for this message
Jimmy Angelakos (vyruss) wrote :

Patch is a Confirmed fix on 12.04. Many thanks

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.