change cd iso image in hvm but loop not changed?
Hi,
I booted a windows hvm with a iso image (/root/t.iso) connected to the cdrom, I then changed the iso image using the following technique:
I used xm block-list <domid> to find the cdrom be-path:
5632 0 0 1 -1 -1 /local/domain/0/backend/vbd/3/5632
To make absolutely sure I got the right device I used xenstore-read:
xenstore-read /local/domain/0/backend/vbd/3/5632/params
/root/t.iso
I then used xenstore-write to change the iso image:
xenstore-write /local/domain/0/backend/vbd/3/5632/params/home/admin/isos/sql2k8.iso
After a few seconds the new cd appears in windows, however there is still a loop device setup for the original iso image:
losetup -a/dev/loop/0: [0802]:1517 (/root/t.iso)
Why is this setup? if the cd can be changed without mounting the new iso as a loop device why do it in the first place?
the hvm has gplpv drivers loaded but they do not provide cdrom, it is emulated.
Andy
Quoted 26 lines · Andrew Lyon
Hi,
I booted a windows hvm with a iso image (
/root/t.iso) connected to the cdrom, I then changed the iso image using the following technique:I used xm block-list <domid> to find the cdrom be-path:
5632 0 0 1 -1 -1 /local/domain/0/backend/vbd/3/5632
To make absolutely sure I got the right device I used xenstore-read:
xenstore-read /local/domain/0/backend/vbd/3/5632/params
/root/t.isoI then used xenstore-write to change the iso image:
xenstore-write /local/domain/0/backend/vbd/3/5632/params
/home/admin/isos/sql2k8.isoAfter a few seconds the new cd appears in windows, however there is still a loop device setup for the original iso image:
Quoted 8 lines
losetup -a
/dev/loop/0: [0802]:1517 (/root/t.iso)Why is this setup? if the cd can be changed without mounting the new iso as a loop device why do it in the first place?
the hvm has gplpv drivers loaded but they do not provide cdrom, it is emulated.
Qemu opens cdrom images directly using open and set a watch on params on xenstore to recognize if someone changes the cdrom image and if it happens it closes the old one and open the new one.
On the other hand the vbd backend for the cdrom is set by xend\hotplug scripts at domain creation so it is never updated afterward.
If you have time to write a patch for xend to better handle cdrom changes we would be glad to accept it :)
Quoted 36 lines · Stefano Stabellini
Quoted 26 lines · Andrew Lyon
Hi,
I booted a windows hvm with a iso image (
/root/t.iso) connected to the cdrom, I then changed the iso image using the following technique:I used xm block-list <domid> to find the cdrom be-path:
5632 0 0 1 -1 -1 /local/domain/0/backend/vbd/3/5632
To make absolutely sure I got the right device I used xenstore-read:
xenstore-read /local/domain/0/backend/vbd/3/5632/params
/root/t.isoI then used xenstore-write to change the iso image:
xenstore-write /local/domain/0/backend/vbd/3/5632/params
/home/admin/isos/sql2k8.isoAfter a few seconds the new cd appears in windows, however there is still a loop device setup for the original iso image:
Quoted 8 lines
losetup -a
/dev/loop/0: [0802]:1517 (/root/t.iso)Why is this setup? if the cd can be changed without mounting the new iso as a loop device why do it in the first place?
the hvm has gplpv drivers loaded but they do not provide cdrom, it is emulated.
Quoted 9 lines
Qemu opens cdrom images directly using open and set a watch on params on xenstore to recognize if someone changes the cdrom image and if it happens it closes the old one and open the new one.
On the other hand the vbd backend for the cdrom is set by xend\hotplug scripts at domain creation so it is never updated afterward.
If you have time to write a patch for xend to better handle cdrom changes we would be glad to accept it :)
I still dont understand why it is necessary to loopback mount the iso image if I can change it without the new image being loopback mounted, what is the loop device used for?
Andy
Quoted 5 lines · Andrew Lyon
I still dont understand why it is necessary to loopback mount the iso image if I can change it without the new image being loopback mounted, what is the loop device used for?
When the vbd backend is configured by xend the iso is loopback mounted. If you use stubdoms you are going to use the vbd backend to read from cdrom instead of opening the iso directly.
Therefore in the stubdom case writing to params is not enough to change the cdrom, what you would have to do is using block-detach and block-attach to remove the old backend and create a new one for the new cdrom.