Bug 528457

Summary: [block-configure]The mode of the vbd cannot be changed
Product: Red Hat Enterprise Linux 5 Reporter: Rita Wu <rwu>
Component: xenAssignee: Xen Maintainance List <xen-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: berrange, cwei, leiwang, minovotn, mrezanin, xen-maint, yuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-18 03:31:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rita Wu 2009-10-12 10:24:04 UTC
Description of problem:
The mode of the vbd cannot be changed

Version-Release number of selected component (if applicable):
2.6.18-164.el5xen

How reproducible:
always

Steps to Reproduce:
1. Attach a block:
 #xm block-attach $domain-name $path/$image-file sdb:cdrom r
2. Change block device configuraton
 #xm block-configure $domain-name $path/$another-image-file sdb:cdrom w
3. Check whether the configuration can be changed successfully.
 #xm list -l rhel5u4_fv_x86_64
  
Actual results:
The mode of the vdb cannot be changed(always "r")

Expected results:
The mode of the vdb can be changed to "w"

Additional info:

Comment 1 Daniel Berrangé 2009-10-12 10:31:42 UTC
There's 2 problems with your test scenario here

 - You can only hotplug paravirt disk devices. Hotplugging of emulated CDROMs will not work. So step 1 should not have succeeded in the first place.

 - Assuming you had a CDROM device already attached at boot time though, CDROM devices are inherently read-only, hence requesting a "w" flag for CDROM media is meaningless.

Comment 2 Rita Wu 2009-10-13 06:31:08 UTC
Retest again using attached disk with xen-3.0.3-94.el5_4.2:
1.Create new block device:
 # dd if=/dev/zero  of=$image-file bs=1M count=4096
2.Attach the block to a virtual machine:
 #xm block-attach $domain-id  tap:aio:$path/$image-file  /dev/hdc w
3.Change disk device configuration:
 #xm block-configure $domain-id tap:aio:$path/$image-file hdc:disk r

And I got the error message:
Error: Refusing to reconfigure device tap:5632 to ['tap', ['uname',
'tap:aio:/var/lib/xen/images/rhel5u3_x86_64_kvm.img'], ['dev', 'hdc:disk'],
['mode', 'r']]
Usage: xm block-configure <Domain> <BackDev> <FrontDev> <Mode> [BackDomId]

Refer to the python script from xen package, does block-configure only support
to change cdrom's config file, not support disk type?

Comment 3 Yufang Zhang 2009-10-13 06:44:56 UTC
I think block-configure is only used to change the back-end device of cdrom of guest. The <Mode> must be "r" and <FrontDev> must be a cdrom device already existed in the guest.
Daniel,is that right?

Comment 4 Michal Novotny 2010-03-17 08:19:50 UTC
(In reply to comment #3)
> I think block-configure is only used to change the back-end device of cdrom of
> guest. The <Mode> must be "r" and <FrontDev> must be a cdrom device already
> existed in the guest.
> Daniel,is that right?    

I don't know and Daniel could help more, please add needinfo flag next time when you'll be asking somebody for information. Now I'll do it for you.

Daniel, usually block-configure is used for changing back-end devices but it should support changing the disk devices too, right? But could it change the mode of device?

Thanks,
Michal

Comment 5 Daniel Berrangé 2010-03-17 10:09:50 UTC
To the best of my knowledge 'block-configure' is *only* for changing the media in ejectable devices (cdrom/floppy).  If you want to change disk devices, you need attach/detach - it is meaningless to change the backing store for a non-ejectable disk. Mode should always be 'r' for a CDROM device. I've no idea if its possible to change mode for a floppy device, in theory it might be possible, but no idea if anyone ever implemented that.

Comment 7 Lei Wang 2010-03-17 10:57:27 UTC
(In reply to comment #5)
> To the best of my knowledge 'block-configure' is *only* for changing the media
> in ejectable devices (cdrom/floppy).  If you want to change disk devices, you
> need attach/detach - it is meaningless to change the backing store for a
> non-ejectable disk. Mode should always be 'r' for a CDROM device. I've no idea
> if its possible to change mode for a floppy device, in theory it might be
> possible, but no idea if anyone ever implemented that.    

Hi, Berrange, Is it valid for PV guest to change the backend device of CDROM?

When I change backend device of CDROM in rhel5.4 PV guest, it will update xenstore at once, but need reboot the guest to make the change take effect.

Comment 8 Daniel Berrangé 2010-03-17 11:08:20 UTC
There is *NO*  CDROM device emulation for PV guests. CDROMs are only present for HVM guests.

Comment 10 Rita Wu 2010-03-18 03:31:20 UTC
Close this bug, since comment 5

Comment 11 Paolo Bonzini 2010-04-08 15:47:54 UTC
This bug was closed during 5.5 development and it's being removed from the internal tracking bugs (which are now for 5.6).