@@ -234,9 +234,10 @@ def order_replicant_volume(self, volume_id, snapshot_schedule,
234234 :return: Returns a SoftLayer_Container_Product_Order_Receipt
235235 """
236236
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,' \
240241 'storageType[keyName],provisionedIops'
241242 block_volume = self .get_block_volume_details (volume_id ,
242243 mask = block_mask )
@@ -261,7 +262,8 @@ def order_replicant_volume(self, volume_id, snapshot_schedule,
261262 def order_duplicate_volume (self , origin_volume_id , origin_snapshot_id = None ,
262263 duplicate_size = None , duplicate_iops = None ,
263264 duplicate_tier_level = None ,
264- duplicate_snapshot_size = None ):
265+ duplicate_snapshot_size = None ,
266+ hourly_billing_flag = False ):
265267 """Places an order for a duplicate block volume.
266268
267269 :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,
270272 :param duplicate_iops: The IOPS per GB for the duplicate volume
271273 :param duplicate_tier_level: Tier level for the duplicate volume
272274 :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.
273277 :return: Returns a SoftLayer_Container_Product_Order_Receipt
274278 """
275279
276- block_mask = 'id,billingItem[location],snapshotCapacityGb,' \
280+ block_mask = 'id,billingItem[location,hourlyFlag ],snapshotCapacityGb,' \
277281 'storageType[keyName],capacityGb,originalVolumeSize,' \
278282 'provisionedIops,storageTierLevel,osType[keyName],' \
279283 'staasVersion,hasEncryptionAtRest'
@@ -288,7 +292,8 @@ def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None,
288292
289293 order = storage_utils .prepare_duplicate_order_object (
290294 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
292297 )
293298
294299 order ['osFormatType' ] = {'keyName' : os_type }
@@ -308,7 +313,8 @@ def delete_snapshot(self, snapshot_id):
308313
309314 def order_block_volume (self , storage_type , location , size , os_type ,
310315 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 ):
312318 """Places an order for a block volume.
313319
314320 :param storage_type: 'performance' or 'endurance'
@@ -321,10 +327,12 @@ def order_block_volume(self, storage_type, location, size, os_type,
321327 if snapshot space should also be ordered (None if not ordered)
322328 :param service_offering: Requested offering package to use in the order
323329 ('storage_as_a_service', 'enterprise', or 'performance')
330+ :param hourly_billing_flag: Billing type, monthly (False)
331+ or hourly (True), default to monthly.
324332 """
325333 order = storage_utils .prepare_volume_order_object (
326334 self , storage_type , location , size , iops , tier_level ,
327- snapshot_size , service_offering , 'block'
335+ snapshot_size , service_offering , 'block' , hourly_billing_flag
328336 )
329337
330338 order ['osFormatType' ] = {'keyName' : os_type }
@@ -352,8 +360,9 @@ def order_snapshot_space(self, volume_id, capacity, tier,
352360 :param boolean upgrade: Flag to indicate if this order is an upgrade
353361 :return: Returns a SoftLayer_Container_Product_Order_Receipt
354362 """
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'
357366 block_volume = self .get_block_volume_details (volume_id ,
358367 mask = block_mask ,
359368 ** kwargs )
@@ -376,7 +385,7 @@ def cancel_snapshot_space(self, volume_id,
376385
377386 block_volume = self .get_block_volume_details (
378387 volume_id ,
379- mask = 'mask[id,billingItem[activeChildren]]' )
388+ mask = 'mask[id,billingItem[activeChildren,hourlyFlag ]]' )
380389
381390 if 'activeChildren' not in block_volume ['billingItem' ]:
382391 raise exceptions .SoftLayerError (
@@ -394,6 +403,9 @@ def cancel_snapshot_space(self, volume_id,
394403 raise exceptions .SoftLayerError (
395404 'No snapshot space found to cancel' )
396405
406+ if utils .lookup (block_volume , 'billingItem' , 'hourlyFlag' ):
407+ immediate = True
408+
397409 return self .client ['Billing_Item' ].cancelItem (
398410 immediate ,
399411 True ,
@@ -456,9 +468,12 @@ def cancel_block_volume(self, volume_id,
456468 """
457469 block_volume = self .get_block_volume_details (
458470 volume_id ,
459- mask = 'mask[id,billingItem[id]]' )
471+ mask = 'mask[id,billingItem[id,hourlyFlag ]]' )
460472 billing_item_id = block_volume ['billingItem' ]['id' ]
461473
474+ if utils .lookup (block_volume , 'billingItem' , 'hourlyFlag' ):
475+ immediate = True
476+
462477 return self .client ['Billing_Item' ].cancelItem (
463478 immediate ,
464479 True ,
0 commit comments