---------- Forwarded message ----------
From:
田世坤 <aixt2006@xxxxxxxxx>Date: 2010/4/19
Subject: Attach CDROM to windows
To: xen-devel <
xen-devel@xxxxxxxxxxxxxxxxxxx>
Hi Guys,
Now I am using
Xen-4.0.0. I need to attach CDROM from ISO files to vitual machines when they
are running. The VMs contain RHEL4.6, Windows Server 2003 32bit and Windows Server
2006 64bit.
The disk configuration
of the VMs is:
disk = [ 'tap:vhd:/guest/SS_test/vhd/hmi-100130.vhd,hda,w'] (1)
When I attach a CDROM to
RHEL4.6 VM with the command:
virsh attach-device DomID attach-cdrom.xml (2)
The device come out soon
and I can mount it to use, the state from “xm block-list DomID” is (connected).
The content of attach-cdrom.xml is:
<disk
type='file' device='cdrom'>
<driver name='file'/>
<source file='/guest/SS_test/iso/redhat_4.6_32.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
When I detach it with
the command after umount the CDROM:
virsh detach-device DomID attach-cdrom.xml (3)
The device disapear soon.
But in windows VMs, I execute
(2), the CDROM just not come out. They need to reboot to bring out the CDROM.
Before, I was using
Xen-3.4.2. To avoid the reboot for windows, I changed the disk configuration:
disk = [ 'tap:vhd:/guest/SS_test/vhd/hmi-100127.vhd,hda,w',
',hdc:cdrom,r'] (4)
After boot, the state of the CDROM from “xm block-list
DomID” is 1(initialising).
When the VM is running, I execute (2) to assert the
ISO file. Though the state is also 1, but the content of ISO file are able to read
in the CDROM in the VM.
To remove the ISO file, excute (5):
virsh attach-device DomID detach-cdrom.xml (5)
The content of detach-cdrom.xml is:
<disk
type='file' device='cdrom'>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
It seems
very convenience in Xen-3.4.2. I tried to do these in Xen-4.0.0 to avoid
reboot. But fail. The state is 6 (closed):
root@SS01 # xm block-list 27
Vdev BE
handle state evt-ch ring-ref BE-path
768 0 0
4 5 8
/local/domain/0/backend/vbd/27/768
5632 0 0
6 -1 -1
/local/domain/0/backend/vbd/27/5632
When I
execute (2), it report: xend.err 'Device 5632 not connected'. So I execute (6)
to detach the CDROM:
xm block-detach DomID 5632 –f (6)
It will block without –f option. Now the devices
are:
root@SS01 # xm block-list 27
Vdev BE
handle state evt-ch ring-ref BE-path
768 0
0 4 5
8
/local/domain/0/backend/vbd/27/768
Then I execute (2) to attach the CDROM successfully.
The ISO is assert to the CDROM in the VM. The state of eh CDROM is 1(initialising).
root@SS01 # xm block-list 27
Vdev BE
handle state evt-ch ring-ref BE-path
768 0 0
4 5 8
/local/domain/0/backend/vbd/27/768
5632 0 0
1 -1 -1
/local/domain/0/backend/vbd/27/5632
Then I execut (5) to remove the ISO, it report: xend.err
'Device 5632 not connected'. And execute (3) to detach the CDROM device. It
will block. I still need to execute (6) to detach it.
xm info for Xen-3.4.2:
host : houyi-vm03.dev.sd.al
release : 2.6.18.8-xen
version : #1 SMP Thu Dec 3 22:46:04 CST 2009
machine : x86_64
nr_cpus : 16
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 2
cpu_mhz : 2400
hw_caps : bfebfbff:28100800:00000000:00000340:009ce3bd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 24567
free_memory : 22240
node_to_cpu : node0:0-15
node_to_memory : node0:22240
xen_major : 3
xen_minor : 4
xen_extra : .2
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
cc_compiler : gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)
cc_compile_by : root
cc_compile_domain : (none)
cc_compile_date : Thu Dec 3 22:47:18 CST 2009
xend_config_format : 4
xm info for Xen-4.0.0:
host : SS01
release : 2.6.31.13
version : #1 SMP Fri Apr 16 14:58:38 CST 2010
machine : x86_64
nr_cpus : 16
nr_nodes : 2
cores_per_socket : 4
threads_per_core : 2
cpu_mhz : 2400
hw_caps : bfebfbff:28100800:00000000:00001b40:009ce3bd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 24540
free_memory : 4146
node_to_cpu : node0:0,2,4,6,8,10,12,14
node1:1,3,5,7,9,11,13,15
node_to_memory : node0:1553
node1:2593
node_to_dma32_mem : node0:1017
node1:0
max_node_id : 1
xen_major : 4
xen_minor : 0
xen_extra : .0-rc9-pre
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : Sat Mar 27 16:01:35 2010 +0000 21078:f3db0ae08304
xen_commandline :
cc_compiler : gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
cc_compile_by : root
cc_compile_domain : (none)
cc_compile_date : Fri Apr 9 15:34:38 CST 2010
xend_config_format : 4
What has been changed from Xen-3.4.2 to 4.0.0 for
block-attach? Became stricter?
So is there any idea for me to attach an ISO CDROM
to windows without reboot?