-
Notifications
You must be signed in to change notification settings - Fork 566
disk/net/pmem unplug #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disk/net/pmem unplug #1030
Conversation
Rather than panic()ing when we get a kernel loading error populate the error upwards. Signed-off-by: Rob Bradford <[email protected]>
This id will be used to unplug the device if the user has chosen an id. Signed-off-by: Rob Bradford <[email protected]>
In order to support hotplugging there is a map of human readable device id to PCI BDF map. As the device id is part of the specific device configuration (e.g. NetConfig) it is necessary to return the id through from the helper functions that create the devices through to the functions that add those devices to the bus. This necessitates changing a great deal of function prototypes but otherwise has little impact. Currently only if an id is supplied by the user as part of the device configuration is it populated into this map. A later commit will populate with an autogenerated name where none is supplied by the user. Signed-off-by: Rob Bradford <[email protected]>
Add an accessor to return the underlying VirtioDevice. This is useful for managing the removal of the device from internal datastructures when handling virtio-pci device unplug. Signed-off-by: Rob Bradford <[email protected]>
Extend the eject_device() method on DeviceManager to also support virtio-pci devices being unplugged. Signed-off-by: Rob Bradford <[email protected]>
If the id has not been provided by the user generate an incrementing id. Signed-off-by: Rob Bradford <[email protected]>
We now support assigning device ids for VFIO and virtio-pci devices so this error can be generalised. Signed-off-by: Rob Bradford <[email protected]>
This ensures that a device that is removed will not reappear after a reboot. Signed-off-by: Rob Bradford <[email protected]>
Ensure that the device is removed and the removed device stays away after a reboot. Signed-off-by: Rob Bradford <[email protected]>
Ensure that the device is removed and the removed device stays away after a reboot. Signed-off-by: Rob Bradford <[email protected]>
sboeuf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR :)
| device_cfg.id = Some(id.clone()); | ||
| id | ||
| device_cfg.id = id.clone(); | ||
| id.unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sboeuf Yes the previously the function returned a String which was then wrapped into a Some and saved with the plain String returned. Now it returns an Option<String> which is saved directly but the String needs to be returned so it needs to be unwrapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to worry about None here as on the feature = "pci_support" case the function either errors or returns Some(..)
|
@sameo PTAL |
With recent changes (cloud-hypervisor#1030 cloud-hypervisor#1084), the '/vm.remove-device' API is no longer restricted to remove VFIO PCI devices. It now supports (almost) all hotpluggable devices, e.g. disk/net/pmem/fs/vsock. Signed-off-by: Bo Chen <[email protected]>
With recent changes (#1030 #1084), the '/vm.remove-device' API is no longer restricted to remove VFIO PCI devices. It now supports (almost) all hotpluggable devices, e.g. disk/net/pmem/fs/vsock. Signed-off-by: Bo Chen <[email protected]>
Support unplugging the same types of virtio-pci devices that we support for hotplug (disk, net and pmem)