NFS driver breaks if volume name contains spaces

Bug #1180984 reported by Eric Harney on 2013-05-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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 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/", line 227, in _start_child
  File "/opt/stack/cinder/cinder/", line 204, in _child_process
  File "/opt/stack/cinder/cinder/", line 95, in run_server
  File "/opt/stack/cinder/cinder/", line 355, in start
  File "/opt/stack/cinder/cinder/volume/", line 165, in init_host
  File "/opt/stack/cinder/cinder/volume/", line 698, in publish_service_capabilities
  File "/opt/stack/cinder/cinder/volume/", line 690, in _report_driver_status
    volume_stats = self.driver.get_volume_stats(refresh=True)
  File "/opt/stack/cinder/cinder/volume/drivers/", line 316, in get_volume_stats
  File "/opt/stack/cinder/cinder/volume/drivers/", line 335, in _update_volume_status
    free, capacity = self._get_available_capacity(nfs_share)
  File "/opt/stack/cinder/cinder/volume/drivers/", 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 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 .

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

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

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