'driver_volume_type': 'rbd',
'data': {
'name': '%s/%s' % ('rbd', volume['name']),
- 'auth_enabled': CONF.libvirt.rbd_secret_uuid is not None,
+ 'auth_enabled': CONF.libvirt.rbd_user is not None,
'auth_username': CONF.libvirt.rbd_user,
'secret_type': 'ceph',
'secret_uuid': CONF.libvirt.rbd_secret_uuid,
self.assertEqual(self.uuid, tree.find('./auth/secret').get('uuid'))
libvirt_driver.disconnect_volume(connection_info, "vde")
- def test_libvirt_rbd_driver_auth_enabled_flags_override(self):
+ def test_libvirt_rbd_driver_auth_enabled_flags(self):
+ # The values from the cinder connection_info take precedence over
+ # nova.conf values.
libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
connection_info = self.rbd_connection(self.vol)
secret_type = 'ceph'
conf = libvirt_driver.get_config(connection_info, self.disk_info)
tree = conf.format_dom()
self._assertNetworkAndProtocolEquals(tree)
- self.assertEqual(flags_user, tree.find('./auth').get('username'))
+ self.assertEqual(self.user, tree.find('./auth').get('username'))
self.assertEqual(secret_type, tree.find('./auth/secret').get('type'))
- self.assertEqual(flags_uuid, tree.find('./auth/secret').get('uuid'))
+ self.assertEqual(self.uuid, tree.find('./auth/secret').get('uuid'))
libvirt_driver.disconnect_volume(connection_info, "vde")
def test_libvirt_rbd_driver_auth_disabled(self):
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_log import log as logging
+
import nova.conf
from nova import exception
-from nova.i18n import _
+from nova.i18n import _, _LW
from nova import utils
from nova.virt.libvirt.volume import volume as libvirt_volume
CONF = nova.conf.CONF
+LOG = logging.getLogger(__name__)
class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
self.host.delete_secret(usage_type, usage_name)
def _set_auth_config_rbd(self, conf, netdisk_properties):
+ # The rbd volume driver in cinder sets auth_enabled if the rbd_user is
+ # set in cinder. The rbd auth values from the cinder connection take
+ # precedence over any local nova config values in case the cinder ceph
+ # backend is configured differently than the nova rbd ephemeral storage
+ # configuration.
auth_enabled = netdisk_properties.get('auth_enabled')
- if CONF.libvirt.rbd_secret_uuid:
- conf.auth_secret_uuid = CONF.libvirt.rbd_secret_uuid
- auth_enabled = True # Force authentication locally
- if CONF.libvirt.rbd_user:
- conf.auth_username = CONF.libvirt.rbd_user
if auth_enabled:
- conf.auth_username = (conf.auth_username or
- netdisk_properties['auth_username'])
- conf.auth_secret_type = (conf.auth_secret_type or
- netdisk_properties['secret_type'])
- conf.auth_secret_uuid = (conf.auth_secret_uuid or
- netdisk_properties['secret_uuid'])
+ conf.auth_username = netdisk_properties['auth_username']
+ conf.auth_secret_uuid = netdisk_properties['secret_uuid']
+ # secret_type is always hard-coded to 'ceph' in cinder
+ conf.auth_secret_type = netdisk_properties['secret_type']
+ elif CONF.libvirt.rbd_secret_uuid:
+ # Anyone relying on falling back to nova config is probably having
+ # this work accidentally and we'll remove that support in the
+ # 16.0.0 Pike release.
+ LOG.warning(_LW('Falling back to Nova configuration values for '
+ 'RBD authentication. Cinder should be configured '
+ 'for auth with Ceph volumes. This fallback will '
+ 'be dropped in the Nova 16.0.0 Pike release.'))
+ # use the nova config values
+ conf.auth_username = CONF.libvirt.rbd_user
+ conf.auth_secret_uuid = CONF.libvirt.rbd_secret_uuid
+ # secret_type is always hard-coded to 'ceph' in cinder
+ conf.auth_secret_type = netdisk_properties['secret_type']
def _set_auth_config_iscsi(self, conf, netdisk_properties):
if netdisk_properties.get('auth_method') == 'CHAP':
--- /dev/null
+---
+upgrade:
+ - |
+ When making connections to Ceph-backed volumes via the Libvirt driver, the
+ auth values (rbd_user, rbd_secret_uuid) are now pulled from the backing
+ cinder.conf rather than nova.conf. The nova.conf values are only used if
+ set and the cinder.conf values are not set, but this fallback support is
+ considered accidental and will be removed in the Nova 16.0.0 Pike release.
+ See the Ceph documentation for `configuring Cinder`_ for RBD auth.
+
+ .. _configuring Cinder: http://docs.ceph.com/docs/master/rbd/rbd-openstack/#configuring-cinder