diff --git a/lib/hypervisor/hv_chroot.py b/lib/hypervisor/hv_chroot.py index 991bb7326ba0087bd3b26a5f5fe859ecb6d7c23d..bbc79b7a4432370093667965902559d56958ed9a 100644 --- a/lib/hypervisor/hv_chroot.py +++ b/lib/hypervisor/hv_chroot.py @@ -32,6 +32,7 @@ from ganeti import constants from ganeti import errors # pylint: disable=W0611 from ganeti import utils from ganeti import objects +from ganeti import pathutils from ganeti.hypervisor import hv_base from ganeti.errors import HypervisorError @@ -58,7 +59,7 @@ class ChrootManager(hv_base.BaseHypervisor): - instance alive check is based on whether any process is using the chroot """ - _ROOT_DIR = constants.RUN_DIR + "/chroot-hypervisor" + _ROOT_DIR = pathutils.RUN_DIR + "/chroot-hypervisor" PARAMETERS = { constants.HV_INIT_SCRIPT: (True, utils.IsNormAbsPath, diff --git a/lib/hypervisor/hv_fake.py b/lib/hypervisor/hv_fake.py index 6b7ab72c7e04997b78d70367b3517a1b3015c1d2..0f85e8cdaed76e855e7a7433026f58749806e1c9 100644 --- a/lib/hypervisor/hv_fake.py +++ b/lib/hypervisor/hv_fake.py @@ -31,6 +31,7 @@ from ganeti import utils from ganeti import constants from ganeti import errors from ganeti import objects +from ganeti import pathutils from ganeti.hypervisor import hv_base @@ -43,7 +44,7 @@ class FakeHypervisor(hv_base.BaseHypervisor): """ CAN_MIGRATE = True - _ROOT_DIR = constants.RUN_DIR + "/fake-hypervisor" + _ROOT_DIR = pathutils.RUN_DIR + "/fake-hypervisor" def __init__(self): hv_base.BaseHypervisor.__init__(self) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 1ae01e427cb76a33670a16fbe90e17619457284d..e928c51a1d9eb66a82b928f47238e29307182696 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -49,12 +49,13 @@ from ganeti import serializer from ganeti import objects from ganeti import uidpool from ganeti import ssconf -from ganeti.hypervisor import hv_base from ganeti import netutils +from ganeti import pathutils +from ganeti.hypervisor import hv_base from ganeti.utils import wrapper as utils_wrapper -_KVM_NETWORK_SCRIPT = constants.SYSCONFDIR + "/ganeti/kvm-vif-bridge" +_KVM_NETWORK_SCRIPT = pathutils.SYSCONFDIR + "/ganeti/kvm-vif-bridge" _KVM_START_PAUSED_FLAG = "-S" # TUN/TAP driver constants, taken from <linux/if_tun.h> @@ -404,7 +405,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): """ CAN_MIGRATE = True - _ROOT_DIR = constants.RUN_DIR + "/kvm-hypervisor" + _ROOT_DIR = pathutils.RUN_DIR + "/kvm-hypervisor" _PIDS_DIR = _ROOT_DIR + "/pid" # contains live instances pids _UIDS_DIR = _ROOT_DIR + "/uid" # contains instances reserved uids _CTRL_DIR = _ROOT_DIR + "/ctrl" # contains instances control sockets @@ -777,7 +778,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED: env["BRIDGE"] = nic.nicparams[constants.NIC_LINK] - result = utils.RunCmd([constants.KVM_IFUP, tap], env=env) + result = utils.RunCmd([pathutils.KVM_IFUP, tap], env=env) if result.failed: raise errors.HypervisorError("Failed to configure interface %s: %s." " Network configuration script output: %s" % @@ -1195,10 +1196,10 @@ class KVMHypervisor(hv_base.BaseHypervisor): if hvp[constants.HV_KVM_SPICE_USE_TLS]: spice_arg = ("%s,tls-port=%s,x509-cacert-file=%s" % (spice_arg, instance.network_port, - constants.SPICE_CACERT_FILE)) + pathutils.SPICE_CACERT_FILE)) spice_arg = ("%s,x509-key-file=%s,x509-cert-file=%s" % - (spice_arg, constants.SPICE_CERT_FILE, - constants.SPICE_CERT_FILE)) + (spice_arg, pathutils.SPICE_CERT_FILE, + pathutils.SPICE_CERT_FILE)) tls_ciphers = hvp[constants.HV_KVM_SPICE_TLS_CIPHERS] if tls_ciphers: spice_arg = "%s,tls-ciphers=%s" % (spice_arg, tls_ciphers) @@ -1824,7 +1825,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): """ if hvparams[constants.HV_SERIAL_CONSOLE]: - cmd = [constants.KVM_CONSOLE_WRAPPER, + cmd = [pathutils.KVM_CONSOLE_WRAPPER, constants.SOCAT_PATH, utils.ShellQuote(instance.name), utils.ShellQuote(cls._InstanceMonitor(instance.name)), "STDIO,%s" % cls._SocatUnixConsoleParams(), diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index 49fd77a310f5260e4ad6d762fc01e81f8f74fdc4..2d968951965e348ee2a69cf54894bc99a4c1fdfb 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -32,6 +32,7 @@ from ganeti import constants from ganeti import errors # pylint: disable=W0611 from ganeti import utils from ganeti import objects +from ganeti import pathutils from ganeti.hypervisor import hv_base from ganeti.errors import HypervisorError @@ -65,7 +66,7 @@ class LXCHypervisor(hv_base.BaseHypervisor): notify_on_release and release_agent feature of cgroups """ - _ROOT_DIR = constants.RUN_DIR + "/lxc" + _ROOT_DIR = pathutils.RUN_DIR + "/lxc" _DEVS = [ "c 1:3", # /dev/null "c 1:5", # /dev/zero diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 81adeb9ee587e499a61d9af5836f0a93c11e6dea..72742405b6c8543b7ec7f6dd02571dbf47c8ffc3 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -32,6 +32,7 @@ from ganeti import utils from ganeti.hypervisor import hv_base from ganeti import netutils from ganeti import objects +from ganeti import pathutils XEND_CONFIG_FILE = "/etc/xen/xend-config.sxp" @@ -420,7 +421,7 @@ class XenHypervisor(hv_base.BaseHypervisor): kind=constants.CONS_SSH, host=instance.primary_node, user=constants.GANETI_RUNAS, - command=[constants.XM_CONSOLE_WRAPPER, + command=[pathutils.XM_CONSOLE_WRAPPER, instance.name]) def Verify(self): @@ -707,10 +708,10 @@ class XenHvmHypervisor(XenHypervisor): """Xen HVM hypervisor interface""" ANCILLARY_FILES = XenHypervisor.ANCILLARY_FILES + [ - constants.VNC_PASSWORD_FILE, + pathutils.VNC_PASSWORD_FILE, ] ANCILLARY_FILES_OPT = XenHypervisor.ANCILLARY_FILES_OPT + [ - constants.VNC_PASSWORD_FILE, + pathutils.VNC_PASSWORD_FILE, ] PARAMETERS = {