Bug 1259144

Summary: Detach physical lv disk from RHEL guest failed.
Product: [Fedora] Fedora Reporter: Lin Liu <linl>
Component: xenAssignee: Michael Young <m.a.young>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 22CC: jforbes, kraxel, leiwang, m.a.young, virt-maint, wshi, xchen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 20:51:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Cannot login RHEL6.7 guest after detaching physical lv disk none

Description Lin Liu 2015-09-02 05:27:58 UTC
Created attachment 1069267 [details]
Cannot login RHEL6.7 guest after detaching physical lv disk

Description of problem:
Create a physical lv disk created on host and then attach it to a RHEL7.2 guest with pv driver, when detaching it command returns error, login to guest, the disk is still attached and can be read and written, but in block list this device disappears.
Detach the physical lv disk from RHEL6.7 guest, command returns error, in block list the disk disappears, cannot login guest again with console or vncviewer.
This bug cannot be reproduced with the same guests on RHEL5.11 Xen host, so it's the problem of Xen Hypervisor on Fedora.

Version-Release number of selected component (if applicable):
xen-hypervisor-4.5.1-6.fc22.x86_64
xen-4.5.1-6.fc22.x86_64
kernel-4.0.4-301.fc22.x86_64

How reproducible:
Always

Steps to Reproduce:
1.  Create a RHEL7.2 guest on Fedora22 Xen, with the configure file including below lines:
    disk = [ "file:/root/RHEL-Server-7.2-64-hvm.raw,xvda,w" ]

2.  In guest add the kernel parameter "xen_emul_unplug=ide-disks" then reboot and login to guest, check there are only disks with pv driver display:
    # ls /dev/xvd*
    /dev/xvda  /dev/xvda1  /dev/xvda2  

3.  Make a physical partition with 8e type in host and create a lv disk on it, then attach it to guest using command:
    # xl block-attach 26 phy:/dev/VolGroup/lvData xvdb w
    # xl block-list 26
      Vdev  BE  handle state evt-ch ring-ref BE-path                      
      51728 0   26     4     238    364      /local/domain/0/backend/vbd/26/51728
      51712 0   26     4     233    8        /local/domain/0/backend/qdisk/26/51712
    # xl console 26
    In guest:
    # ls /dev/xvd*
    xvda   xvda1  xvda2  xvdb

4. Detach lvm disk from guest using command:
   # xl block-detach 26 51712
   libxl: error: libxl_device.c:950evice_backend_callback: unable to remove device with path /local/domain/0/backend/qdisk/23/51712
   libxl: error: libxl.c:1965evice_addrm_aocomplete: unable to remove vbd with id 51712
   libxl_device_disk_remove failed.

5. Check if the disk is detached from the guest:
   # xl block-list 26
   Vdev  BE  handle state evt-ch ring-ref BE-path                      
   51728 0   26     4     238    364      /local/domain/0/backend/vbd/26/51728
   In guest:
   # ls /dev/xvd*
     xvda   xvda1  xvda2 xvdb
   # mount /dev/xvdb /mnt
   # touch /mnt/test

Actual results:
Detach physical lv disk from RHEL7.2 guest, the command return error, but cannot see this device in xenstore, login guest, the device is still attached in guest, and can be read and written.

Expected results:
Physical disk should be detached from guest.

Additional info:
1. Disable lvm2-lvmetad service on RHEL7.2 guest using command as below according to bug (Title: Can not detach a disk which contain a lvm partition, this bug cannot be reproduced now) https://bugzilla.redhat.com/show_bug.cgi?id=1081853
   #systemctl stop lvm2-lvmetad
   #systemctl disable lvm2-lvmetad
   #systemctl disable lvm2-lvmetad.socket
  
   Then destroy and recreate guest, reproduce this bug, the actual results are: Detach command return error but in block list the disk disappears, cannot login guest again with console or vncviewer.
  

2. Test this case with RHEL6.7 guest on Fedora22 Xen host, the actual resutls are as below:
   Detach command return error but in block list the disk disappears, cannot login guest again with console or vncviewer (please refer to the screen shot in attachment).
   [root@dhcp-66-73-92 ~]# xl block-detach 5 51712
   libxl: error: libxl_device.c:950evice_backend_callback: unable to remove device with path /local/domain/0/backend/qdisk/5/51712
   libxl: error: libxl.c:1965evice_addrm_aocomplete: unable to remove vbd with id 51712
   libxl_device_disk_remove failed.

   [root@dhcp-66-73-92 ~]# xl block-list 5
   Vdev  BE  handle state evt-ch ring-ref BE-path                      
   51728 0   5      4     246    896      /local/domain/0/backend/vbd/5/51728


3. I tested this case with RHEL7.2 guest and RHEL6.7 guest on RHEL5.11 Xen host, the physical lv disk is detached as normal.

Comment 1 Fedora End Of Life 2016-07-19 20:51:09 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.