Coverage for nova/virt/libvirt/volume/cephfs.py: 87%
24 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
13# The driver is not designed to function as a volume for libvirt. Rather,
14# its purpose is to facilitate the mounting of cephfs shares exposed by manila
15# on compute, enabling the shares to be accessed and shared using virtiofs.
16# This is the reason why get_config and extend_volume are not implemented.
18import nova.conf
19from nova.virt.libvirt.volume import fs
21CONF = nova.conf.CONF
24class LibvirtCEPHFSVolumeDriver(fs.LibvirtMountedFileSystemVolumeDriver):
25 """Class implements libvirt part of volume driver for CEPHFS."""
27 def __init__(self, connection):
28 super(LibvirtCEPHFSVolumeDriver, self).__init__(connection, 'ceph')
30 def _get_mount_point_base(self):
31 return CONF.libvirt.ceph_mount_point_base
33 def get_config(self, connection_info, disk_info):
34 raise NotImplementedError()
36 def _mount_options(self, connection_info):
37 options = []
38 conn_options = connection_info['data'].get('options')
39 if CONF.libvirt.ceph_mount_options is not None:
40 options.extend(CONF.libvirt.ceph_mount_options)
41 if conn_options: 41 ↛ 43line 41 didn't jump to line 43 because the condition on line 41 was always true
42 options.extend(conn_options)
43 options = [','.join(options)]
44 options.insert(0, '-o')
45 else:
46 if conn_options: 46 ↛ 49line 46 didn't jump to line 49 because the condition on line 46 was always true
47 options.extend(['-o', ','.join(conn_options)])
49 return options
51 def extend_volume(self, connection_info, instance, requested_size):
52 raise NotImplementedError()