Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
device: add ColdPlug flag
Browse files Browse the repository at this point in the history
Add ColdPlug flag to DeviceInfo and DeviceState to identify whether a device
must be or was cold plugged

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Jun 15, 2020
1 parent 9d04ea7 commit 6532eaa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtcontainers/device/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions virtcontainers/device/drivers/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -155,5 +156,6 @@ func (device *GenericDevice) Load(ds persistapi.DeviceState) {
Major: ds.Major,
Minor: ds.Minor,
DriverOptions: ds.DriverOptions,
ColdPlug: ds.ColdPlug,
}
}
4 changes: 4 additions & 0 deletions virtcontainers/persist/api/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6532eaa

Please sign in to comment.