Bug 1039829

Summary: Can not set write policy of filesystem as immediate for lxc guest from virt-manager GUI
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: codong, dyuan, lcui, mkletzan, mzhan, tzheng, zsong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-0.10.0-10.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:38:23 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:

Description tingting zheng 2013-12-10 06:05:50 UTC
Description
Can not set write policy of filesystem as immediate for lxc guest from virt-manager GUI

Version:
virt-manager-0.10.0-8.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1: #virt-manager --connect lxc:///

2: open lxc guest via virt-manager,make sure the vm in shutdown status,attached the detailed steps of creating lxc guest in additional info B.

3: switch to hardware detail page,click add Hardware button

4: select Filesystem in left panel, input source path(the path of host,e.g. /tmp),input target path(the path of guest,e.g. /mnt),choose write policy as "immediate".

5: click Finish,click Apply

6: start the guest,check the xml of the guest,the write policy is "default" instead of "immediate",also write policy shows as "default" from virt-manager GUI.
# virsh -c lxc:/// dumpxml $gueset
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/tmp'/>
      <target dir='/mnt'/>
    </filesystem>


Actual results:
As description.

Expected results:
The write policy of lxc guest can be set as "immediate" from virt-manager GUI.

Additional info:
A.If I add the below line in guest xml,then boot the guest,write policy shows as "immediate" from virt-manager GUI.
    <driver type='path' wrpolicy='immediate'/>

B.Attach the detailed steps to create a lxc guest.
1. add the following yum repo
#vim /etc/yum.repos.d/yum-fedora.conf
[main]
cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[fedora]
name=Fedora $releasever - $basearch failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch

[updates]
name=Fedora $releasever - $basearch - Updates failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1

2.#yum -y --nogpg --releasever=19 --config=/etc/yum.repos.d/yum-fedora.conf --installroot=/var/lib/libvirt/filesystems/f19x86_64 --disablerepo='*' --enablerepo=fedora  install  systemd passwd yum redhat-release vim-minimal openssh-server procps

3. #echo "pts/0" >> /var/lib/libvirt/filesystems/f19x86_64/etc/securetty

4. #vi /var/lib/libvirt/filesystems/f19x86_64/etc/pam.d/login
 commnent out the following lines
#session    required     pam_selinux.so close
#session    required     pam_loginuid.so

5.add root user and the passwd.
#chroot /var/lib/libvirt/filesystems/f19x86_64 /bin/passwd root

6. Launch virt-manager
#virt-manager

7.Click "Create a new virtual machine"

8.input vm name,select "Localhost(LXC)" in "Connetion"

9.select "operating system container" and click "Forward"

10.Browse to path of rootfs.fedora,in this case is /var/lib/libvirt/filesystems/f19x86_64

11.set Memory and cpu ,and click "Forward"

12.click "Advanced options", click "Finish"

Comment 2 Martin Kletzander 2013-12-10 08:01:25 UTC
I guess that's just an XML Builder triviality somewhere, could you attach debug output of virt-manager when reproducing this?  Thanks.

Comment 3 tingting zheng 2013-12-10 11:41:04 UTC
(In reply to Martin Kletzander from comment #2)
> I guess that's just an XML Builder triviality somewhere, could you attach
> debug output of virt-manager when reproducing this?  Thanks.

When adding filesystem on lxc guest,debug info will show as:

2013-12-10 16:05:12,968 (addhardware:1320): Adding device:
    <filesystem>
      <source dir='/tmp'/>
      <target dir='/mnt'/>
    </filesystem>
2013-12-10 16:05:12,982 (libvirtobject:145): Redefining 'test' with XML diff:
--- Original XML
+++ New XML
@@ -25,5 +25,9 @@
     <console type="pty">
       <target type="lxc" port="0"/>
     </console>
+    <filesystem>
+      <source dir="/tmp"/>
+      <target dir="/mnt"/>
+    </filesystem>
   </devices>
 </domain>

Comment 4 Giuseppe Scrivano 2013-12-10 16:08:40 UTC
this option shouldn't be modifiable for non-qemu connections.  It is fixed upstream with:

commit 1ce02cc7d954069ce87bc5b330dfddf8491a1121
Author: Cole Robinson <crobinso>
Date:   Sun Sep 1 20:07:46 2013 -0400

    addhw: Fix FS UI for non-qemu


The patch changes other things that we wouldn't probably like to change for RHEL-7, so I am going to cherry-pick the parts that fix this particular issue.

Comment 8 hyao@redhat.com 2014-01-17 03:00:59 UTC
Verified the bug according to the following steps and comments4

# rpm -qa virt-manager
virt-manager-0.10.0-11.el7.noarch


1. open lxc guest via virt-manager, switch to hardware detail page,click add Hardware button

2 select Filesystem in left panel,there's no write policy option on the GUI.

Comment 9 Ludek Smid 2014-06-13 12:38:23 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.