[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] libxl: Enable stubdom cdrom changing



On Sun, Apr 7, 2024 at 10:36 AM Jason Andryuk <jandryuk@xxxxxxxxx> wrote:
>
> To change the cd-rom medium, libxl will:
>  - QMP eject the medium from QEMU
>  - block-detach the old PV disk
>  - block-attach the new PV disk
>  - QMP change the medium to the new PV disk by fdset-id
>
> The QMP code is reused, and remove and attach are implemented here.
>
> The stubdom must internally handle adding /dev/xvdc to the appropriate
> fdset.  libxl in dom0 doesn't see the result of adding to the fdset as
> that is internal to the stubdom, but the fdset's opaque fields will be
> set to stub-devid:$devid, so libxl can identify it.  $devid is common
> between the stubdom and libxl, so it can be identified on both side.
> The stubdom will name the device xvdY regardless of the guest name hdY,
> sdY, or xvdY, but the stubdom will be assigned the same devid
> facilitating lookup.  Because the stubdom add-fd call is asynchronous,
> libxl needs to poll query-fdsets to identify when add-fd has completed.
>
> For cd-eject, we still need to attach the empty vbd.  This is necessary
> since xenstore is used to determine that hdc exists.  Otherwise after
> eject, hdc would be gone and the cd-insert would fail to find the drive
> to insert new media.
>
> Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
> Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> ---

Also, these are the stubdom side changes.

The stubdom QEMU command line should gain a qmp socket for the script:
-chardev socket,server=on,wait=off,path=/tmp/qemu-cdrom.qmp,id=m-cdrom
-mon chardev=m-cdrom,mode=control

mdev.conf:
# Only add for addition
xvd[a-d] 0:0 660 @qemu-xvdc-add-fd.sh

And the attached qemu-xvdc-add-fd.sh script to call add-fd with
"opaque" set as "stub-devid:$devid".  DEVPATH is only set on hot plug
and not cold plug.  Using it when available avoids IO - busybox
`readlink` will need to be installed in the stubdom.  If cold plugging
is not performed, libxl skips issuing the remove-fd call when it can't
find a matching fdset.

Regards,
Jason

Attachment: qemu-xvdc-add-fd.sh
Description: application/shellscript


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.