@@ -234,9 +234,10 @@ def order_replicant_volume(self, volume_id, snapshot_schedule,
234
234
:return: Returns a SoftLayer_Container_Product_Order_Receipt
235
235
"""
236
236
237
- block_mask = 'billingItem[activeChildren],storageTierLevel,osType,' \
238
- 'staasVersion,hasEncryptionAtRest,snapshotCapacityGb,' \
239
- 'schedules,hourlySchedule,dailySchedule,weeklySchedule,' \
237
+ block_mask = 'billingItem[activeChildren,hourlyFlag],' \
238
+ 'storageTierLevel,osType,staasVersion,' \
239
+ 'hasEncryptionAtRest,snapshotCapacityGb,schedules,' \
240
+ 'hourlySchedule,dailySchedule,weeklySchedule,' \
240
241
'storageType[keyName],provisionedIops'
241
242
block_volume = self .get_block_volume_details (volume_id ,
242
243
mask = block_mask )
@@ -261,7 +262,8 @@ def order_replicant_volume(self, volume_id, snapshot_schedule,
261
262
def order_duplicate_volume (self , origin_volume_id , origin_snapshot_id = None ,
262
263
duplicate_size = None , duplicate_iops = None ,
263
264
duplicate_tier_level = None ,
264
- duplicate_snapshot_size = None ):
265
+ duplicate_snapshot_size = None ,
266
+ hourly_billing_flag = False ):
265
267
"""Places an order for a duplicate block volume.
266
268
267
269
:param origin_volume_id: The ID of the origin volume to be duplicated
@@ -270,10 +272,12 @@ def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None,
270
272
:param duplicate_iops: The IOPS per GB for the duplicate volume
271
273
:param duplicate_tier_level: Tier level for the duplicate volume
272
274
:param duplicate_snapshot_size: Snapshot space size for the duplicate
275
+ :param hourly_billing_flag: Billing type, monthly (False)
276
+ or hourly (True), default to monthly.
273
277
:return: Returns a SoftLayer_Container_Product_Order_Receipt
274
278
"""
275
279
276
- block_mask = 'id,billingItem[location],snapshotCapacityGb,' \
280
+ block_mask = 'id,billingItem[location,hourlyFlag ],snapshotCapacityGb,' \
277
281
'storageType[keyName],capacityGb,originalVolumeSize,' \
278
282
'provisionedIops,storageTierLevel,osType[keyName],' \
279
283
'staasVersion,hasEncryptionAtRest'
@@ -288,7 +292,8 @@ def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None,
288
292
289
293
order = storage_utils .prepare_duplicate_order_object (
290
294
self , origin_volume , duplicate_iops , duplicate_tier_level ,
291
- duplicate_size , duplicate_snapshot_size , 'block'
295
+ duplicate_size , duplicate_snapshot_size , 'block' ,
296
+ hourly_billing_flag
292
297
)
293
298
294
299
order ['osFormatType' ] = {'keyName' : os_type }
@@ -308,7 +313,8 @@ def delete_snapshot(self, snapshot_id):
308
313
309
314
def order_block_volume (self , storage_type , location , size , os_type ,
310
315
iops = None , tier_level = None , snapshot_size = None ,
311
- service_offering = 'storage_as_a_service' ):
316
+ service_offering = 'storage_as_a_service' ,
317
+ hourly_billing_flag = False ):
312
318
"""Places an order for a block volume.
313
319
314
320
:param storage_type: 'performance' or 'endurance'
@@ -321,10 +327,12 @@ def order_block_volume(self, storage_type, location, size, os_type,
321
327
if snapshot space should also be ordered (None if not ordered)
322
328
:param service_offering: Requested offering package to use in the order
323
329
('storage_as_a_service', 'enterprise', or 'performance')
330
+ :param hourly_billing_flag: Billing type, monthly (False)
331
+ or hourly (True), default to monthly.
324
332
"""
325
333
order = storage_utils .prepare_volume_order_object (
326
334
self , storage_type , location , size , iops , tier_level ,
327
- snapshot_size , service_offering , 'block'
335
+ snapshot_size , service_offering , 'block' , hourly_billing_flag
328
336
)
329
337
330
338
order ['osFormatType' ] = {'keyName' : os_type }
@@ -352,8 +360,9 @@ def order_snapshot_space(self, volume_id, capacity, tier,
352
360
:param boolean upgrade: Flag to indicate if this order is an upgrade
353
361
:return: Returns a SoftLayer_Container_Product_Order_Receipt
354
362
"""
355
- block_mask = 'id,billingItem[location],storageType[keyName],' \
356
- 'storageTierLevel,provisionedIops,staasVersion,hasEncryptionAtRest'
363
+ block_mask = 'id,billingItem[location,hourlyFlag],' \
364
+ 'storageType[keyName],storageTierLevel,provisionedIops,' \
365
+ 'staasVersion,hasEncryptionAtRest'
357
366
block_volume = self .get_block_volume_details (volume_id ,
358
367
mask = block_mask ,
359
368
** kwargs )
@@ -376,7 +385,7 @@ def cancel_snapshot_space(self, volume_id,
376
385
377
386
block_volume = self .get_block_volume_details (
378
387
volume_id ,
379
- mask = 'mask[id,billingItem[activeChildren]]' )
388
+ mask = 'mask[id,billingItem[activeChildren,hourlyFlag ]]' )
380
389
381
390
if 'activeChildren' not in block_volume ['billingItem' ]:
382
391
raise exceptions .SoftLayerError (
@@ -394,6 +403,9 @@ def cancel_snapshot_space(self, volume_id,
394
403
raise exceptions .SoftLayerError (
395
404
'No snapshot space found to cancel' )
396
405
406
+ if utils .lookup (block_volume , 'billingItem' , 'hourlyFlag' ):
407
+ immediate = True
408
+
397
409
return self .client ['Billing_Item' ].cancelItem (
398
410
immediate ,
399
411
True ,
@@ -456,9 +468,12 @@ def cancel_block_volume(self, volume_id,
456
468
"""
457
469
block_volume = self .get_block_volume_details (
458
470
volume_id ,
459
- mask = 'mask[id,billingItem[id]]' )
471
+ mask = 'mask[id,billingItem[id,hourlyFlag ]]' )
460
472
billing_item_id = block_volume ['billingItem' ]['id' ]
461
473
474
+ if utils .lookup (block_volume , 'billingItem' , 'hourlyFlag' ):
475
+ immediate = True
476
+
462
477
return self .client ['Billing_Item' ].cancelItem (
463
478
immediate ,
464
479
True ,
0 commit comments