Skip to content

Conversation

sghatty
Copy link
Contributor

@sghatty sghatty commented Nov 15, 2017

No description provided.

@dpickle2 dpickle2 self-requested a review November 15, 2017 16:49
'500, 1000, 2000, 4000, 8000, 12000] '
'Minimum: [the size of the origin volume] '
'Maximum: [the minimum of 12000 GB or '
'10*(origin volume size)]')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 10x limit will only apply to volumes created before volume modification is released, so this comment may need to be adjusted to mention that. On the other hand, we don't want the help output to grow too large, so I wonder if it would be better to leave out the max here and rely on an error message if the size is too large.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the 10x size limit I would recommend removing it from the help message and relying on a well worded exception. Does the SLAPI give a good exception there or do we need to make our own?

'500, 1000, 2000, 4000, 8000, 12000] '
'Minimum: [the size of the origin volume] '
'Maximum: [the minimum of 12000 GB or '
'10*(origin volume size)]')
Copy link

@dpickle2 dpickle2 Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "10x limit" part isn't applicable for File volumes.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 84.774% when pulling 8e84d8c on sghatty:feature/FBLOCK-58 into dc97e7e on softlayer:master.

@allmightyspiff
Copy link
Member

the CI build is still complaining about the following.

SoftLayer/managers/storage_utils.py:1083:9: E265 block comment should start with '# '
SoftLayer/managers/storage_utils.py:1183:1: E302 expected 2 blank lines, found 1

Also, please try to improve the test coverage as well.

Thanks.

@sghatty
Copy link
Contributor Author

sghatty commented Nov 18, 2017 via email

help='Endurance Storage Tier (IOPS per GB) [only used for '
'endurance volumes] ***If no tier is specified, the original tier '
'of the volume will be used.***\n'
'Requirements: [IOPS/GB for the volume is 0.25, '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor, but for consistency, I think it would be helpful to insert "If original" before "IOPS/GB" here.

