Bug 1186969
| Summary: | Libvirt passes wrong cifs service syntax to mount.cifs when starting netfs pool using cifs format type | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Yang Yang <yanyang> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, jdenemar, jferlan, mzhan, rbalakri, shyu, xuzhang, ydu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.17-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:09:11 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: | |||
# getsebool -a | grep virt_use_samba virt_use_samba --> on Posted a couple patches upstream to resolve: http://www.redhat.com/archives/libvir-list/2015-June/msg00155.html After a slight adjustment to original patch, see: http://www.redhat.com/archives/libvir-list/2015-June/msg00693.html Pushed upstream: commit 29230951f1430c196420e8a3a5efbe5ea98f7184 Author: John Ferlan <jferlan> Date: Wed Jun 3 10:20:56 2015 -0400 storage: Generate correct parameters for CIFS When generating the path to the dir for a CIFS/Samba driver, the code would generate a source path for the mount using "%s:%s" while the mount.cifs expects to see "//%s/%s". So check for the cifsfs and format the source path appropriately. Additionally, since there is no means to authenticate, the mount needs a "-o guest" on the command line in order to anonymously mount the Samba directory. $ git describe 29230951f1430c196420e8a3a5efbe5ea98f7184 v1.2.16-164-g2923095 $ John,
Source dir started with slash. So 1 redundant slash after source hostname is provided in following code. The code generates //10.66.4.164//samba_share while mount.cifs expects //10.66.4.164/samba_share
if (pool->def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
if (virAsprintf(&src, "//%s/%s",
pool->def->source.hosts[0].name,
pool->def->source.dir) == -1)
return -1;
e.g.
# virsh pool-start netfs-cifs
error: Failed to start pool netfs-cifs
error: internal error: Child process (/usr/bin/mount -t cifs //10.66.4.164//samba_share /tmp/cifs -o guest) unexpected exit status 32: 2015-07-10 09:21:30.082+0000: 29237: debug : virFileClose:102 : Closed fd 28
2015-07-10 09:21:30.082+0000: 29237: debug : virFileClose:102 : Closed fd 30
2015-07-10 09:21:30.082+0000: 29237: debug : virFileClose:102 : Closed fd 26
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Please ignore comment #5 Have a better look at patch, it says the path to the Samba share without the leading slash. I will test again. Verified with libvirt-1.2.17-1.el7.x86_64
Steps
1. 1. define a netfs pool using cifs format
# cat nfs-cifs-pool.xml
<pool type="netfs">
<name>netfs-cifs</name>
<source>
<host name="10.66.4.164"/>
<dir path="samba_share"/>
<format type='cifs'/>
</source>
<target>
<path>/tmp/cifs</path>
</target>
</pool>
#virsh pool-define nfs-cifs-pool.xml
2. build the pool
#virsh pool-build netfs-cifs
3. start the pool
# virsh pool-start netfs-cifs
Pool netfs-cifs started
Just a note that acknowledge I too had the same concern when developing - that is the "leading" slash; however, after researching usage of "relative" vs "absolute" directory path, I decided to follow the existing gluster example which requires the relative path since it felt like the cifs pool would be more alike that than perhaps some sort of "normal" (hah) file system pool. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |
Description of problem: Netfs pool using cifs format startup issues 'mount -t cifs $service $mount-point'. Libvirt passes 'server:/shareDir' as the cifs service pattern. However, mount.cifs can Not parse that pattern, it requires '//server/shareDir' syntax. Version-Release number of selected component (if applicable): libvirt-1.2.8-15.el7.x86_64 How reproducible: 100% Steps to Reproduce: Prepare a samba server as following # smbclient -L //10.66.84.12/samba_share Enter root's password: Anonymous login successful Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.12] Sharename Type Comment --------- ---- ------- samba_share Disk Samba share IPC$ IPC IPC Service (Samba Server Version 4.1.12) Anonymous login successful Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.12] Server Comment --------- ------- Workgroup Master --------- ------- 1. define a netfs pool using cifs format # cat nfs-cifs-pool.xml <pool type="netfs"> <name>netfs-cifs</name> <source> <host name="10.66.84.12"/> <dir path="/samba_share"/> <format type='cifs'/> </source> <target> <path>/mnt/cifs</path> </target> </pool> #virsh pool-define nfs-cifs-pool.xml 2. build the pool #virsh pool-build netfs-cifs 3. start the pool # virsh pool-start netfs-cifs error: Failed to start pool netfs-cifs error: internal error: Child process (/usr/bin/mount -t cifs 10.66.84.12:/samba_share /mnt/cifs) unexpected exit status 1: 2015-01-28 09:13:37.994+0000: 27911: debug : virFileClose:99 : Closed fd 25 2015-01-28 09:13:37.994+0000: 27911: debug : virFileClose:99 : Closed fd 27 2015-01-28 09:13:37.994+0000: 27911: debug : virFileClose:99 : Closed fd 23 mount.cifs: bad UNC (10.66.84.12:/samba_share) Actual results: Expected results: In step 3. mount.cifs requires '//10.66.84.12/samba_share' syntax rather than '10.66.84.12:/samba_share' Additional info: Generally, user/password is needed when mounting samba server. However, libvirt does not provides those attributes in netfs pool xml. So libvirt has to mount samba server in anonymous mode. If so, it requires another option '-o guest'.