Status: Accepted
Owner: [email protected]
Labels: Type-Defect Milestone-Release2.9

New issue 691 by [email protected]: KVM path is not honoured
http://code.google.com/p/ganeti/issues/detail?id=691

This issue applies only to systems where /usr/bin/kvm does not exist. Let's assume the KVM path is /usr/bin/qemu-kvm, as it is in Slackware 14.1. In order for this Slackware KVM path to work, it is necessary to either specify it as a configure option (which is not the case for this issue) or use gnt-* modify. This issue focuses only on the latter.

At some point, when an instance is created, the KVM path is part of the instance hvparams. This means that this argument must be passed around in order for the kvm path to be properly used. However, the method 'BaseHypervisor._InstanceStartupMemory', which takes the 'hvparams' keyword argument, is not being properly called in several place in the code (i.e., hvparams is not being passed), which means that KVM is not properly invoked. Curiously enough, the issue happens with every second try of starting a machine. Here is how to exercise the issue:

# gnt-instance add -n <node> -o <os> --no-install -H kvm:boot_order=cdrom,cdrom_image_path=<image>-t file -s 1024m <inst>

This will create a stopped instance

  # gnt-instance start <inst>

This will fail the first time. Here is the backtrace (notice the call to _InstanceStartupMemory):

  Traceback (most recent call last):
File "/usr/share/ganeti/2.10/ganeti/server/noded.py", line 181, in HandleRequest
      result = (True, method(serializer.LoadJson(req.request_body)))
File "/usr/share/ganeti/2.10/ganeti/server/noded.py", line 616, in perspective_instance_start
      return backend.StartInstance(instance, startup_paused, trail)
File "/usr/share/ganeti/2.10/ganeti/backend.py", line 1691, in StartInstance
      hyper.StartInstance(instance, block_devices, startup_paused)
File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_kvm.py", line 1979, in StartInstance
      self._ExecuteKVMRuntime(instance, kvm_runtime, kvmhelp)
File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_kvm.py", line 1959, in _ExecuteKVMRuntime
      start_memory = self._InstanceStartupMemory(instance)
File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_base.py", line 397, in _InstanceStartupMemory
      free_memory = self.GetNodeInfo(hvparams=hvparams)["memory_free"]
File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_kvm.py", line 2467, in GetNodeInfo
      _, v_major, v_min, v_rev = self._GetKVMVersion(kvmpath)
File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_kvm.py", line 2223, in _GetKVMVersion return cls._ParseKVMVersion(cls._GetKVMOutput(kvm_path, cls._KVMOPT_HELP)) File "/usr/share/ganeti/2.10/ganeti/hypervisor/hv_kvm.py", line 2209, in _GetKVMOutput
      result = utils.RunCmd([kvm_path] + optlist)
File "/usr/share/ganeti/2.10/ganeti/utils/process.py", line 229, in RunCmd
      (strcmd, err))
OpExecError: Can't execute '/usr/bin/kvm --help': not found ([Errno 2] No such file or directory)

  # gnt-instance start <inst>

This will work the second time (I can't explain why).

The patch in attachment fixes this issue. However, it does not fix the
underlying problem. The following lines occur in 'KVMHypervisor.GetNodeInfo'
and 'KVMHypervisor.Verify':

   kvmpath = constants.KVM_PATH
   if hvparams is not None:
    kvmpath = hvparams.get(constants.HV_KVM_PATH, constants.KVM_PATH)

These lines allow hvparams to be passed as None (or not passed at all
given that it is an optional argument to these functions) and, therefore,
allow the use of the configured KVM path, which is wrong. These functions
and calls to them should be revised and if possible the hvparams should
become a mandatory argument. This, however, is not in the patch.

Patch in the next comment.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Reply via email to