mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 18:47:03 +00:00
firecracker: Add support for pseudo hotplug
Use the firecracker rescan logic to update the pre-attached drive. This allows us to emulate hotplug. Initially the drive backing stores are set to empty files on the host. Once the actual block based device or file is available swap the backing store. The rescan needs to be issued iff the VM is running. Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
This commit is contained in:
parent
22ebc09f00
commit
fba23796d6
@ -537,14 +537,18 @@ func (fc *firecracker) fcUpdateBlockDrive(drive config.BlockDrive) error {
|
||||
return err
|
||||
}
|
||||
|
||||
actionParams := ops.NewCreateSyncActionParams()
|
||||
actionInfo := &models.InstanceActionInfo{
|
||||
ActionType: "BlockDeviceRescan",
|
||||
}
|
||||
actionParams.SetInfo(actionInfo)
|
||||
_, err = fc.client().Operations.CreateSyncAction(actionParams)
|
||||
if err != nil {
|
||||
return err
|
||||
// Rescan needs to used only if the VM is running
|
||||
if fc.vmRunning() {
|
||||
actionParams := ops.NewCreateSyncActionParams()
|
||||
actionInfo := &models.InstanceActionInfo{
|
||||
ActionType: "BlockDeviceRescan",
|
||||
Payload: driveID,
|
||||
}
|
||||
actionParams.SetInfo(actionInfo)
|
||||
_, err = fc.client().Operations.CreateSyncAction(actionParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user