
Hey, So in an attempt to fix change CD functionality we discovered a few other potential issues and what Nir suggested was to implement two [somewhat] new functions in VDSM: hotplug and hotunplug for CDs similar to how it works for normal disks now. Existing changeCD function will be left as is for backwards compatibility. As I found out, engine already calculates iface and index before invoking VDSM functions, so we will just pass these along with PDIV to the VDSM. Suggested flow is, let me quote:
So the complete change CD flow should be:
1. get the previous drivespec from vm metadata 2. prepare new drivespec 3. add new drivespec to vm metadata 4. attach a new device to vm 5. teardown the previous drivespec 6. remove previous drivespec from vm metadata
When the vm is stopped, it must do:
1. get drive spec from vm metadata 2. teardown drivespec
During attach, there are interesting races: - what happens if vdsm crashes after step 2? who will teardown the volume? maybe you need to add the new drivespec to the metadata first, before preparing it. - what happens if attach failed? who will remove the new drive from the metadata?
Now, what makes hotplugDisk/hotunplugDisk different? From what I understand, the flow is same there, so what difference is there as far as VDSM is concerned? If none, this means if I more or less copy that code, changing minor details and data accordingly for CDs, this should work, shouldn't it? Thanks! Fedor