Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
types: Make FS sharing disable by default
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jcvenegas committed Mar 27, 2020
1 parent 4fe62ad commit 0a1ffc1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions virtcontainers/acrn_arch_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion virtcontainers/fc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions virtcontainers/qemu_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (q *qemuAmd64) capabilities() types.Capabilities {
}

caps.SetMultiQueueSupport()
caps.SetFsSharingSupport()

return caps
}
Expand Down
1 change: 1 addition & 0 deletions virtcontainers/qemu_arch_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func (q *qemuArchBase) capabilities() types.Capabilities {
var caps types.Capabilities
caps.SetBlockDeviceHotplugSupport()
caps.SetMultiQueueSupport()
caps.SetFsSharingSupport()
return caps
}

Expand Down
8 changes: 4 additions & 4 deletions virtcontainers/types/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const (
blockDeviceSupport = 1 << iota
blockDeviceHotplugSupport
multiQueueSupport
fsSharingUnsupported
fsSharingSupported
)

// Capabilities describe a virtcontainers hypervisor capabilities
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions virtcontainers/types/capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

0 comments on commit 0a1ffc1

Please sign in to comment.