13
13
from oslo_log import log as logging
14
14
15
15
import nova .conf
16
- from nova import exception
17
- from nova .i18n import _
18
- from nova import utils
19
16
from nova .virt .libvirt .volume import volume as libvirt_volume
20
17
21
18
@@ -29,30 +26,6 @@ def __init__(self, host):
29
26
super (LibvirtNetVolumeDriver ,
30
27
self ).__init__ (host , is_block_dev = False )
31
28
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
-
56
29
def _set_auth_config_rbd (self , conf , netdisk_properties ):
57
30
# The rbd volume driver in cinder sets auth_enabled if the rbd_user is
58
31
# 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):
94
67
# secret_type is always hard-coded to 'ceph' in cinder
95
68
conf .auth_secret_type = netdisk_properties ['secret_type' ]
96
69
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
-
104
70
def get_config (self , connection_info , disk_info ):
105
71
"""Returns xml for libvirt."""
106
72
conf = super (LibvirtNetVolumeDriver ,
@@ -114,28 +80,8 @@ def get_config(self, connection_info, disk_info):
114
80
conf .source_ports = netdisk_properties .get ('ports' , [])
115
81
if conf .source_protocol == 'rbd' :
116
82
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 )
131
83
return conf
132
84
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
-
139
85
def extend_volume (self , connection_info , instance , requested_size ):
140
86
# There is nothing to do for network volumes. Cinder already extended
141
87
# the volume and there is no local block device which needs to be
0 commit comments