-
Notifications
You must be signed in to change notification settings - Fork 194
Iscsi manager #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iscsi manager #302
Conversation
options = ['confirm'] | ||
|
||
def execute(self, args): | ||
iscsi = ISCSIManager(self.client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of iscsi
iscsi_mgr
would be more appropriate here.
Strange. Build seems to be failing because of files which are not part of this change set. |
@amol: the problem seems to be due to pep8 version change |
@amol, @swapnil90: I merged in a fix for the new pep8 errors so a rebase should fix the CI. |
New iSCSI manager has been introduced to conveniently work with iSCSI service provided by SofyLayer. Respective CLI module has also been introduced for CLI interaction.
@sudorandom : Rebased the repo with master. Can you force the build to run again? |
@aparnapatil I'm not really able to... I have no idea why travis-ci isn't running. This passes everything when I run tox locally. It looks to work nicely. I have a couple UI-related notes that I'll make in-line |
list List iSCSI targets | ||
""" | ||
# :license: MIT, see LICENSE for more details. | ||
list List iSCSI targets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command listing should follow the style guide that we came up with: http://softlayer-python.readthedocs.org/en/latest/dev/cli.html#defining-a-module
E.G.: The second column should start 2 spaces after the longest command name. The list should be alphabetized. Capitalize the first letter of the description text.
For groupings of snapshot commands vs normal iscsi commands, you could use snapshot as a prefix for the command. Alternatively, you could divide up the command listing into a iSCSI target section and snapshot section similar to how the root help block (sl --help
) divides modules into categories.
corrected command listing style and divided iSCSI section and snapshot section.
@sudorandom: Considered all review comments. I have added short description about 'zero_recurring' param in create_iscsi() as well. |
@sudorandom, this is strange, and we haven't found any reason for this anywhere: >>> _filter
{'itemPrices': {'item': {'capacity': {'operation': 1},
'description': {'operation': '~ GB iSCSI SAN Storage'}}}}
>>> mask
'id,recurringFee'
>>> _1gb = client['Product_Package'].\
getItemPrices(id=0,
filter=_filter.to_dict(),
mask=mask)
>>> _1gb
[{'id': 2152, 'recurringFee': '.35'},
{'id': 22501, 'recurringFee': '0'},
{'id': 22441, 'recurringFee': '15'}]
>>>
def can_order(item, client):
order = {'complexType': 'SoftLayer_Container_Product_Order_Network_Storage_Iscsi',
'location': 138124,
'packageId': 0,
'prices': [{}],
'quantity': 1}
order['prices'][0]['id'] = item['id']
try:
client['Product_Order'].verifyOrder(order)
print 'ordering %s succeeded' % item
except SoftLayerAPIError as e:
print 'ordering %s failed' % item
print e.message
>>> for item in _1gb:
can_order(item, client)
print ''
>>>
ordering {'recurringFee': '.35', 'id': 2152} failed
The following price(s) are not valid for package (0):
2152: 1 GB iSCSI SAN Storage
ordering {'recurringFee': '0', 'id': 22501} failed
The following price(s) are not valid for package (0):
22501: 1 GB iSCSI SAN Storage
ordering {'recurringFee': '15', 'id': 22441} succeeded The error given by the exception seems to be strange. The service seems to contradicting itself, as the item prices we are providing while ordering is given by the service itself. Not sure what might be the reason behind this. If anyone can order those with |
@amol @aparnapatil: Okay, I was able to get this figured out. Here's the call I'm now using to get appropriate price ids: client['Product_Package'].getItems(id=0, mask='id, capacity, prices', filter={
'items': {
'capacity': {'operation': '1'},
'categories': {'categoryCode': {'operation': 'iscsi'}}}}) The structure is different (it returns items instead of price ids) but it does the proper filtering so that unusable price ids don't come back. http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItems |
@sudorandom: Thanks for figuring out this. Removed zero-recurring param and unnecessary filters. |
Fixure Product_Package has too many things which are not required by the iscsi tests. Using return_value from `mock` to test iscsi manager.
Do we need any modifications to this? |
@aparnapatil I apologize, I didn't notice that you'd pushed the changes that you did 2 days ago. I gave it a once over and it looks good to me to merge. |
Handling issue #282 . Provided ISCSI CLI support and Added testcases for the same
Operations supported are as follows:
CLI modules are divided into iSCSI targets section and snapshots section.
iSCSI commands
Snapshot Commands