Repository: softlayer/softlayer-python
Pull request #1866 (2023-03-02 22:44:45)

Updated command `slcli image detail`
Issue: #1860
```
softlayer-python/ (issue1860) $ slcli image detail 5706
┌────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│               name │ value                                                                                                                                              │
├────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                 id │ 5706                                                                                                                                            │
│  global_identifier │ d6447b06-bae6-4a40                                                                                                               │
│               name │ Backup template for disk migration of 'testttbootmode.softlayer.ibm.com'.                                                                          │
│             status │ Active                                                                                                                                             │
│ active_transaction │                                                                                                                                                    │
│            account │ 30                                                                                                                                             │
│            created │ 2020-08-07T12:12:14-07:00                                                                                                                          │
│         total_size │ 5.46G                                                                                                                                              │
│         visibility │ Private                                                                                                                                            │
│               type │ System                                                                                                                                             │
│               flex │ False                                                                                                                                              │
│               note │ Note │
│        datacenters │ ┌───────┬───────┬─────────────┐                                                                                                                    │
│                    │ │  DC   │ size  │ transaction │                                                                                                                    │
│                    │ ├───────┼───────┼─────────────┤                                                                                                                    │
│                    │ │ par01 │ 5.46G │      -      │                                                                                                                    │
│                    │ └───────┴───────┴─────────────┘                                                                                                                    │
│      virtual disks │ ┌───────────────────────────────┬──────────┬──────────────┐                                                                                        │
│                    │ │            Device             │ capacity │ size on disk │                                                                                        │
│                    │ ├───────────────────────────────┼──────────┼──────────────┤                                                                                        │
│                    │ │ CentOS 7.0-64  │  25 GB   │    5.46G     │                                                                                        │
│                    │ │        106-SWAP         │   2 GB   │     N/A      │                                                                                        │
│                    │ └───────────────────────────────┴──────────┴──────────────┘                                                                                        │
│        share image │ ┌─────────┬───────────────────────────┐                                                                                                            │
│                    │ │ Account │         shared on         │                                                                                                            │
│                    │ ├─────────┼───────────────────────────┤                                                                                                            │
│                    │ │  468  │ 2023-03-01T09:14:38-06:00 │                                                                                                            │
│                    │ │ 305  │ 2023-03-01T07:23:32-06:00 │                                                                                                            │
│                    │ │ 123  │ 2023-03-01T11:27:17-06:00 │                                                                                                            │
│                    │ └─────────┴───────────────────────────┘                                                                                                            │
└────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
```


Patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f307200d..85f99f15 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,10 +1,25 @@
-name: Release to PyPi
+name: Release Snapcraft and PyPi
 
 on:
   release:
     types: [published]
 
 jobs:
+  snap-release:
+    runs-on: ubuntu-18.04
+    strategy:
+      matrix:
+        arch: ['armhf','amd64','arm64','ppc64el','s390x']
+    steps:
+      - name: Install Snapcraft
+        uses: samuelmeuli/action-snapcraft@v1.2.0
+        with:
+          snapcraft_token: ${{ secrets.snapcraft_token }}
+      - name: Push to stable
+        run: |
+          VERSION=`snapcraft list-revisions slcli --arch ${{ matrix.arch }} | grep "edge\*" | awk '{print $1}'`
+          echo Publishing $VERSION on ${{ matrix.arch }}
+          snapcraft release slcli $VERSION stable
   build-n-publish:
     name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
     runs-on: ubuntu-latest
diff --git a/SoftLayer/CLI/block/snapshot/cancel.py b/SoftLayer/CLI/block/snapshot/cancel.py
index 100aac61..1b867b5b 100644
--- a/SoftLayer/CLI/block/snapshot/cancel.py
+++ b/SoftLayer/CLI/block/snapshot/cancel.py
@@ -11,11 +11,11 @@
 
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume-id')
-@click.option('--reason', help="An optional reason for cancellation.")
+@click.option('--reason', help="An optional reason for cancellation")
 @click.option('--immediate',
               is_flag=True,
               help="Cancels the snapshot space immediately instead "
-                   "of on the billing anniversary.")
+                   "of on the billing anniversary")
 @environment.pass_env
 def cli(env, volume_id, reason, immediate):
     """Cancel existing snapshot space for a given volume."""
