NFS driver breaks if volume name contains spaces

Bug #1180984 reported by Eric Harney on 2013-05-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Undecided
Anton Frolov

Bug Description

The NFS driver mounts volumes whose names contain spaces, but fails when it tries to parse "df" output for them. I assume this isn't common but it appears to be supported by NFS.

$ cat /etc/cinder/nfs_shares
192.168.175.166:/srv/nfs volume 1

2013-05-16 16:47:19 DEBUG [cinder.utils] Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf df -P -B 1 /opt/stack/data/cinder/mnt/96f0da84f4da6dd8bd61093031fabcad
2013-05-16 16:47:19 ERROR [cinder.service] Unhandled exception
Traceback (most recent call last):
  File "/opt/stack/cinder/cinder/service.py", line 227, in _start_child
    self._child_process(wrap.server)
  File "/opt/stack/cinder/cinder/service.py", line 204, in _child_process
    launcher.run_server(server)
  File "/opt/stack/cinder/cinder/service.py", line 95, in run_server
    server.start()
  File "/opt/stack/cinder/cinder/service.py", line 355, in start
    self.manager.init_host()
  File "/opt/stack/cinder/cinder/volume/manager.py", line 165, in init_host
    self.publish_service_capabilities(ctxt)
  File "/opt/stack/cinder/cinder/volume/manager.py", line 698, in publish_service_capabilities
    self._report_driver_status(context)
  File "/opt/stack/cinder/cinder/volume/manager.py", line 690, in _report_driver_status
    volume_stats = self.driver.get_volume_stats(refresh=True)
  File "/opt/stack/cinder/cinder/volume/drivers/nfs.py", line 316, in get_volume_stats
    self._update_volume_status()
  File "/opt/stack/cinder/cinder/volume/drivers/nfs.py", line 335, in _update_volume_status
    free, capacity = self._get_available_capacity(nfs_share)
  File "/opt/stack/cinder/cinder/volume/drivers/nfs.py", line 281, in _get_available_capacity
    size = int(out.split()[1])
ValueError: invalid literal for int() with base 10: 'volume'
2013-05-16 16:47:19 INFO [cinder.service] Child 4873 exited with status 2
2013-05-16 16:47:19 INFO [cinder.service] _wait_child 1
2013-05-16 16:47:19 INFO [cinder.service] wait wrap.failed True

$ sudo cinder-rootwrap /etc/cinder/rootwrap.conf df -P -B 1 /opt/stack/data/cinder/mnt/96f0da84f4da6dd8bd61093031fabcad
Filesystem 1-blocks Used Available Capacity Mounted on
192.168.175.166:/srv/nfs volume 1 17758683136 5980028928 10869538816 36% /opt/stack/data/cinder/mnt/96f0da84f4da6dd8bd61093031fabcad

Changed in cinder:
status: New → Confirmed
Eric Harney (eharney) wrote :

I also noticed this while working on https://review.openstack.org/#/c/29323 .

Since this bug involves reworking the way NFS shares are configured, my suggestion is that this be taken up as part of an effort to get rid of the separate nfs_shares config file and move NFS configuration into cinder.conf. (All of this applies the same for the GlusterFS driver.)

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

Changed in cinder:
assignee: nobody → Anton Frolov (anton0)
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/30750
Committed: http://github.com/openstack/cinder/commit/924640705c05ba69e2ad2095920fc1d209d32b20
Submitter: Jenkins
Branch: master

commit 924640705c05ba69e2ad2095920fc1d209d32b20
Author: Anton Frolov <email address hidden>
Date: Tue May 28 19:34:41 2013 +0400

    Support for NFS shares with spaces in path.

    Unescape share address string listed in nfs_shares_config so that
    'x.y.z.w:/foo\040bar' would become 'x.y.z.w:/foo bar' to support
    mounting shares with spaces in name.
    Use stat command to get available and total space on device instead
    of df since it's output is easier to parse.

    Fixes: bug #1180984
    Change-Id: I552aba91ca8db14130f854c739594a818186bbe2

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-07-17
Changed in cinder:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers