460 |
460 |
_CHROOT_DIR, _CHROOT_QUARANTINE_DIR, _KEYMAP_DIR]
|
461 |
461 |
|
462 |
462 |
PARAMETERS = {
|
|
463 |
constants.HV_KVM_PATH: hv_base.REQ_FILE_CHECK,
|
463 |
464 |
constants.HV_KERNEL_PATH: hv_base.OPT_FILE_CHECK,
|
464 |
465 |
constants.HV_INITRD_PATH: hv_base.OPT_FILE_CHECK,
|
465 |
466 |
constants.HV_ROOT_PATH: hv_base.NO_CHECK,
|
... | ... | |
1026 |
1027 |
hvp = instance.hvparams
|
1027 |
1028 |
|
1028 |
1029 |
pidfile = self._InstancePidFile(instance.name)
|
1029 |
|
kvm = constants.KVM_PATH
|
|
1030 |
kvm = hvp[constants.HV_KVM_PATH]
|
1030 |
1031 |
kvm_cmd = [kvm]
|
1031 |
1032 |
# used just by the vnc server, if enabled
|
1032 |
1033 |
kvm_cmd.extend(["-name", instance.name])
|
... | ... | |
1053 |
1054 |
|
1054 |
1055 |
mversion = hvp[constants.HV_KVM_MACHINE_VERSION]
|
1055 |
1056 |
if not mversion:
|
1056 |
|
mversion = self._GetDefaultMachineVersion(constants.KVM_PATH)
|
|
1057 |
mversion = self._GetDefaultMachineVersion(kvm)
|
1057 |
1058 |
kvm_cmd.extend(["-M", mversion])
|
1058 |
1059 |
|
1059 |
1060 |
kernel_path = hvp[constants.HV_KERNEL_PATH]
|
... | ... | |
1638 |
1639 |
|
1639 |
1640 |
"""
|
1640 |
1641 |
self._CheckDown(instance.name)
|
1641 |
|
kvmhelp = self._GetKVMHelpOutput(constants.KVM_PATH)
|
|
1642 |
kvmpath = instance.hvparams[constants.HV_KVM_PATH]
|
|
1643 |
kvmhelp = self._GetKVMHelpOutput(kvmpath)
|
1642 |
1644 |
kvm_runtime = self._GenerateKVMRuntime(instance, block_devices,
|
1643 |
1645 |
startup_paused, kvmhelp)
|
1644 |
1646 |
self._SaveKVMRuntime(instance, kvm_runtime)
|
... | ... | |
1768 |
1770 |
self.StopInstance(instance, force=True)
|
1769 |
1771 |
# ...and finally we can save it again, and execute it...
|
1770 |
1772 |
self._SaveKVMRuntime(instance, kvm_runtime)
|
1771 |
|
kvmhelp = self._GetKVMHelpOutput(constants.KVM_PATH)
|
|
1773 |
kvmpath = instance.hvparams[constants.HV_KVM_PATH]
|
|
1774 |
kvmhelp = self._GetKVMHelpOutput(kvmpath)
|
1772 |
1775 |
self._ExecuteKVMRuntime(instance, kvm_runtime, kvmhelp)
|
1773 |
1776 |
|
1774 |
1777 |
def MigrationInfo(self, instance):
|
... | ... | |
1795 |
1798 |
"""
|
1796 |
1799 |
kvm_runtime = self._LoadKVMRuntime(instance, serialized_runtime=info)
|
1797 |
1800 |
incoming_address = (target, instance.hvparams[constants.HV_MIGRATION_PORT])
|
1798 |
|
kvmhelp = self._GetKVMHelpOutput(constants.KVM_PATH)
|
|
1801 |
kvmpath = instance.hvparams[constants.HV_KVM_PATH]
|
|
1802 |
kvmhelp = self._GetKVMHelpOutput(kvmpath)
|
1799 |
1803 |
self._ExecuteKVMRuntime(instance, kvm_runtime, kvmhelp,
|
1800 |
1804 |
incoming=incoming_address)
|
1801 |
1805 |
|
... | ... | |
1944 |
1948 |
|
1945 |
1949 |
"""
|
1946 |
1950 |
result = self.GetLinuxNodeInfo()
|
|
1951 |
# FIXME: this is the global kvm version, but the actual version can be
|
|
1952 |
# customized as an hv parameter. we should use the nodegroup's default kvm
|
|
1953 |
# path parameter here.
|
1947 |
1954 |
_, v_major, v_min, v_rev = self._GetKVMVersion(constants.KVM_PATH)
|
1948 |
1955 |
result[constants.HV_NODEINFO_KEY_VERSION] = (v_major, v_min, v_rev)
|
1949 |
1956 |
return result
|
... | ... | |
1992 |
1999 |
Check that the binary exists.
|
1993 |
2000 |
|
1994 |
2001 |
"""
|
|
2002 |
# FIXME: this is the global kvm version, but the actual version can be
|
|
2003 |
# customized as an hv parameter. we should use the nodegroup's default kvm
|
|
2004 |
# path parameter here.
|
1995 |
2005 |
if not os.path.exists(constants.KVM_PATH):
|
1996 |
2006 |
return "The kvm binary ('%s') does not exist." % constants.KVM_PATH
|
1997 |
2007 |
if not os.path.exists(constants.SOCAT_PATH):
|
... | ... | |
2099 |
2109 |
" given time.")
|
2100 |
2110 |
|
2101 |
2111 |
# check that KVM supports SPICE
|
2102 |
|
kvmhelp = cls._GetKVMHelpOutput(constants.KVM_PATH)
|
|
2112 |
kvmhelp = cls._GetKVMHelpOutput(hvparams[constants.HV_KVM_PATH])
|
2103 |
2113 |
if not cls._SPICE_RE.search(kvmhelp):
|
2104 |
2114 |
raise errors.HypervisorError("spice is configured, but it is not"
|
2105 |
2115 |
" supported according to kvm --help")
|