diff --git a/SoftLayer/CLI/block/snapshot/create.py b/SoftLayer/CLI/block/snapshot/create.py
index 92dbe405..b6b46ae9 100644
--- a/SoftLayer/CLI/block/snapshot/create.py
+++ b/SoftLayer/CLI/block/snapshot/create.py
@@ -9,10 +9,10 @@
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume_id')
 @click.option('--notes', '-n',
-              help='Notes to set on the new snapshot.')
+              help='Notes to set on the new snapshot')
 @environment.pass_env
 def cli(env, volume_id, notes):
-    """Creates a snapshot on a given volume."""
+    """Creates a snapshot on a given volume"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     snapshot = block_manager.create_snapshot(volume_id, notes=notes)
 
diff --git a/SoftLayer/CLI/block/snapshot/delete.py b/SoftLayer/CLI/block/snapshot/delete.py
index 4c08c59a..44c9e546 100644
--- a/SoftLayer/CLI/block/snapshot/delete.py
+++ b/SoftLayer/CLI/block/snapshot/delete.py
@@ -10,7 +10,7 @@
 @click.argument('snapshot_id')
 @environment.pass_env
 def cli(env, snapshot_id):
-    """Deletes a snapshot on a given volume."""
+    """Deletes a snapshot on a given volume"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     deleted = block_manager.delete_snapshot(snapshot_id)
 
diff --git a/SoftLayer/CLI/block/snapshot/disable.py b/SoftLayer/CLI/block/snapshot/disable.py
index 254b5bd1..58c17c09 100644
--- a/SoftLayer/CLI/block/snapshot/disable.py
+++ b/SoftLayer/CLI/block/snapshot/disable.py
@@ -10,11 +10,11 @@
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume_id')
 @click.option('--schedule-type',
-              help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
+              help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
               required=True)
 @environment.pass_env
 def cli(env, volume_id, schedule_type):
