Skip to content

Commit 2722cab

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "libvirt: Remove unreachable native QEMU iSCSI initiator config code"
2 parents 8260979 + b8c55d1 commit 2722cab

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

nova/tests/unit/virt/libvirt/volume/test_net.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import nova.conf
1616
from nova.tests.unit.virt.libvirt.volume import test_volume
17-
from nova.virt.libvirt import host
1817
from nova.virt.libvirt.volume import net
1918

2019
CONF = nova.conf.CONF
@@ -220,28 +219,6 @@ def test_libvirt_rbd_driver_auth_disabled_flags_override(self):
220219
libvirt_driver.disconnect_volume(connection_info,
221220
mock.sentinel.instance)
222221

223-
@mock.patch.object(host.Host, 'find_secret')
224-
@mock.patch.object(host.Host, 'create_secret')
225-
@mock.patch.object(host.Host, 'delete_secret')
226-
def test_libvirt_iscsi_net_driver(self, mock_delete, mock_create,
227-
mock_find):
228-
mock_find.return_value = test_volume.FakeSecret()
229-
mock_create.return_value = test_volume.FakeSecret()
230-
libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
231-
connection_info = self.iscsi_connection(self.vol, self.location,
232-
self.iqn, auth=True)
233-
secret_type = 'iscsi'
234-
flags_user = connection_info['data']['auth_username']
235-
conf = libvirt_driver.get_config(connection_info, self.disk_info)
236-
tree = conf.format_dom()
237-
self._assertISCSINetworkAndProtocolEquals(tree)
238-
self.assertEqual(flags_user, tree.find('./auth').get('username'))
239-
self.assertEqual(secret_type, tree.find('./auth/secret').get('type'))
240-
self.assertEqual(test_volume.SECRET_UUID,
241-
tree.find('./auth/secret').get('uuid'))
242-
libvirt_driver.disconnect_volume(connection_info,
243-
mock.sentinel.instance)
244-
245222
def test_extend_volume(self):
246223
device_path = '/dev/fake-dev'
247224
connection_info = {'data': {'device_path': device_path}}

nova/virt/libvirt/volume/net.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
from oslo_log import log as logging
1414

1515
import nova.conf
16-
from nova import exception
17-
from nova.i18n import _
18-
from nova import utils
1916
from nova.virt.libvirt.volume import volume as libvirt_volume
2017

2118

@@ -29,30 +26,6 @@ def __init__(self, host):
2926
super(LibvirtNetVolumeDriver,
3027
self).__init__(host, is_block_dev=False)
3128

32-
def _get_secret_uuid(self, conf, password=None):
33-
# TODO(mriedem): Add delegation methods to connection (LibvirtDriver)
34-
# to call through for these secret CRUD operations so the volume driver
35-
# doesn't need to know the internal attributes of the connection
36-
# object.
37-
secret = self.host.find_secret(conf.source_protocol,
38-
conf.source_name)
39-
if secret is None:
40-
secret = self.host.create_secret(conf.source_protocol,
41-
conf.source_name,
42-
password)
43-
return secret.UUIDString()
44-
45-
def _delete_secret_by_name(self, connection_info):
46-
source_protocol = connection_info['driver_volume_type']
47-
netdisk_properties = connection_info['data']
48-
if source_protocol == 'rbd':
49-
return
50-
elif source_protocol == 'iscsi':
51-
usage_type = 'iscsi'
52-
usage_name = ("%(target_iqn)s/%(target_lun)s" %
53-
netdisk_properties)
54-
self.host.delete_secret(usage_type, usage_name)
55-
5629
def _set_auth_config_rbd(self, conf, netdisk_properties):
5730
# The rbd volume driver in cinder sets auth_enabled if the rbd_user is
5831
# set in cinder. The rbd auth values from the cinder connection take
@@ -94,13 +67,6 @@ def _set_auth_config_rbd(self, conf, netdisk_properties):
9467
# secret_type is always hard-coded to 'ceph' in cinder
9568
conf.auth_secret_type = netdisk_properties['secret_type']
9669

97-
def _set_auth_config_iscsi(self, conf, netdisk_properties):
98-
if netdisk_properties.get('auth_method') == 'CHAP':
99-
conf.auth_secret_type = 'iscsi'
100-
password = netdisk_properties.get('auth_password')
101-
conf.auth_secret_uuid = self._get_secret_uuid(conf, password)
102-
conf.auth_username = netdisk_properties['auth_username']
103-
10470
def get_config(self, connection_info, disk_info):
10571
"""Returns xml for libvirt."""
10672
conf = super(LibvirtNetVolumeDriver,
@@ -114,28 +80,8 @@ def get_config(self, connection_info, disk_info):
11480
conf.source_ports = netdisk_properties.get('ports', [])
11581
if conf.source_protocol == 'rbd':
11682
self._set_auth_config_rbd(conf, netdisk_properties)
117-
elif conf.source_protocol == 'iscsi':
118-
try:
119-
conf.source_name = ("%(target_iqn)s/%(target_lun)s" %
120-
netdisk_properties)
121-
target_portal = netdisk_properties['target_portal']
122-
except KeyError:
123-
raise exception.InternalError(_("Invalid volume source data"))
124-
125-
ip, port = utils.parse_server_string(target_portal)
126-
if ip == '' or port == '':
127-
raise exception.InternalError(_("Invalid target_lun"))
128-
conf.source_hosts = [ip]
129-
conf.source_ports = [port]
130-
self._set_auth_config_iscsi(conf, netdisk_properties)
13183
return conf
13284

133-
def disconnect_volume(self, connection_info, instance):
134-
"""Detach the volume from instance_name."""
135-
super(LibvirtNetVolumeDriver,
136-
self).disconnect_volume(connection_info, instance)
137-
self._delete_secret_by_name(connection_info)
138-
13985
def extend_volume(self, connection_info, instance, requested_size):
14086
# There is nothing to do for network volumes. Cinder already extended
14187
# the volume and there is no local block device which needs to be

0 commit comments

Comments
 (0)