mount nfs volume failed with "options" is a blank string

Bug #1374915 reported by ephem
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Yukihiro KAWADA

Bug Description

When mount volume with nfs backend to instance, it would be failed.

        if options is not None:
            nfs_cmd.extend(options.split(' '))

We find when "options" is a blank string like "" wloud generate a part in final cmd as "u''". The final cmd seems like

[u'mount', u'-t', u'nfs', u'', u'***', u'***']

And this cmd made the operation of mounting fail.

We have fixed this bug by simply changing the if statement as follow:

        if options:
            nfs_cmd.extend(options.split(' '))

Tags: nfs volume
Revision history for this message
ephem (tpiperatgod) wrote :

And the exception is a Mount Usage error.

Revision history for this message
Thang Pham (thang-pham) wrote :

Please provide the error that you got, e.g. cinder-api.log and cinder-volume.log, as well as the nova.conf and cinder.conf file that you used. I have used NFS for the past several weeks and have not observed what you mentioned.

Changed in nova:
status: New → Incomplete
tags: removed: mount nova
Revision history for this message
ephem (tpiperatgod) wrote :

Hi, I'm sorry i have no log file and config file current.
May be you could just set the value of "options" to be a blank string in the program to recur this problem.

Revision history for this message
Yukihiro KAWADA (warp-kawada) wrote :
Download full text (9.3 KiB)

This is a critical BUG.

nfs mount volume attach fails always.
Cause is because blank is in the cmd. (ephem said).

--- a/virt/libvirt/volume.py
+++ b/virt/libvirt/volume.py
@@ -707,11 +707,16 @@ class LibvirtNFSVolumeDriver(LibvirtBaseVolumeDriver):
         # Construct the NFS mount command.
         nfs_cmd = ['mount', '-t', 'nfs']
         if CONF.libvirt.nfs_mount_options is not None:
+ utils.my_logger("libvirt options:[%s] is" % CONF.libvirt.nfs_mount_options)
             nfs_cmd.extend(['-o', CONF.libvirt.nfs_mount_options])
- if options is not None:
+# if options is not None:
+ if options != '': # Y.kawada
+ utils.my_logger("def options:<%s>" % options)
+ utils.my_logger("def options type:<%s>" % type(options))

this options type is type:<<type 'unicode'>>, not 'None'.
above codes work correctly.

error log is:

 Running cmd (subprocess): sudo nova-rootwrap /etc/nova/rootwrap.conf mount -t nfs 172.21.16.33:/volumes/pool1/vol1/volume-fa602cec-
5418-42c3-8344-71cdbaf86e33 /var/lib/nova/mnt/d8b3618b6946bb9e162741588f0cd99a execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:161
2014-11-25 15:51:07.388 27540 DEBUG nova.openstack.common.processutils [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] p_cmd:['sudo', 'nova-rootwrap', '/etc/nova/rootwrap.conf', 'mount', '-t', 'nfs', '', '172.21.16.33:/volumes/pool1/vol1/volume-fa602c
ec-5418-42c3-8344-71cdbaf86e33', '/var/lib/nova/mnt/d8b3618b6946bb9e162741588f0cd99a'] prefn:<function _subprocess_setup at 0x1f24aa0> shell:False execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:171
2014-11-25 15:51:07.396 27540 DEBUG nova.openstack.common.processutils [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] pro_in:None execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:184
2014-11-25 15:51:07.397 27540 DEBUG nova.openstack.common.processutils [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] pro_comm 2 execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:190
2014-11-25 15:51:07.397 27540 DEBUG nova.openstack.common.processutils [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] s_smd:sudo nova-rootwrap /etc/nova/rootwrap.conf mount -t nfs 172.21.16.33:/volumes/pool1/vol1/volume-fa602cec-5418-42c3-8344-71cdb
af86e33 /var/lib/nova/mnt/d8b3618b6946bb9e162741588f0cd99a execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:191
2014-11-25 15:51:07.453 27540 DEBUG nova.openstack.common.processutils [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] Result was 1 execute /usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py:200
2014-11-25 15:51:07.453 27540 ERROR nova.virt.block_device [req-6f984608-a3e8-410c-be33-9fb9d4b6ae14 None] [instance: 58a69940-fbcc-494f-aa97-4aa506952524] Driver failed to attach volume fa602cec-5418-42c3-8344-71cdbaf86e33 at /dev/vdb
2014-11-25 15:51:07.453 27540 TRACE nova.virt.block_device [instance: 58a69940-fbcc-494f-aa97-4aa506952524] Traceback (most recent call last):
2014-11-25 15:51:07.453 27540 TRACE nova.virt.block_device [instance: 58a69940-fbcc-494f-aa97-4aa506952524] Fi...

Read more...

Revision history for this message
ephem (tpiperatgod) wrote :

Thanks for Yukihiro KAWADA, the solution seems more complete.

Changed in nova:
assignee: nobody → Yukihiro KAWADA (warp-kawada)
Changed in nova:
status: Incomplete → Confirmed
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/138004

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/138004
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6f2325921443197b277e92e8531e811727db7201
Submitter: Jenkins
Branch: master

commit 6f2325921443197b277e92e8531e811727db7201
Author: Yukihiro KAWADA <email address hidden>
Date: Mon Dec 1 15:36:59 2014 +0900

    This patch fixes the check that 'options' object is empty correctly.

    'options' object type is 'unicode',it might be None or empty in here.
    So, useless blank be added to the argument of the mount command.
    After all, execute/processutils process will fail in the current situation.

    Change-Id: I45dcacd6499c3d4e0d26c0e2ee46b7f7d149f803
    Closes-Bug: #1374915

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Sean Dague (<email address hidden>) on branch: master
Review: https://review.openstack.org/137272
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.