diff --git a/virtcontainers/device/drivers/block.go b/virtcontainers/device/drivers/block.go index 62d55f6493..6711345571 100644 --- a/virtcontainers/device/drivers/block.go +++ b/virtcontainers/device/drivers/block.go @@ -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, } } diff --git a/virtcontainers/persist/api/device.go b/virtcontainers/persist/api/device.go index 67226542a9..34916ed0b3 100644 --- a/virtcontainers/persist/api/device.go +++ b/virtcontainers/persist/api/device.go @@ -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