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

Commit

Permalink
vc: capabilities: add capability flags for filesystem sharing
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Eric Ernst authored and Julio Montes committed Dec 19, 2018
1 parent e776380 commit dcd48a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions virtcontainers/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
blockDeviceSupport = 1 << iota
blockDeviceHotplugSupport
multiQueueSupport
fsSharingUnsupported
)

type capabilities struct {
Expand Down Expand Up @@ -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
}
14 changes: 14 additions & 0 deletions virtcontainers/capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit dcd48a9

Please sign in to comment.