device: add ColdPlug flag

Add ColdPlug flag to DeviceInfo and DeviceState to identify whether a device
must be or was cold plugged

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2020-06-29 09:59:17 -05:00
parent e3a3818f7a
commit 3eb694c518
3 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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,
}
}

View File

@ -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