Skip to content

Commit f0840e3

Browse files
committed
Fix the way storage space is looked up for block and file storage ordering. Remove the OS type requirement from file storage ordering as it is not used.
1 parent 6dd6159 commit f0840e3

5 files changed

Lines changed: 29 additions & 34 deletions

File tree

SoftLayer/CLI/file/order.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@
2828
help='Endurance Storage Tier (IOP per GB)'
2929
' [required for storage-type endurance]',
3030
type=click.Choice(['0.25', '2', '4', '10']))
31-
@click.option('--os-type',
32-
help='Operating System',
33-
type=click.Choice([
34-
'HYPER_V',
35-
'LINUX',
36-
'VMWARE',
37-
'WINDOWS_2008',
38-
'WINDOWS_GPT',
39-
'WINDOWS',
40-
'XEN']),
41-
required=True)
4231
@click.option('--location',
4332
help='Datacenter short name (e.g.: dal09)',
4433
required=True)
@@ -48,7 +37,7 @@
4837
'space along with endurance file storage; specifies '
4938
'the size (in GB) of snapshot space to order')
5039
@environment.pass_env
51-
def cli(env, storage_type, size, iops, tier, os_type,
40+
def cli(env, storage_type, size, iops, tier,
5241
location, snapshot_size):
5342
"""Order a file storage volume."""
5443
file_manager = SoftLayer.FileStorageManager(env.client)
@@ -79,8 +68,7 @@ def cli(env, storage_type, size, iops, tier, os_type,
7968
storage_type='performance_storage_nfs',
8069
location=location,
8170
size=size,
82-
iops=iops,
83-
os_type=os_type
71+
iops=iops
8472
)
8573
except ValueError as ex:
8674
raise exceptions.ArgumentError(str(ex))
@@ -98,7 +86,6 @@ def cli(env, storage_type, size, iops, tier, os_type,
9886
location=location,
9987
size=size,
10088
tier_level=float(tier),
101-
os_type=os_type,
10289
snapshot_size=snapshot_size
10390
)
10491
except ValueError as ex:

SoftLayer/managers/block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def order_block_volume(self, storage_type, location, size, os_type,
271271
package,
272272
'performance_storage_iscsi'
273273
),
274-
storage_utils.find_performance_space_price(package, iops),
274+
storage_utils.find_performance_space_price(package, size),
275275
storage_utils.find_performance_iops_price(package, size, iops),
276276
]
277277
elif storage_type == 'storage_service_enterprise':

SoftLayer/managers/file.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ def delete_snapshot(self, snapshot_id):
228228
return self.client.call('Network_Storage', 'deleteObject',
229229
id=snapshot_id)
230230

