From 1b307db82536792ffb685b61c9d72a2e7482dc76 Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Sun, 2 Dec 2018 00:14:53 +0000 Subject: [PATCH 1/2] vc: capabilities: add capability flags for 9p and hotplug Not all hypervisors support 9p. Not all hypervisors support hotplug. Add capability flags to track this. Since most hypervisor implementations in Kata *do* support these, the set semantices are reversed (ie, set the flag if you do not support the feature). Fixes: #1022 Signed-off-by: Eric Ernst --- virtcontainers/capabilities.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/virtcontainers/capabilities.go b/virtcontainers/capabilities.go index 8760c99691..cf8c02c87f 100644 --- a/virtcontainers/capabilities.go +++ b/virtcontainers/capabilities.go @@ -8,6 +8,8 @@ package virtcontainers const ( blockDeviceSupport = 1 << iota blockDeviceHotplugSupport + hotplugUnsupported + plan9FSUnsupported ) type capabilities struct { @@ -35,3 +37,25 @@ func (caps *capabilities) isBlockDeviceHotplugSupported() bool { func (caps *capabilities) setBlockDeviceHotplugSupport() { caps.flags |= blockDeviceHotplugSupport } + +func (caps *capabilities) isHotplugSupported() bool { + if caps.flags&hotplugUnsupported == 0 { + return true + } + return false +} + +func (caps *capabilities) setHotplugUnsupported() { + caps.flags |= hotplugUnsupported +} + +func (caps *capabilities) is9pSupported() bool { + if caps.flags&plan9FSUnsupported == 0 { + return true + } + return false +} + +func (caps *capabilities) set9pUnsupported() { + caps.flags |= plan9FSUnsupported +} From 43ee1c883a2204cbe65fe3ccd6a29ab05a9cf986 Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Sat, 1 Dec 2018 23:16:21 +0000 Subject: [PATCH 2/2] vc: common hypervisor variable move out of qemu impl operation type lived in qemu before - appears this should be part of hypervisor.go, since this isn't specific to qemu, and would be used by other hypervisors as well. Signed-off-by: Eric Ernst --- virtcontainers/hypervisor.go | 2 ++ virtcontainers/qemu.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/virtcontainers/hypervisor.go b/virtcontainers/hypervisor.go index 7cad8be30e..fab0ef1254 100644 --- a/virtcontainers/hypervisor.go +++ b/virtcontainers/hypervisor.go @@ -18,6 +18,8 @@ import ( // HypervisorType describes an hypervisor type. type HypervisorType string +type operation int + const ( // QemuHypervisor is the QEMU hypervisor. QemuHypervisor HypervisorType = "qemu" diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 8027304fb2..3145744526 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -95,8 +95,6 @@ var defaultKernelParameters = []Param{ {"panic", "1"}, } -type operation int - const ( addDevice operation = iota removeDevice