Merge pull request #2571 from jcvenegas/caps-clh

clh:  Implment capabilities
This commit is contained in:
Jose Carlos Venegas Munoz
2020-03-30 16:33:42 -06:00
committed by GitHub
7 changed files with 9 additions and 10 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

@@ -643,8 +643,8 @@ func (clh *cloudHypervisor) capabilities() types.Capabilities {
clh.Logger().WithField("function", "capabilities").Info("get Capabilities")
var caps types.Capabilities
caps.SetFsSharingSupport()
return caps
}
func (clh *cloudHypervisor) trace(name string) (opentracing.Span, context.Context) {

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())
}