[Openstack-operators] [openstack-ansible] configuration to use nfs for glance and cinder

Andreas Vallin andreas.vallin at it.uu.se
Fri Feb 3 08:56:55 UTC 2017


Hi!

I need to ask how do you correctly configure nfs to be used with 
openstack-ansible newton (14.0.6). I think it is great that there is an 
production example file that uses nfs for glance and cinder 
(openstack_user_config.yml.prod.example) but the cinder config is not 
working for me.

I use this config for storage_hosts, only changing ip, and share from 
production example:

storage_hosts:
   XxXx:
     ip: 172.22.5.9
     container_vars:
       cinder_backends:
         limit_container_types: cinder_volume
         cinder_nfs_client:
           nfs_shares_config: /etc/cinder/nfs_shares
           shares:
             - ip: "172.22.20.254"
               share: "/nfs/cinder/production"

And this is the failure when running os-cinder-install.yml

TASK [os_cinder : Add in cinder devices types] 
*********************************
fatal: [XxXx_cinder_volumes_container-080139bd]: FAILED! => {"failed": 
true, "msg": "the field 'args' has an invalid value, which appears to 
include a variable that is undefined. The error was: 'dict object' has 
no attribute 'volume_backend_name'\n\nThe error appears to have been in 
'/etc/ansible/roles/os_cinder/tasks/cinder_backends.yml': line 30, 
column 3, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Add in 
cinder devices types\n  ^ here\n"}

OK, so volume_backend_name is missing. The playbook runs if I add 
volume_backend_name to the config like this:


storage_hosts:
   XxXx:
     ip: 172.22.5.9
     container_vars:
       cinder_backends:
         limit_container_types: cinder_volume
         cinder_nfs_client:
           volume_backend_name: cinder_nfs
           nfs_shares_config: /etc/cinder/nfs_shares
           shares:
             - ip: "172.22.20.254"
               share: "/nfs/cinder/production"


But now there is no /etc/cinder/nfs_shares file in the 
cinder-volumes-container so the nfs share will not be mounted. This is 
because the "Create nfs shares export file" task in 
cinder_post_install.yml doesn't see that cinder_nfs_client is defined. 
You also get this in cinder.conf:

enabled_backends=cinder_nfs_client
# All given backend(s)
[cinder_nfs_client]
volume_backend_name=cinder_nfs
nfs_shares_config=/etc/cinder/nfs_shares
shares=[{u'ip': u'172.22.20.254', u'share': u'/nfs/cinder/production'}]


This configuration works for me:

storage_hosts:
   XxXx:
     ip: 172.22.5.9
     container_vars:
       cinder_storage_availability_zone: cinderAZ_1
       cinder_default_availability_zone: cinderAZ_1
       limit_container_types: cinder_volume
       cinder_backends:
         cinder_nfs:
           volume_backend_name: cinder_nfs
           volume_driver: cinder.volume.drivers.nfs.NfsDriver
           nfs_mount_options: 
"_netdev,auto,rw,intr,noatime,async,vers=3,proto=tcp,wsize=1048576,rsize=1048576,timeo=1200,actimeo=120"
       cinder_nfs_client:
         nfs_shares_config: /etc/cinder/nfs_shares
         shares:
           - ip: "172.22.20.254"
             share: "/nfs/cinder/production"


BUT when I look in the inventory file (openstack_inventory.json) it 
doesn't look like this configuration is limited to cinder_volume 
containers even if "limit_container_types: cinder_volume" is used. So 
now I feel it is time to ask how a correct configuration should look like.

Regards,
Andreas




More information about the OpenStack-operators mailing list