vc: capabilities: add capability flags for filesystem sharing

Not all hypervisors support filesystem sharing. Add capability flags to track
this. Since most hypervisor implementations in Kata *do* support this, the set
semantices are reversed (ie, set the flag if you do not support the feature).

Fixes: #1022

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Eric Ernst 2018-12-02 00:14:53 +00:00 committed by Julio Montes
parent e776380ff8
commit dcd48a9ca1
2 changed files with 23 additions and 0 deletions

View File

@ -9,6 +9,7 @@ const (
blockDeviceSupport = 1 << iota
blockDeviceHotplugSupport
multiQueueSupport
fsSharingUnsupported
)
type capabilities struct {
@ -47,3 +48,11 @@ func (caps *capabilities) isMultiQueueSupported() bool {
func (caps *capabilities) setMultiQueueSupport() {
caps.flags |= multiQueueSupport
}
func (caps *capabilities) isFsSharingSupported() bool {
return caps.flags&fsSharingUnsupported == 0
}
func (caps *capabilities) setFsSharingUnsupported() {
caps.flags |= fsSharingUnsupported
}

View File

@ -34,3 +34,17 @@ func TestBlockDeviceHotplugCapability(t *testing.T) {
t.Fatal()
}
}
func TestFsSharingCapability(t *testing.T) {
var caps capabilities
if !caps.isFsSharingSupported() {
t.Fatal()
}
caps.setFsSharingUnsupported()
if caps.isFsSharingSupported() {
t.Fatal()
}
}