Coverage for nova/virt/libvirt/volume/iser.py: 100%

12 statements  

« 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. 

12 

13from os_brick import initiator 

14from os_brick.initiator import connector 

15 

16import nova.conf 

17from nova import utils 

18from nova.virt.libvirt.volume import iscsi 

19 

20 

21CONF = nova.conf.CONF 

22 

23 

24class LibvirtISERVolumeDriver(iscsi.LibvirtISCSIVolumeDriver): 

25 """Driver to attach Network volumes to libvirt.""" 

26 

27 def __init__(self, connection): 

28 super(LibvirtISERVolumeDriver, self).__init__(connection) 

29 

30 # Call the factory here so we can support 

31 # more than x86 architectures. 

32 self.connector = connector.InitiatorConnector.factory( 

33 initiator.ISER, utils.get_root_helper(), 

34 use_multipath=CONF.libvirt.iser_use_multipath, 

35 device_scan_attempts=CONF.libvirt.num_iser_scan_tries, 

36 transport=self._get_transport(), 

37 enforce_multipath=CONF.libvirt.volume_enforce_multipath) 

38 

39 def _get_transport(self): 

40 return 'iser'