types: Make FS sharing disable by default

All the other caps are inverted (not supported by default).

Make fs sharing not supported by default and let hypervisors
expose if it supports it.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2020-03-27 04:26:57 +00:00
parent 4fe62ade7f
commit 0a1ffc1d97
6 changed files with 8 additions and 9 deletions

View File

@ -360,8 +360,6 @@ func (a *acrnArchBase) memoryTopology(memoryMb uint64) Memory {
func (a *acrnArchBase) capabilities() types.Capabilities {
var caps types.Capabilities
// For devicemapper disable support for filesystem sharing
caps.SetFsSharingUnsupported()
caps.SetBlockDeviceSupport()
caps.SetBlockDeviceHotplugSupport()

View File

@ -1065,7 +1065,6 @@ func (fc *firecracker) capabilities() types.Capabilities {
span, _ := fc.trace("capabilities")
defer span.Finish()
var caps types.Capabilities
caps.SetFsSharingUnsupported()
caps.SetBlockDeviceHotplugSupport()
return caps

View File

@ -119,6 +119,7 @@ func (q *qemuAmd64) capabilities() types.Capabilities {
}
caps.SetMultiQueueSupport()
caps.SetFsSharingSupport()
return caps
}

View File

@ -271,6 +271,7 @@ func (q *qemuArchBase) capabilities() types.Capabilities {
var caps types.Capabilities
caps.SetBlockDeviceHotplugSupport()
caps.SetMultiQueueSupport()
caps.SetFsSharingSupport()
return caps
}

View File

@ -9,7 +9,7 @@ const (
blockDeviceSupport = 1 << iota
blockDeviceHotplugSupport
multiQueueSupport
fsSharingUnsupported
fsSharingSupported
)
// Capabilities describe a virtcontainers hypervisor capabilities
@ -50,10 +50,10 @@ func (caps *Capabilities) SetMultiQueueSupport() {
// IsFsSharingSupported tells if an hypervisor supports host filesystem sharing.
func (caps *Capabilities) IsFsSharingSupported() bool {
return caps.flags&fsSharingUnsupported == 0
return caps.flags&fsSharingSupported != 0
}
// SetFsSharingUnsupported sets the host filesystem sharing capability to true.
func (caps *Capabilities) SetFsSharingUnsupported() {
caps.flags |= fsSharingUnsupported
func (caps *Capabilities) SetFsSharingSupport() {
caps.flags |= fsSharingSupported
}

View File

@ -30,7 +30,7 @@ func TestBlockDeviceHotplugCapability(t *testing.T) {
func TestFsSharingCapability(t *testing.T) {
var caps Capabilities
assert.True(t, caps.IsFsSharingSupported())
caps.SetFsSharingUnsupported()
assert.False(t, caps.IsFsSharingSupported())
caps.SetFsSharingSupport()
assert.True(t, caps.IsFsSharingSupported())
}