Commit 425ebca4 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Jose A. Lopes

kvm: use a dedicated QMP socket for kvmd

The KVM daemon keeps a persistent connection to the instances' QMP
sockets, listening for asynchronous events. As each monitor socket
(either human, or QMP) can handle only one client at a time, this has
the side-effect that QMP cannot be used for regular instance operations.

We fix this by adding a dedicated QMP socket for use by kvmd and
changing kvmd to look only for sockets with the specific extension.

Note that this change means that kvmd will not be able to monitor
already running instances spawned by older versions of Ganeti.
Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent 0f14c375
......@@ -925,6 +925,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
"""
return utils.PathJoin(cls._CTRL_DIR, "%s.qmp" % instance_name)
@classmethod
def _InstanceKvmdMonitor(cls, instance_name):
"""Returns the instance kvm daemon socket name
"""
return utils.PathJoin(cls._CTRL_DIR, "%s.kvmd" % instance_name)
@classmethod
def _InstanceShutdownMonitor(cls, instance_name):
"""Returns the instance QMP output filename
......@@ -1929,6 +1936,9 @@ class KVMHypervisor(hv_base.BaseHypervisor):
logging.debug("Enabling QMP")
kvm_cmd.extend(["-qmp", "unix:%s,server,nowait" %
self._InstanceQmpMonitor(instance.name)])
# Add a second monitor for kvmd
kvm_cmd.extend(["-qmp", "unix:%s,server,nowait" %
self._InstanceKvmdMonitor(instance.name)])
# Configure the network now for starting instances and bridged interfaces,
# during FinalizeMigration for incoming instances' routed interfaces
......
......@@ -90,7 +90,7 @@ monitorDir :: String
monitorDir = AutoConf.localstatedir </> "run/ganeti/kvm-hypervisor/ctrl/"
monitorExtension :: String
monitorExtension = ".qmp"
monitorExtension = ".kvmd"
isMonitorPath :: FilePath -> Bool
isMonitorPath = (== monitorExtension) . takeExtension
......
......@@ -59,7 +59,7 @@ delayKvmd = threadDelay 1000000
detectShutdown :: (Handle -> IO ()) -> IO Bool
detectShutdown putFn =
do monitorDir <- TestCommon.getTempFileName "ganeti"
let monitor = "instance.qmp"
let monitor = "instance" <.> Kvmd.monitorExtension
monitorFile = monitorDir </> monitor
shutdownFile = Kvmd.shutdownPath monitorFile
-- ensure the KVM directory exists
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment