2012년 11월 20일 화요일

How to change HVM's CD on Xen

I was trying to change CD of the HVM during online on Xen, but I couldn't. I'd got an the following error when I tried to click disconnect button on the pane "virtual hardware details" of the virtual machine manager.

Error changing VM configuration: XML error: failed to parse domain description
Traceback (most recent call last)
:
File "/usr/share/virt-manager/virtManager/details.py", line 2323, in _change_config_helper
self.vm.redefine_cached()
File "/usr/share/virt-manager/virtManager/domain.py", line 326, in redefine_cached
self._redefine_xml(xml)
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 147, in _redefine_xml
return self._redefine_helper(origxml, newxml)
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 137, in _redefine_helper
self._define(newxml)
File "/usr/share/virt-manager/virtManager/domain.py", line 762, in _define
self.conn.define_domain(newxml)
File "/usr/share/virt-manager/virtManager/connection.py", line 805, in define_domain
return self.vmm.defineXML(xml)
File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2097, in defineXML
if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
libvirtError: XML error: failed to parse domain description


Instead, I did shutdown of the VM normally and then change the path of CD in configuration file. As I know, VM management generally supports changing CDs without re-boot. I found the answer from the site

I tried to change CD of the VM named "vcenter".
$ xm list
Name                               ID   Mem VCPUs      State   Time(s)
Domain-0                         0    3500      6         r-----   2564788.5
......
vcenter                           16    3012     2         -b----   490.1

# Lists the virtual block devices for the VM.
$ xm block-list vcenter
Vdev  BE handle state evt-ch ring-ref BE-path
768      0    0     1       -1       -1       /local/domain/0/backend/vbd/16/768
5632    0    0     1       -1       -1       /local/domain/0/backend/vbd/16/5632

* If I run command with --long, it is able to see more detailed information:
$ xm block-list vcenter --long
(768
    ((backend-id 0)
        (virtual-device 768)
        (device-type disk)
        (state 1)
        (backend /local/domain/0/backend/vbd/16/768)
    )
)
(5632
    ((backend-id 0)
        (virtual-device 5632)
        (device-type cdrom)
        (state 1)
        (backend /local/domain/0/backend/vbd/16/5632)
    )
)

# Check the first device, but it is main virtual hard drive.
xenstore-read /local/domain/0/backend/vbd/16/768/params
/var/lib/libvirt/images/vcenter.img

Check the next device, it is the media which I try to change. 
$ xenstore-read /local/domain/0/backend/vbd/16/5632/params
/isos/vwware-5-vcenter.iso

Run the command "xenstore-write" 
$ xenstore-write /local/domain/0/backend/vbd/16/5632/params /isos/vmware-5.1-vcenter.iso

# Confirm it, when returns to OS, CD has been changed. 
$ xenstore-read /local/domain/0/backend/vbd/16/5632/params
/isos/vmware-5.1-vcenter.iso


References: 
1. http://www.novell.com/support/kb/doc.php?id=3172795
2. http://www.virtuatopia.com/index.php/Adding_Disk,_CDROM_and_DVD_Devices_to_a_Running_Xen_domainU_Guest_System

댓글 없음:

댓글 쓰기