mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-21 21:18:54 +00:00
virtcontainers: add Pmem attribute to BlockDrive
A `BlockDrive` can be used as pmem device, since they both are similar and can be mounted in the same way in the guest. The `Pmem` attribute helps kata to identify a pmem device and how it has to be hotplugged in the guest. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
ee941e5c56
commit
abbdf078cd
@ -65,6 +65,11 @@ func (device *BlockDevice) Attach(devReceiver api.DeviceReceiver) (err error) {
|
||||
Format: "raw",
|
||||
ID: utils.MakeNameID("drive", device.DeviceInfo.ID, maxDevIDSize),
|
||||
Index: index,
|
||||
Pmem: device.DeviceInfo.Pmem,
|
||||
}
|
||||
|
||||
if fs, ok := device.DeviceInfo.DriverOptions["fstype"]; ok {
|
||||
drive.Format = fs
|
||||
}
|
||||
|
||||
customOptions := device.DeviceInfo.DriverOptions
|
||||
@ -169,6 +174,7 @@ func (device *BlockDevice) Save() persistapi.DeviceState {
|
||||
NvdimmID: drive.NvdimmID,
|
||||
VirtPath: drive.VirtPath,
|
||||
DevNo: drive.DevNo,
|
||||
Pmem: drive.Pmem,
|
||||
}
|
||||
}
|
||||
return ds
|
||||
@ -194,6 +200,7 @@ func (device *BlockDevice) Load(ds persistapi.DeviceState) {
|
||||
NvdimmID: bd.NvdimmID,
|
||||
VirtPath: bd.VirtPath,
|
||||
DevNo: bd.DevNo,
|
||||
Pmem: bd.Pmem,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@ type BlockDrive struct {
|
||||
|
||||
// DevNo
|
||||
DevNo string
|
||||
|
||||
// Pmem enabled persistent memory. Use File as backing file
|
||||
// for a nvdimm device in the guest.
|
||||
Pmem bool
|
||||
}
|
||||
|
||||
// VFIODev represents a VFIO drive used for hotplugging
|
||||
|
Loading…
Reference in New Issue
Block a user