-    """Disables snapshots on the specified schedule for a given volume."""
+    """Disables snapshots on the specified schedule for a given volume"""
 
     if (schedule_type not in ['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']):
         raise exceptions.CLIAbort(
diff --git a/SoftLayer/CLI/block/snapshot/enable.py b/SoftLayer/CLI/block/snapshot/enable.py
index 2fda6f8d..b357793f 100644
--- a/SoftLayer/CLI/block/snapshot/enable.py
+++ b/SoftLayer/CLI/block/snapshot/enable.py
@@ -10,24 +10,24 @@
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume_id')
 @click.option('--schedule-type',
-              help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
+              help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
               required=True)
 @click.option('--retention-count',
-              help='Number of snapshots to retain.',
+              help='Number of snapshots to retain',
               required=True)
 @click.option('--minute',
-              help='Minute of the day when snapshots should be taken.',
+              help='Minute of the day when snapshots should be taken',
               default=0)
 @click.option('--hour',
-              help='Hour of the day when snapshots should be taken.',
+              help='Hour of the day when snapshots should be taken',
               default=0)
 @click.option('--day-of-week',
-              help='Day of the week when snapshots should be taken.',
+              help='Day of the week when snapshots should be taken',
               default='SUNDAY')
 @environment.pass_env
 def cli(env, volume_id, schedule_type, retention_count,
         minute, hour, day_of_week):
-    """Enables snapshots for a given volume on the specified schedule."""
+    """Enables snapshots for a given volume on the specified schedule"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
 
     valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}
diff --git a/SoftLayer/CLI/block/snapshot/get_notify_status.py b/SoftLayer/CLI/block/snapshot/get_notify_status.py
index e45e73b8..29659a7d 100644
--- a/SoftLayer/CLI/block/snapshot/get_notify_status.py
+++ b/SoftLayer/CLI/block/snapshot/get_notify_status.py
@@ -10,7 +10,7 @@
 @click.argument('volume_id')
 @environment.pass_env
 def cli(env, volume_id):
-    """Get snapshots space usage threshold warning flag setting for a given volume."""
+    """Get snapshots space usage threshold warning flag setting for a given volume"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     enabled = block_manager.get_volume_snapshot_notification_status(volume_id)
 
diff --git a/SoftLayer/CLI/block/snapshot/list.py b/SoftLayer/CLI/block/snapshot/list.py
index 90d42a91..f3a65c18 100644
--- a/SoftLayer/CLI/block/snapshot/list.py
+++ b/SoftLayer/CLI/block/snapshot/list.py
@@ -28,7 +28,7 @@
 
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume_id')
-@click.option('--sortby', help='Column to sort by.',
+@click.option('--sortby', help='Column to sort by',
               default='created')
 @click.option('--columns',
               callback=column_helper.get_formatter(COLUMNS),
diff --git a/SoftLayer/CLI/block/snapshot/order.py b/SoftLayer/CLI/block/snapshot/order.py
index 4e2ce68a..4d6455d3 100644
--- a/SoftLayer/CLI/block/snapshot/order.py
+++ b/SoftLayer/CLI/block/snapshot/order.py
@@ -9,45 +9,34 @@
 
 @click.command(cls=SoftLayer.CLI.command.SLCommand, )
 @click.argument('volume_id')
-@click.option('--iops',
+@click.option('--capacity',
               type=int,
-              help='Performance Storage IOPs, between 100 and 6000 in multiples of 100.')
-@click.option('--size',
-              type=int,
-              help='Size of snapshot space to create in GB.',
+              help='Size of snapshot space to create in GB',
               required=True)
 @click.option('--tier',
               help='Endurance Storage Tier (IOPS per GB) of the block'
               ' volume for which space is ordered [optional, and only'
-              ' valid for endurance storage volumes].',
+              ' valid for endurance storage volumes]',
               type=click.Choice(['0.25', '2', '4', '10']))
 @click.option('--upgrade',
               type=bool,
-              help='Flag to indicate that the order is an upgrade.',
+              help='Flag to indicate that the order is an upgrade',
               default=False,
               is_flag=True)
 @environment.pass_env
-def cli(env, volume_id, size, tier, upgrade, iops):
+def cli(env, volume_id, capacity, tier, upgrade):
     """Order snapshot space for a block storage volume."""
     block_manager = SoftLayer.BlockStorageManager(env.client)
 
     if tier is not None:
         tier = float(tier)
 
-    if iops is not None:
-        if iops < 100 or iops > 6000:
-            raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not one "
-                                           "of between 100 and 6000.")
-        if iops % 100 != 0:
-            raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not a multiple of 100.")
-
     try:
         order = block_manager.order_snapshot_space(
             volume_id,
-            capacity=size,
+            capacity=capacity,
             tier=tier,
-            upgrade=upgrade,
-            iops=iops
+            upgrade=upgrade
         )
     except ValueError as ex:
         raise exceptions.ArgumentError(str(ex))
diff --git a/SoftLayer/CLI/block/snapshot/restore.py b/SoftLayer/CLI/block/snapshot/restore.py
index 6cfc5591..34f7aa2d 100644
--- a/SoftLayer/CLI/block/snapshot/restore.py
+++ b/SoftLayer/CLI/block/snapshot/restore.py
@@ -10,10 +10,10 @@
 @click.argument('volume_id')
 @click.option('--snapshot-id', '-s',
               help='The id of the snapshot which will be used'
-              ' to restore the block volume.')
+              ' to restore the block volume')
 @environment.pass_env
 def cli(env, volume_id, snapshot_id):
-    """Restore block volume using a given snapshot."""
+    """Restore block volume using a given snapshot"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
     success = block_manager.restore_from_snapshot(volume_id, snapshot_id)
 
diff --git a/SoftLayer/CLI/block/snapshot/schedule_list.py b/SoftLayer/CLI/block/snapshot/schedule_list.py
index a6c6ff2e..af74feba 100644
--- a/SoftLayer/CLI/block/snapshot/schedule_list.py
+++ b/SoftLayer/CLI/block/snapshot/schedule_list.py
@@ -11,7 +11,7 @@
 @click.argument('volume_id')
 @environment.pass_env
 def cli(env, volume_id):
-    """Lists snapshot schedules for a given volume."""
+    """Lists snapshot schedules for a given volume"""
 
     block_manager = SoftLayer.BlockStorageManager(env.client)
 
diff --git a/SoftLayer/CLI/block/snapshot/set_notify_status.py b/SoftLayer/CLI/block/snapshot/set_notify_status.py
index a9d051ee..fe4725bf 100644
--- a/SoftLayer/CLI/block/snapshot/set_notify_status.py
+++ b/SoftLayer/CLI/block/snapshot/set_notify_status.py
@@ -12,12 +12,12 @@
     '--enable/--disable',
     default=True,
     help="""
-    Enable/Disable snapshot notification. Use `slcli block snapshot-set-notification volumeId --enable` to enable.
+    Enable/Disable snapshot notification. Use `slcli block snapshot-set-notification volumeId --enable` to enable
     """,
     required=True)
 @environment.pass_env
 def cli(env, volume_id, enable):
-    """Enables/Disables snapshot space usage threshold warning for a given volume."""
+    """Enables/Disables snapshot space usage threshold warning for a given volume"""
     block_manager = SoftLayer.BlockStorageManager(env.client)
 
     status = block_manager.set_volume_snapshot_notification(volume_id, enable)
diff --git a/SoftLayer/CLI/email/detail.py b/SoftLayer/CLI/email/detail.py
index cef246ad..5e2353f9 100644
--- a/SoftLayer/CLI/email/detail.py
+++ b/SoftLayer/CLI/email/detail.py
@@ -4,8 +4,7 @@
 import click
 
 from SoftLayer.CLI.command import SLCommand as SLCommand
-# Commented this line until we fix EmailManager.GetStatistics() method in golang plugin
-# from SoftLayer.CLI.email.list import build_statistics_table
+from SoftLayer.CLI.email.list import build_statistics_table
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import formatting
 from SoftLayer.managers.email import EmailManager
@@ -34,9 +33,10 @@ def cli(env, identifier):
     table.add_row(['type_description', utils.lookup(result, 'type', 'description')])
     table.add_row(['type', utils.lookup(result, 'type', 'keyName')])
     table.add_row(['vendor', utils.lookup(result, 'vendor', 'keyName')])
-    # Commented these lines until we fix EmailManager.GetStatistics() method in golang plugin
-    # statistics = email_manager.get_statistics(identifier)
-    #
-    # for statistic in statistics:
-    #     table.add_row(['statistics', build_statistics_table(statistic)])
+
+    statistics = email_manager.get_statistics(identifier)
+
+    for statistic in statistics:
+        table.add_row(['statistics', build_statistics_table(statistic)])
+
     env.fout(table)
diff --git a/SoftLayer/CLI/email/list.py b/SoftLayer/CLI/email/list.py
index 981d3ae7..76525d71 100644
--- a/SoftLayer/CLI/email/list.py
+++ b/SoftLayer/CLI/email/list.py
@@ -32,28 +32,27 @@ def cli(env):
                                    utils.lookup(email, 'vendor', 'keyName')])
 
         overview_table = _build_overview_table(email_manager.get_account_overview(email.get('id')))
-        # Commented this line until we fix EmailManager.GetStatistics() method in golang plugin
-        # statistics = email_manager.get_statistics(email.get('id'))
+        statistics = email_manager.get_statistics(email.get('id'))
 
         table.add_row(['email_information', table_information])
         table.add_row(['email_overview', overview_table])
-        # Commented these lines until we fix EmailManager.GetStatistics() method in golang plugin
-        # for statistic in statistics:
-        #     table.add_row(['statistics', build_statistics_table(statistic)])
+        for statistic in statistics:
+            table.add_row(['statistics', build_statistics_table(statistic)])
 
     env.fout(table)
 
 
 def _build_overview_table(email_overview):
     table = formatting.Table(
-        ['package', 'reputation'])
+        ['credit_allowed', 'credits_remain', 'credits_overage', 'credits_used',
+         'package', 'reputation', 'requests'])
     table.align['name'] = 'r'
     table.align['value'] = 'l'
 
-    table.add_row([
-        utils.lookup(email_overview, 'profile', 'package'),
-        utils.lookup(email_overview, 'profile', 'reputation')
-    ])
+    table.add_row([email_overview.get('creditsAllowed'), email_overview.get('creditsRemain'),
+                   email_overview.get('creditsOverage'), email_overview.get('creditsUsed'),
+                   email_overview.get('package'), email_overview.get('reputation'),
+                   email_overview.get('requests')])
 
     return table
 
diff --git a/SoftLayer/CLI/image/__init__.py b/SoftLayer/CLI/image/__init__.py
index 17d83662..159b3b53 100644
--- a/SoftLayer/CLI/image/__init__.py
+++ b/SoftLayer/CLI/image/__init__.py
@@ -6,7 +6,8 @@
 MASK = ('id,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,'
         'imageType')
 DETAIL_MASK = MASK + (',firstChild,children[id,blockDevicesDiskSpaceTotal,datacenter,'
-                      'transaction[transactionGroup,transactionStatus]],'
-                      'note,createDate,status,transaction')
+                      'transaction[transactionGroup,transactionStatus],'
+                      'blockDevices[diskImage[capacity,name,units,softwareReferences[softwareDescription]],diskSpace]],'
+                      'note,createDate,status,transaction,accountReferences')
 PUBLIC_TYPE = formatting.FormattedItem('PUBLIC', 'Public')
 PRIVATE_TYPE = formatting.FormattedItem('PRIVATE', 'Private')
diff --git a/SoftLayer/CLI/image/detail.py b/SoftLayer/CLI/image/detail.py
index f83e4b40..5d3a90bc 100644
--- a/SoftLayer/CLI/image/detail.py
+++ b/SoftLayer/CLI/image/detail.py
@@ -28,33 +28,35 @@ def cli(env, identifier):
     table.align['name'] = 'r'
     table.align['value'] = 'l'
 
-    table.add_row(['id', image['id']])
-    table.add_row(['global_identifier',
+    table.add_row(['Id', image['id']])
+    table.add_row(['Global Identifier',
                    image.get('globalIdentifier', formatting.blank())])
-    table.add_row(['name', image['name'].strip()])
-    table.add_row(['status', formatting.FormattedItem(
+    table.add_row(['Name', image['name'].strip()])
+    table.add_row(['Status', formatting.FormattedItem(
         utils.lookup(image, 'status', 'keyname'),
         utils.lookup(image, 'status', 'name'),
     )])
 
     table.add_row([
-        'active_transaction',
+        'Active Transaction',
         formatting.listing(_get_transaction_groups(children_images), separator=','),
     ])
-    table.add_row(['account', image.get('accountId', formatting.blank())])
-    table.add_row(['visibility',
+    table.add_row(['Account', image.get('accountId', formatting.blank())])
+    table.add_row(['Created', image.get('createDate')])
+    table.add_row(['Total Size', formatting.b_to_gb(total_size)])
+    table.add_row(['Visibility',
                    image_mod.PUBLIC_TYPE if image['publicFlag']
                    else image_mod.PRIVATE_TYPE])
-    table.add_row(['type',
+    table.add_row(['Type',
                    formatting.FormattedItem(
                        utils.lookup(image, 'imageType', 'keyName'),
                        utils.lookup(image, 'imageType', 'name'),
                    )])
-    table.add_row(['flex', image.get('flexImageFlag')])
-    table.add_row(['note', image.get('note')])
-    table.add_row(['created', image.get('createDate')])
-    table.add_row(['total_size', formatting.b_to_gb(total_size)])
-    table.add_row(['datacenters', _get_datacenter_table(children_images)])
+    table.add_row(['Flex', image.get('flexImageFlag')])
+    table.add_row(['Note', image.get('note')])
+    table.add_row(['Datacenters', _get_datacenter_table(children_images)])
+    table.add_row(['Virtual Disks', _get_virtual_disks(children_images)])
+    table.add_row(['Share Image', _get_share_image(image)])
 
     env.fout(table)
 
@@ -64,7 +66,7 @@ def _get_datacenter_table(children_images):
 
       :param children_images: A list of images.
       """
-    table_datacenter = formatting.Table(['DC', 'size', 'transaction'])
+    table_datacenter = formatting.Table(['DC', 'Size', 'Transaction'])
     for child in children_images:
         table_datacenter.add_row([
             utils.lookup(child, 'datacenter', 'name'),
@@ -85,3 +87,51 @@ def _get_transaction_groups(children_images):
         transactions.add(utils.lookup(child, 'transaction', 'transactionGroup', 'name'))
 
     return transactions
+
+
+def _get_virtual_disks(children_images):
+    """Returns datacenters as a table.
+
+      :param children_images: A list of images.
+      """
+
+    table_virtual_disks = formatting.Table(['Device', 'Capacity', 'Size On Disk'])
+
+    if utils.lookup(children_images[0], 'blockDevices'):
+        for block_devices in children_images[0]['blockDevices']:
+            device_name = utils.lookup(block_devices, 'diskImage', 'name')
+            software_references = utils.lookup(block_devices, 'diskImage', 'softwareReferences')
+            if len(software_references) > 0:
+                device_name = utils.lookup(software_references[0], 'softwareDescription', 'longDescription')
+
+            size_on_disk = formatting.b_to_gb(block_devices.get('diskSpace', 0))
+            if block_devices.get('diskSpace', 0) == 0:
+                size_on_disk = 'N/A'
+
+            capacity = str(utils.lookup(block_devices, 'diskImage', 'capacity')) + \
+                ' ' + utils.lookup(block_devices, 'diskImage', 'units')
+
+            table_virtual_disks.add_row([
+                device_name,
+                capacity,
+                size_on_disk
+            ])
+
+    return table_virtual_disks
+
+
+def _get_share_image(image):
+    """Returns shares image as a table.
+
+      :param image: Detail information about image.
+      """
+    table_share_account = formatting.Table(['Account', 'Shared On'])
+    if utils.lookup(image, 'accountReferences'):
+        for account in image['accountReferences']:
+            if account['accountId'] != image['accountId']:
+                table_share_account.add_row([
+                    utils.lookup(account, 'accountId'),
+                    utils.lookup(account, 'createDate'),
+                ])
+
+    return table_share_account
diff --git a/SoftLayer/managers/storage.py b/SoftLayer/managers/storage.py
index 28135e60..190a642d 100644
--- a/SoftLayer/managers/storage.py
+++ b/SoftLayer/managers/storage.py
@@ -381,7 +381,7 @@ def create_snapshot(self, volume_id, notes='', **kwargs):
                                 **kwargs)
 
     def order_snapshot_space(self, volume_id, capacity, tier, upgrade,
-                             iops=None, **kwargs):
+                             **kwargs):
         """Orders snapshot space for the given block volume.
 
         :param integer volume_id: The id of the volume
@@ -395,11 +395,8 @@ def order_snapshot_space(self, volume_id, capacity, tier, upgrade,
                       'staasVersion,hasEncryptionAtRest'
         volume = self.get_volume_details(volume_id, mask=object_mask, **kwargs)
 
-        if iops is None:
-            iops = int(volume['provisionedIops'])
-
         order = storage_utils.prepare_snapshot_order_object(
-            self, volume, capacity, tier, upgrade, iops)
+            self, volume, capacity, tier, upgrade)
 
         return self.client.call('Product_Order', 'placeOrder', order)
 
diff --git a/SoftLayer/managers/storage_utils.py b/SoftLayer/managers/storage_utils.py
index 86870ba4..bd6dcd13 100644
--- a/SoftLayer/managers/storage_utils.py
+++ b/SoftLayer/managers/storage_utils.py
@@ -423,7 +423,7 @@ def find_snapshot_schedule_id(volume, snapshot_schedule_keyname):
                      "the given storage volume")
 
 
-def prepare_snapshot_order_object(manager, volume, capacity, tier, upgrade, iops):
+def prepare_snapshot_order_object(manager, volume, capacity, tier, upgrade):
     """Prepare the snapshot space order object for the placeOrder() method
 
     :param manager: The File or Block manager calling this function
@@ -466,7 +466,7 @@ def prepare_snapshot_order_object(manager, volume, capacity, tier, upgrade, iops
                 raise exceptions.SoftLayerError(
                     "Snapshot space cannot be ordered for this performance "
                     "volume since it does not support Encryption at Rest.")
-
+            iops = int(volume['provisionedIops'])
             prices = [find_saas_snapshot_space_price(
                 package, capacity, iops=iops)]
         else:


Test patch:
diff --git a/tests/CLI/modules/block_tests.py b/tests/CLI/modules/block_tests.py
index 3dfe42f7..332f5ca6 100644
--- a/tests/CLI/modules/block_tests.py
+++ b/tests/CLI/modules/block_tests.py
@@ -446,7 +446,7 @@ def test_snapshot_order_order_not_placed(self, order_mock):
         order_mock.return_value = {}
 
         result = self.run_command(['block', 'snapshot-order', '1234',
-                                   '--size=10', '--tier=0.25', '--iops=100'])
+                                   '--capacity=10', '--tier=0.25'])
 
         self.assert_no_fail(result)
         self.assertEqual(result.output,
@@ -458,7 +458,7 @@ def test_snapshot_order_performance_manager_error(self, order_mock):
         order_mock.side_effect = ValueError('failure!')
 
         result = self.run_command(['block', 'snapshot-order', '1234',
-                                   '--size=10', '--tier=0.25', '--iops=100'])
+                                   '--capacity=10', '--tier=0.25'])
 
         self.assertEqual(2, result.exit_code)
         self.assertEqual('Argument Error: failure!', result.exception.message)
