diff --git a/virtcontainers/device/config/config.go b/virtcontainers/device/config/config.go index 18fcfedcec..5f73cf7d8c 100644 --- a/virtcontainers/device/config/config.go +++ b/virtcontainers/device/config/config.go @@ -117,6 +117,10 @@ type DeviceInfo struct { // for a nvdimm device in the guest. Pmem bool + // ColdPlug specifies whether the device must be cold plugged (true) + // or hot plugged (false). + ColdPlug bool + // FileMode permission bits for the device. FileMode os.FileMode diff --git a/virtcontainers/device/drivers/generic.go b/virtcontainers/device/drivers/generic.go index c8152cf84a..dc828fb1bb 100644 --- a/virtcontainers/device/drivers/generic.go +++ b/virtcontainers/device/drivers/generic.go @@ -140,6 +140,7 @@ func (device *GenericDevice) Save() persistapi.DeviceState { dss.Major = info.Major dss.Minor = info.Minor dss.DriverOptions = info.DriverOptions + dss.ColdPlug = info.ColdPlug } return dss } @@ -155,5 +156,6 @@ func (device *GenericDevice) Load(ds persistapi.DeviceState) { Major: ds.Major, Minor: ds.Minor, DriverOptions: ds.DriverOptions, + ColdPlug: ds.ColdPlug, } } diff --git a/virtcontainers/persist/api/device.go b/virtcontainers/persist/api/device.go index 34916ed0b3..8900c5f6fa 100644 --- a/virtcontainers/persist/api/device.go +++ b/virtcontainers/persist/api/device.go @@ -103,6 +103,10 @@ type DeviceState struct { Major int64 Minor int64 + // ColdPlug specifies whether the device must be cold plugged (true) + // or hot plugged (false). + ColdPlug bool + // DriverOptions is specific options for each device driver // for example, for BlockDevice, we can set DriverOptions["blockDriver"]="virtio-blk" DriverOptions map[string]string