231-
def order_file_volume(self, storage_type, location, size, os_type,
231+
def order_file_volume(self, storage_type, location, size, os_type=None,
232232
iops=None, tier_level=None, snapshot_size=None):
233233
"""Places an order for a file volume.
234234
235235
:param storage_type: "performance_storage_iscsi" (performance)
236236
or "storage_service_enterprise" (endurance)
237237
:param location: Datacenter in which to order iSCSI volume
238238
:param size: Size of the desired volume, in GB
239-
:param os_type: OS Type to use for volume alignment, see help for list
239+
:param os_type: Not used for file storage orders, leave None
240240
:param iops: Number of IOPs for a "Performance" order
241241
:param tier_level: Tier level to use for an "Endurance" order
242242
:param snapshot_size: The size of optional snapshot space,
@@ -259,7 +259,7 @@ def order_file_volume(self, storage_type, location, size, os_type,
259259
package,
260260
'performance_storage_nfs'
261261
),
262-
storage_utils.find_performance_space_price(package, iops),
262+
storage_utils.find_performance_space_price(package, size),
263263
storage_utils.find_performance_iops_price(package, size, iops),
264264
]
265265
elif storage_type == 'storage_service_enterprise':
@@ -288,7 +288,6 @@ def order_file_volume(self, storage_type, location, size, os_type,
288288
order = {
289289
'complexType': complex_type,
290290
'packageId': package['id'],
291-
'osFormatType': {'keyName': os_type},
292291
'prices': prices,
293292
'quantity': 1,
294293
'location': location_id,
@@ -313,6 +312,15 @@ def enable_snapshots(self, volume_id, schedule_type, retention_count,
313312
314313
:param integer volume_id: The id of the volume
315314
:param string schedule_type: 'HOURLY'|'DAILY'|'WEEKLY'
315+
:param integer retention_count: The number of snapshots to attempt to
316+
retain in this schedule
317+
:param integer minute: The minute of the hour at which HOURLY, DAILY,
318+
and WEEKLY snapshots should be taken
319+
:param integer hour: The hour of the day at which DAILY and WEEKLY
320+
snapshots should be taken
321+
:param string|integer day_of_week: The day of the week on which WEEKLY
322+
snapshots should be taken, either as a string ('SUNDAY') or integer
323+
('0' is Sunday)
316324
:return: Returns whether successfully scheduled or not
317325
"""
318326

@@ -340,7 +348,7 @@ def order_snapshot_space(self, volume_id, capacity, tier,
340348
upgrade, **kwargs):
341349
"""Orders snapshot space for the given file volume.
342350
343-
:param integer volume_id: The id of the volume
351+
:param integer volume_id: The ID of the volume
344352
:param integer capacity: The capacity to order, in GB
345353
:param float tier: The tier level of the file volume, in IOPS per GB
346354
:param boolean upgrade: Flag to indicate if this order is an upgrade
@@ -390,7 +398,7 @@ def cancel_snapshot_space(self, volume_id,
390398
391399
:param integer volume_id: The volume ID
392400
:param string reason: The reason for cancellation
393-
:param boolean immediate_flag: Cancel immediately or
401+
:param boolean immediate: Cancel immediately or
394402
on anniversary date
395403
"""
396404

@@ -422,9 +430,9 @@ def cancel_snapshot_space(self, volume_id,
422430
def restore_from_snapshot(self, volume_id, snapshot_id):
423431
"""Restores a specific volume from a snapshot
424432
425-
:param integer volume_id: The id of the volume
433+
:param integer volume_id: The ID of the volume
426434
:param integer snapshot_id: The id of the restore point
427-
:return: Returns whether succesfully restored or not
435+
:return: Returns whether successfully restored or not
428436
"""
429437

430438
return self.client.call('Network_Storage', 'restoreFromSnapshot',
@@ -437,7 +445,7 @@ def cancel_file_volume(self, volume_id,
437445
438446
:param integer volume_id: The volume ID
439447
:param string reason: The reason for cancellation
440-
:param boolean immediate_flag: Cancel immediately or
448+
:param boolean immediate: Cancel immediately or
441449
on anniversary date
442450
"""
443451
file_volume = self.get_file_volume_details(
@@ -454,7 +462,7 @@ def cancel_file_volume(self, volume_id,
454462
def failover_to_replicant(self, volume_id, replicant_id, immediate=False):
455463
"""Failover to a volume replicant.
456464
457-
:param integer volume_id: The id of the volume
465+
:param integer volume_id: The ID of the volume
458466
:param integer replicant_id: ID of replicant to failover to
459467
:param boolean immediate: Flag indicating if failover is immediate
460468
:return: Returns whether failover was successful or not
@@ -466,8 +474,8 @@ def failover_to_replicant(self, volume_id, replicant_id, immediate=False):
466474
def failback_from_replicant(self, volume_id, replicant_id):
467475
"""Failback from a volume replicant.
468476
469-
:param integer volume_id: The id of the volume
470-
:param integer: ID of replicant to failback from
477+
:param integer volume_id: The ID of the volume
478+
:param integer replicant_id: ID of replicant to failback from
471479
:return: Returns whether failback was successful or not
472480
"""
473481

SoftLayer/managers/storage_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def populate_host_templates(host_templates,
6060

6161

6262
def get_package(manager, category_code):
63-
"""Returns a product packaged based on type of storage.
63+
"""Returns a product package based on type of storage.
6464
6565
:param manager: The storage manager which calls this function.
6666
:param category_code: Category code of product package.

tests/managers/file_tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_order_file_volume_no_package(self):
187187
"performance_storage_nfs",
188188
"dal05",
189189
40,
190-
"LINUX",
190+
None,
191191
iops=100,
192192
)
193193

@@ -201,7 +201,7 @@ def test_order_file_volume_too_many_packages(self):
201201
"performance_storage_nfs",
202202
"dal05",
203203
40,
204-
"LINUX",
204+
None,
205205
iops=100,
206206
)
207207

@@ -246,7 +246,7 @@ def test_order_file_volume_performance(self):
246246
"performance_storage_nfs",
247247
"dal05",
248248
100,
249-
"LINUX",
249+
None,
250250
iops=100,
251251
)
252252

@@ -330,7 +330,7 @@ def test_order_file_volume_endurance(self):
330330
"storage_service_enterprise",
331331
"dal05",
332332
100,
333-
"LINUX",
333+
None,
334334
tier_level=0.25,
335335
)
336336

@@ -417,7 +417,7 @@ def test_order_file_volume_endurance_with_snapshot(self):
417417
"storage_service_enterprise",
418418
"dal05",
419419
100,
420-
"LINUX",
420+
None,
421421
tier_level=0.25,
422422
snapshot_size=10,
423423
)

0 commit comments

Comments
 (0)