Merge "libvirt: move the LibvirtGPFSVolumeDriver into it's own module"
This commit is contained in:
commit
8976bd20ad
32
nova/tests/unit/virt/libvirt/volume/test_gpfs.py
Normal file
32
nova/tests/unit/virt/libvirt/volume/test_gpfs.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||||
|
from nova.virt.libvirt.volume import gpfs
|
||||||
|
|
||||||
|
|
||||||
|
class LibvirtGPFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
|
||||||
|
|
||||||
|
def test_libvirt_gpfs_driver_get_config(self):
|
||||||
|
libvirt_driver = gpfs.LibvirtGPFSVolumeDriver(self.fake_conn)
|
||||||
|
connection_info = {
|
||||||
|
'driver_volume_type': 'gpfs',
|
||||||
|
'data': {
|
||||||
|
'device_path': '/gpfs/foo',
|
||||||
|
},
|
||||||
|
'serial': 'fake_serial',
|
||||||
|
}
|
||||||
|
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
||||||
|
tree = conf.format_dom()
|
||||||
|
self.assertEqual('file', tree.get('type'))
|
||||||
|
self.assertEqual('fake_serial', tree.find('./serial').text)
|
@ -922,17 +922,3 @@ Setting up iSCSI targets: unused
|
|||||||
export_string, export_mnt_base),
|
export_string, export_mnt_base),
|
||||||
('umount', export_mnt_base)]
|
('umount', export_mnt_base)]
|
||||||
self.assertEqual(expected_commands, self.executes)
|
self.assertEqual(expected_commands, self.executes)
|
||||||
|
|
||||||
def test_libvirt_gpfs_driver_get_config(self):
|
|
||||||
libvirt_driver = volume.LibvirtGPFSVolumeDriver(self.fake_conn)
|
|
||||||
connection_info = {
|
|
||||||
'driver_volume_type': 'gpfs',
|
|
||||||
'data': {
|
|
||||||
'device_path': '/gpfs/foo',
|
|
||||||
},
|
|
||||||
'serial': 'fake_serial',
|
|
||||||
}
|
|
||||||
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
|
||||||
tree = conf.format_dom()
|
|
||||||
self.assertEqual('file', tree.get('type'))
|
|
||||||
self.assertEqual('fake_serial', tree.find('./serial').text)
|
|
||||||
|
@ -285,7 +285,7 @@ libvirt_volume_drivers = [
|
|||||||
'fibre_channel='
|
'fibre_channel='
|
||||||
'nova.virt.libvirt.volume.volume.LibvirtFibreChannelVolumeDriver',
|
'nova.virt.libvirt.volume.volume.LibvirtFibreChannelVolumeDriver',
|
||||||
'scality=nova.virt.libvirt.volume.volume.LibvirtScalityVolumeDriver',
|
'scality=nova.virt.libvirt.volume.volume.LibvirtScalityVolumeDriver',
|
||||||
'gpfs=nova.virt.libvirt.volume.volume.LibvirtGPFSVolumeDriver',
|
'gpfs=nova.virt.libvirt.volume.gpfs.LibvirtGPFSVolumeDriver',
|
||||||
'quobyte=nova.virt.libvirt.volume.quobyte.LibvirtQuobyteVolumeDriver',
|
'quobyte=nova.virt.libvirt.volume.quobyte.LibvirtQuobyteVolumeDriver',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
28
nova/virt/libvirt/volume/gpfs.py
Normal file
28
nova/virt/libvirt/volume/gpfs.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||||
|
|
||||||
|
|
||||||
|
class LibvirtGPFSVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
|
||||||
|
"""Class for volumes backed by gpfs volume."""
|
||||||
|
def __init__(self, connection):
|
||||||
|
super(LibvirtGPFSVolumeDriver,
|
||||||
|
self).__init__(connection, is_block_dev=False)
|
||||||
|
|
||||||
|
def get_config(self, connection_info, disk_info):
|
||||||
|
"""Returns xml for libvirt."""
|
||||||
|
conf = super(LibvirtGPFSVolumeDriver,
|
||||||
|
self).get_config(connection_info, disk_info)
|
||||||
|
conf.source_type = "file"
|
||||||
|
conf.source_path = connection_info['data']['device_path']
|
||||||
|
return conf
|
@ -763,18 +763,3 @@ class LibvirtScalityVolumeDriver(LibvirtBaseVolumeDriver):
|
|||||||
msg = _("Cannot mount Scality SOFS, check syslog for errors")
|
msg = _("Cannot mount Scality SOFS, check syslog for errors")
|
||||||
LOG.warn(msg)
|
LOG.warn(msg)
|
||||||
raise exception.NovaException(msg)
|
raise exception.NovaException(msg)
|
||||||
|
|
||||||
|
|
||||||
class LibvirtGPFSVolumeDriver(LibvirtBaseVolumeDriver):
|
|
||||||
"""Class for volumes backed by gpfs volume."""
|
|
||||||
def __init__(self, connection):
|
|
||||||
super(LibvirtGPFSVolumeDriver,
|
|
||||||
self).__init__(connection, is_block_dev=False)
|
|
||||||
|
|
||||||
def get_config(self, connection_info, disk_info):
|
|
||||||
"""Returns xml for libvirt."""
|
|
||||||
conf = super(LibvirtGPFSVolumeDriver,
|
|
||||||
self).get_config(connection_info, disk_info)
|
|
||||||
conf.source_type = "file"
|
|
||||||
conf.source_path = connection_info['data']['device_path']
|
|
||||||
return conf
|
|
||||||
|
Loading…
Reference in New Issue
Block a user