('block:volume-count', 'SoftLayer.CLI.block.count:cli'),
('block:volume-detail', 'SoftLayer.CLI.block.detail:cli'),
('block:volume-duplicate', 'SoftLayer.CLI.block.duplicate:cli'),
('block:volume-modify', 'SoftLayer.CLI.block.modify:cli'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor, but it would be ideal if this line was moved just below the line for 'volume-list', so that the commands remain in alphabetical order.

('file:volume-count', 'SoftLayer.CLI.file.count:cli'),
('file:volume-detail', 'SoftLayer.CLI.file.detail:cli'),
('file:volume-duplicate', 'SoftLayer.CLI.file.duplicate:cli'),
('file:volume-modify', 'SoftLayer.CLI.file.modify:cli'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor, but it would be ideal if this line was moved just below the line for 'volume-list', so that the commands remain in alphabetical order.


file_mask = 'id,billingItem[location,hourlyFlag],snapshotCapacityGb,'\
'storageType[keyName],capacityGb,originalVolumeSize,'\
'provisionedIops,storageTierLevel,osType[keyName],'\

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

osType is not relevant for File volumes, so this is not needed.


def prepare_modify_order_object(manager, origin_volume, new_iops, new_tier,
new_size, volume_type):
"""Prepare the duplicate order to submit to SoftLayer_Product::placeOrder()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be something like "modification order" instead of "duplicate order".

'packageId': package['id'],
'prices': prices,
'volume': origin_volume,
#'useHourlyPricing' : 'true',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this line is needed anymore, since the hourly vs. monthly billing will be handled automatically by the API now.

Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only passing an ID should likely throw an error and print the help message

 ./slcli block volume-modify 26140889
SoftLayerAPIError(SoftLayer_Exception_Public): Price does not have an id.

Lets figure out a way to rewrite this error to indicate a proper size wasn't selected. IDEALLY the api would tell us that, but if thats not possible maybe something in the manager would be helpful.
Is there a good way to get a list of acceptable sizes from the API so that they don't have to be hard coded?

./slcli block volume-modify 34034881 -c 200
SoftLayerAPIError(SoftLayer_Exception_Public): Price does not have an id.

This should work.

./slcli block volume-modify 34034881 -c 250
SoftLayerAPIError(SoftLayer_Exception_Public): Price does not have an id.

This should also work.... am I doing something wrong?

./slcli block volume-modify 34034881 -c 250 -t 2
(this took a long time, maybe add a message before we place an api call)
SoftLayerAPIError(SoftLayer_Exception_Public): Price does not have an id.

Changes needed

  1. Please make sure the commands do work with the given list of arguments I tried.
  2. Please use a line width of 120. I know most of the codebase uses 80, but I'm trying to get that updated as we add new code
  3. the _validate functions you added seem to be duplicate of code that already exists, which I don't really like in the first place. So unless you have a good reason for adding new functions please remove them and use the ones that already exist.
  4. if 'ENDURANCE' in volume_storage_type: is a much better way of testing storage types than the 4 explicit key names. unless there is a good reason for testing the 4 explicitly.
  5. There is a LOT of copy/pasted code it seems coming from the order duplicate methods into this modify method. I'd really like to see these condensed as much as possible.

'500, 1000, 2000, 4000, 8000, 12000] '
'Minimum: [the size of the origin volume] '
'Maximum: [the minimum of 12000 GB or '
'10*(origin volume size)]')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the 10x size limit I would recommend removing it from the help message and relying on a well worded exception. Does the SLAPI give a good exception there or do we need to make our own?

Copy link

@dpickle2 dpickle2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the size/performance validation helper functions in storage_utils.py, sort of along the same lines with what Chris mentioned, I think we can mostly get rid of these. I'm about to make an update to the similar helper functions for volume duplication as well. For both, I think we can get rid of most of this validation logic and just rely on the API to return an error when sizes/performance values are invalid (the API is validating all of these things anyway). This will likely reduce the chance that we need to update things as often any time the something changes with the API.

@dpickle2
Copy link

dpickle2 commented Nov 21, 2017

@allmightyspiff regarding the commands you were trying to run above, were you pointing to a current production API endpoint? The API changes are still in development/QE, so you would need to use a custom endpoint for these commands to work properly.
Also, regarding item 3 in the changes you requested, I apologize that the helper functions that these were based on were not preferable as is. Had I known that several months ago when they were written, I would have been happy to modify them back then. If I reduce or eliminate these in the way I mentioned in my review comment above, will that likely bring them into an acceptable state, or is further action also desired? Please let me know, and feel free to send me a direct message through some other medium if that is easier. Thank you!

@coveralls
Copy link

coveralls commented Nov 21, 2017

Coverage Status

Coverage decreased (-0.8%) to 84.78% when pulling f38259a on sghatty:feature/FBLOCK-58 into dc97e7e on softlayer:master.

@allmightyspiff
Copy link
Member

@dpickle2 yeah removing those validation functions would solve a lot of my complaints about the pull request. Once that is done I'll test again against the the testing url.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 84.772% when pulling 3002c46 on sghatty:feature/FBLOCK-58 into dc97e7e on softlayer:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 84.505% when pulling 0acc6e2 on sghatty:feature/FBLOCK-58 into dc97e7e on softlayer:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.79% when pulling 5eaa9a2 on sghatty:feature/FBLOCK-58 into b060f91 on softlayer:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.79% when pulling 20f2644 on sghatty:feature/FBLOCK-58 into b060f91 on softlayer:master.

Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

for item in order['placedOrder']['items']:
click.echo(" > %s" % item['description'])
else:
click.echo("Order could not be placed! Please verify your options " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line width for this project is 120, feel free to use it so you don't have to split strings needlessly.

:return: Returns a SoftLayer_Container_Product_Order_Receipt
"""

block_mask = 'id,billingItem[location,hourlyFlag],snapshotCapacityGb,'\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer masks to be broken out a bit so they are more readable at a glance. Like in block/get_block_volume_details

:return: Returns a SoftLayer_Container_Product_Order_Receipt
"""

file_mask = 'id,billingItem[location,hourlyFlag],snapshotCapacityGb,'\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break out this object mask too

'packageId': package['id'],
'prices': prices,
'volume': origin_volume,
#'useHourlyPricing' : 'true',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

"IOPS/GB. %s IOPS/GB requested." % duplicate_tier)
return duplicate_tier

def _validate_new_size(origin_volume, new_volume_size,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the API not give a decent error if you give it a bad size? Same with the other 2 _validate fuctions.

I'd prefer this sort of validation be done by the API

"IOPS/GB. %s IOPS/GB requested." % duplicate_tier)
return duplicate_tier

def _validate_new_size(origin_volume, new_volume_size,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are these 3 functions different than the _validate_dupl functions?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.793% when pulling a10f5a8 on sghatty:feature/FBLOCK-58 into b060f91 on softlayer:master.

Some certain types of transactions which are currently returned in
a volume's activeTransactions contain transactionStatus sub-properties
of inconsistent types. There is a plan to fix the core issue in the
backend, but until that fix is added, the changes in this commit
should prevent the volume-detail commands from resulting in an
error if any invalid transactionStatus objects are returned.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.793% when pulling 74830b5 on sghatty:feature/FBLOCK-58 into b060f91 on softlayer:master.

@allmightyspiff allmightyspiff merged commit 363d6ad into softlayer:master Dec 7, 2017
@allmightyspiff
Copy link
Member

$ ./slcli block volume-modify 34034881 -c 250
Order #21207661 placed successfully!
 > Storage as a Service
 > 250 GBs
 > 2 IOPS per GB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants