mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
Merge pull request #2571 from jcvenegas/caps-clh
clh: Implment capabilities
This commit is contained in:
@@ -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()
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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
|
||||
|
@@ -119,6 +119,7 @@ func (q *qemuAmd64) capabilities() types.Capabilities {
|
||||
}
|
||||
|
||||
caps.SetMultiQueueSupport()
|
||||
caps.SetFsSharingSupport()
|
||||
|
||||
return caps
|
||||
}
|
||||
|
@@ -271,6 +271,7 @@ func (q *qemuArchBase) capabilities() types.Capabilities {
|
||||
var caps types.Capabilities
|
||||
caps.SetBlockDeviceHotplugSupport()
|
||||
caps.SetMultiQueueSupport()
|
||||
caps.SetFsSharingSupport()
|
||||
return caps
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user