@@ -120,6 +120,31 @@ class TestDriverBlockDevice(test.NoDBTestCase):
120
120
'connection_info' : {"fake" : "connection_info" },
121
121
'delete_on_termination' : False }
122
122
123
+ volume_bdm_dict_without_conn_info = block_device .BlockDeviceDict (
124
+ {'id' : 3 , 'instance_uuid' : uuids .instance ,
125
+ 'device_name' : '/dev/sda1' ,
126
+ 'source_type' : 'volume' ,
127
+ 'disk_bus' : 'scsi' ,
128
+ 'device_type' : 'disk' ,
129
+ 'volume_size' : 8 ,
130
+ 'destination_type' : 'volume' ,
131
+ 'volume_id' : 'fake-volume-id-1' ,
132
+ 'guest_format' : 'ext4' ,
133
+ 'connection_info' : None ,
134
+ 'delete_on_termination' : False ,
135
+ 'boot_index' : 0 })
136
+
137
+ volume_driver_bdm_without_conn_info = {
138
+ 'attachment_id' : None ,
139
+ 'mount_device' : '/dev/sda1' ,
140
+ 'connection_info' : {},
141
+ 'delete_on_termination' : False ,
142
+ 'disk_bus' : 'scsi' ,
143
+ 'device_type' : 'disk' ,
144
+ 'guest_format' : 'ext4' ,
145
+ 'boot_index' : 0 ,
146
+ 'volume_type' : None }
147
+
123
148
volsnapshot_bdm_dict = block_device .BlockDeviceDict (
124
149
{'id' : 4 , 'instance_uuid' : uuids .instance ,
125
150
'device_name' : '/dev/sda2' ,
@@ -222,6 +247,8 @@ def setUp(self):
222
247
self .context , self .ephemeral_bdm_dict )
223
248
self .volume_bdm = fake_block_device .fake_bdm_object (
224
249
self .context , self .volume_bdm_dict )
250
+ self .volume_bdm_without_conn_info = fake_block_device .fake_bdm_object (
251
+ self .context , self .volume_bdm_dict_without_conn_info )
225
252
self .volsnapshot_bdm = fake_block_device .fake_bdm_object (
226
253
self .context , self .volsnapshot_bdm_dict )
227
254
self .volimage_bdm = fake_block_device .fake_bdm_object (
@@ -1202,6 +1229,11 @@ def test_convert_volume(self):
1202
1229
driver_block_device .convert_volume (
1203
1230
self .volsnapshot_bdm ))
1204
1231
1232
+ def test_convert_volume_without_connection_info (self ):
1233
+ self .assertEqual (self .volume_driver_bdm_without_conn_info ,
1234
+ driver_block_device .convert_volume (
1235
+ self .volume_bdm_without_conn_info ))
1236
+
1205
1237
def test_legacy_block_devices (self ):
1206
1238
test_snapshot = self .driver_classes ['volsnapshot' ](
1207
1239
self .volsnapshot_bdm )
0 commit comments