@@ -475,7 +475,7 @@ def test_snapshot_order(self, order_mock):
         }
 
         result = self.run_command(['block', 'snapshot-order', '1234',
-                                   '--size=10', '--tier=0.25', '--iops=100'])
+                                   '--capacity=10', '--tier=0.25'])
 
         self.assert_no_fail(result)
         self.assertEqual(result.output,
diff --git a/tests/managers/storage_utils_tests.py b/tests/managers/storage_utils_tests.py
index 974c5dab..f7bc5005 100644
--- a/tests/managers/storage_utils_tests.py
+++ b/tests/managers/storage_utils_tests.py
@@ -2688,7 +2688,7 @@ def test_prep_snapshot_order_billing_item_cancelled(self):
         exception = self.assertRaises(
             exceptions.SoftLayerError,
             storage_utils.prepare_snapshot_order_object,
-            self.block, mock_volume, 10, None, False, 100
+            self.block, mock_volume, 10, None, False
         )
 
         self.assertEqual(
@@ -2703,7 +2703,7 @@ def test_prep_snapshot_order_invalid_billing_item_category_code(self):
         exception = self.assertRaises(
             exceptions.SoftLayerError,
             storage_utils.prepare_snapshot_order_object,
-            self.block, mock_volume, 10, None, False, 100
+            self.block, mock_volume, 10, None, False
         )
 
         self.assertEqual(
@@ -2730,7 +2730,7 @@ def test_prep_snapshot_order_saas_endurance_tier_is_not_none(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 10, 2, False, 100
+            self.block, mock_volume, 10, 2, False
         )
 
         self.assertEqual(expected_object, result)
@@ -2753,7 +2753,7 @@ def test_prep_snapshot_order_saas_endurance_upgrade(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 20, None, True, 100
+            self.block, mock_volume, 20, None, True
         )
 
         self.assertEqual(expected_object, result)
@@ -2769,7 +2769,7 @@ def test_prep_snapshot_order_saas_performance_volume_below_staas_v2(self):
         exception = self.assertRaises(
             exceptions.SoftLayerError,
             storage_utils.prepare_snapshot_order_object,
-            self.block, mock_volume, 10, None, False, 100
+            self.block, mock_volume, 10, None, False
         )
 
         self.assertEqual(
@@ -2797,7 +2797,7 @@ def test_prep_snapshot_order_saas_performance(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 10, None, False, 100
+            self.block, mock_volume, 10, None, False
         )
 
         self.assertEqual(expected_object, result)
@@ -2812,7 +2812,7 @@ def test_prep_snapshot_order_saas_invalid_storage_type(self):
         exception = self.assertRaises(
             exceptions.SoftLayerError,
             storage_utils.prepare_snapshot_order_object,
-            self.block, mock_volume, 10, None, False, 100
+            self.block, mock_volume, 10, None, False
         )
 
         self.assertEqual(
@@ -2842,7 +2842,7 @@ def test_prep_snapshot_order_enterprise_tier_is_not_none(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 10, 2, False, 100
+            self.block, mock_volume, 10, 2, False
         )
 
         self.assertEqual(expected_object, result)
@@ -2867,7 +2867,7 @@ def test_prep_snapshot_order_enterprise(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 20, None, False, 100
+            self.block, mock_volume, 20, None, False
         )
 
         self.assertEqual(expected_object, result)
@@ -2891,7 +2891,7 @@ def test_prep_snapshot_order_hourly_billing(self):
         }
 
         result = storage_utils.prepare_snapshot_order_object(
-            self.block, mock_volume, 20, None, False, 100
+            self.block, mock_volume, 20, None, False
         )
 
         self.assertEqual(expected_object, result)