Bug 700376

Summary: Can't hotplug disk to guest on xen hypervisor via attach-disk
Product: Red Hat Enterprise Linux 5 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 5.7CC: dallan, dyuan, jdenemar, llim
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-15 20:07:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
guest screen picture none

Description Alex Jia 2011-04-28 09:17:36 UTC
Description of problem:
Can't hotplug disk to guest on xen hypervisor, libvirt will raise the following error:
error: Requested operation is not valid: Xm driver only supports modifying persistent config

Version-Release number of selected component (if applicable):
# uname -r
2.6.18-256.el5xen
# rpm -q libvirt
libvirt-0.8.2-18.el5


How reproducible:
always

Steps to Reproduce:
1. install and start a guest
2. use dd or qemu-img to create a disk image
3. use attach-disk to attach the disk image to guest
  
Actual results:
# virsh attach-disk vr-rhel5u4-x86_64-xenfv /var/lib/xen/images/foo.img hdb --driver qemu --subdriver raw
error: Failed to attach disk
error: Requested operation is not valid: Xm driver only supports modifying persistent config

Expected results:
fix it.

Additional info:
It's common issue on xen hypervisor, virsh attach-device is the same error, please see bug 699324.

Comment 1 Jiri Denemark 2011-04-28 10:14:51 UTC
> # virsh attach-disk vr-rhel5u4-x86_64-xenfv /var/lib/xen/images/foo.img hdb
> --driver qemu --subdriver raw

--driver qemu is for qemu/kvm hypervisor and cannot be used with xen hypervisor.

You can use --driver tap --subdriver aio for Xen, for example.

> error: Failed to attach disk
> error: Requested operation is not valid: Xm driver only supports modifying
> persistent config

The only bug that I can see here is that the error message is not very helpful. That's because libvirt's xen driver architecture is not exactly clever and the error from xm subdriver overwrites the real error from xend subdriver.

Comment 2 Alex Jia 2011-04-29 03:37:29 UTC
(In reply to comment #1)
> > # virsh attach-disk vr-rhel5u4-x86_64-xenfv /var/lib/xen/images/foo.img hdb
> > --driver qemu --subdriver raw
>
Yeah, the above parameters are wrong. 
> --driver qemu is for qemu/kvm hypervisor and cannot be used with xen
> hypervisor.
> 
> You can use --driver tap --subdriver aio for Xen, for example.
> 
> > error: Failed to attach disk
> > error: Requested operation is not valid: Xm driver only supports modifying
> > persistent config
> 
> The only bug that I can see here is that the error message is not very helpful.
> That's because libvirt's xen driver architecture is not exactly clever and the
> error from xm subdriver overwrites the real error from xend subdriver.
In fact, virsh attach-disk command exists many issue, although I use --driver tap --subdriver aio for xenfv guest, test result has a little strange for me:

Some issues:
1. disk bus 'ide' cannot be hotplugged for kvm hypervisor, but it's okay for xen hypervisor with xenfv guest, Is this expected result? however, although I modprobe acpiphp module on guest before attach-disk, I can't still find the attached disk device, and there are some information are raised by guest, please see attachment.

2. It's okay when I run attach-disk to attach/detach a disk to/from guest first time, but I run the process the second time, libvirt will raise:
error: Failed to attach disk
error: Requested operation is not valid: Xm driver only supports modifying
persistent config

3. Based on the above 2, when I detach a disk from guest, libvirt reported disk detached successfully, however, guest xml configuration still reserve the disk xml element block whether or not if I shut down guest, and I haven't added any --persistent option in here, it seems libvirt defaultly support --persistent operation for xen attach-disk. 


For details info, please see attachement.

Alex

Comment 3 Alex Jia 2011-04-29 03:41:09 UTC
Created attachment 495704 [details]
guest screen picture

Comment 4 Alex Jia 2011-04-29 03:44:04 UTC
# virsh start vr-rhel5u4-x86_64-xenfv
Domain vr-rhel5u4-x86_64-xenfv started

# virsh attach-disk vr-rhel5u4-x86_64-xenfv /var/lib/xen/images/foo.img hdb --type=disk --driver tap --subdriver aio
Disk attached successfully

# virsh detach-disk vr-rhel5u4-x86_64-xenfv hdb
Disk detached successfully

# virsh attach-disk vr-rhel5u4-x86_64-xenfv /var/lib/xen/images/foo.img hdb --type=disk --driver tap --subdriver aio
error: Failed to attach disk
error: Requested operation is not valid: Xm driver only supports modifying persistent config

# virsh dumpxml vr-rhel5u4-x86_64-xenfv
<domain type='xen' id='2'>
  <name>vr-rhel5u4-x86_64-xenfv</name>
  <uuid>8b2668f6-e239-631f-8f8b-e97fa753abe4</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type>hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/var/lib/libvirt/images/vr-rhel5u4-x86_64-xenfv'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='file'/>
      <source file='/tmp/libvirt_bootiso/custom.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='tap' type='aio'/>
      <source file='/var/lib/xen/images/foo.img'/>
      <target dev='hdb' bus='ide'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:e6:9e:d2'/>
      <source bridge='xenbr0'/>
      <script path='vif-bridge'/>
      <target dev='vif2.0'/>
      <model type='rtl8139'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes' keymap='en-us'/>
  </devices>
</domain>

# virsh detach-disk vr-rhel5u4-x86_64-xenfv hdb
Disk detached successfully

# virsh dumpxml vr-rhel5u4-x86_64-xenfv
<domain type='xen' id='2'>
  <name>vr-rhel5u4-x86_64-xenfv</name>
  <uuid>8b2668f6-e239-631f-8f8b-e97fa753abe4</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type>hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/var/lib/libvirt/images/vr-rhel5u4-x86_64-xenfv'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='file'/>
      <source file='/tmp/libvirt_bootiso/custom.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='tap' type='aio'/>
      <source file='/var/lib/xen/images/foo.img'/>
      <target dev='hdb' bus='ide'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:e6:9e:d2'/>
      <source bridge='xenbr0'/>
      <script path='vif-bridge'/>
      <target dev='vif2.0'/>
      <model type='rtl8139'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes' keymap='en-us'/>
  </devices>
</domain>

Comment 5 RHEL Program Management 2011-06-20 22:43:43 UTC
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.7 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.

Comment 7 RHEL Program Management 2011-08-15 20:07:06 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.