Skip to content

Commit c6bb04d

Browse files
committed
Merge branch 'master' of github.com:softlayer/softlayer-python
2 parents 09dee3b + 4ec8756 commit c6bb04d

17 files changed

Lines changed: 437 additions & 113 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
# Change Log
22

3+
## [5.4.2] - 2018-02-22
4+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.1...master
5+
6+
- add GPU to the virtual create-options table
7+
- Remove 'virtual' from the hardware ready command.
8+
- Carefully check for the metric tracking id on virtual guests when building a bandwidth report.
9+
- Do not fail if the source or destination subnet mask does not exist for ipv6 rules.
10+
11+
## [5.4.1] - 2018-02-05
12+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.0...v5.4.1
13+
14+
- Improve error conditions when adding SSH keys
15+
- added type filters to package-list, auto-removes bluemix_services on package listing
16+
- Add boot mode option to virtual guest creation
17+
- Update documentation for security group rule add
18+
- Add fix for unsetting of values in edit SG rules
319

420
## [5.4.0] - 2018-01-15
5-
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.2...master
21+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.2...v5.4.0
622

723
- Upgraded Requests and Urllib3 library to latest. This allows the library to make use of connection retries, and connection pools. This should prevent the client from crashing if the API gives a connection reset / connection timeout error
824
- reworked wait_for_ready function for virtual, and added to hardware managers.

README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ Or you can install from source. Download source and run:
4949
5050
$ python setup.py install
5151
52+
Another (safer) method of installation is to use the published snap. Snaps are available for any Linux OS running snapd, the service that runs and manage snaps. Snaps are "auto-updating" packages and will not disrupt the current versions of libraries and software packages on your Linux-based system. To learn more, please visit: https://snapcraft.io/
53+
54+
To install the slcli snap:
55+
56+
.. code-block:: bash
57+
58+
$ sudo snap install slcli
59+
60+
5261
5362
The most up-to-date version of this library can be found on the SoftLayer
5463
GitHub public repositories at http://github.com/softlayer. For questions regarding the use of this library please post to Stack Overflow at https://stackoverflow.com/ and your posts with “SoftLayer” so our team can easily find your post. To report a bug with this library please create an Issue on github.

SoftLayer/CLI/firewall/detail.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from SoftLayer.CLI import environment
88
from SoftLayer.CLI import firewall
99
from SoftLayer.CLI import formatting
10+
from SoftLayer import utils
1011

1112

1213
@click.command()
@@ -41,9 +42,9 @@ def get_rules_table(rules):
4142
rule['action'],
4243
rule['protocol'],
4344
rule['sourceIpAddress'],
44-
rule['sourceIpSubnetMask'],
45+
utils.lookup(rule, 'sourceIpSubnetMask'),
4546
'%s:%s-%s' % (rule['destinationIpAddress'],
4647
rule['destinationPortRangeStart'],
4748
rule['destinationPortRangeEnd']),
48-
rule['destinationIpSubnetMask']])
49+
utils.lookup(rule, 'destinationIpSubnetMask')])
4950
return table

SoftLayer/CLI/hardware/ready.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Check if a virtual server is ready."""
1+
"""Check if a server is ready."""
22
# :license: MIT, see LICENSE for more details.
33

44
import click
@@ -11,15 +11,17 @@
1111

1212
@click.command()
1313
@click.argument('identifier')
14-
@click.option('--wait', default=0, show_default=True, type=click.INT, help="Seconds to wait")
14+
@click.option('--wait', default=0, show_default=True, type=click.INT,
15+
help="Seconds to wait")
1516
@environment.pass_env
1617
def cli(env, identifier, wait):
17-
"""Check if a virtual server is ready."""
18+
"""Check if a server is ready."""
1819

1920
compute = SoftLayer.HardwareManager(env.client)
20-
compute_id = helpers.resolve_id(compute.resolve_ids, identifier, 'hardware')
21+
compute_id = helpers.resolve_id(compute.resolve_ids, identifier,
22+
'hardware')
2123
ready = compute.wait_for_ready(compute_id, wait)
2224
if ready:
2325
env.fout("READY")
2426
else:
25-
raise exceptions.CLIAbort("Instance %s not ready" % compute_id)
27+
raise exceptions.CLIAbort("Server %s not ready" % compute_id)

SoftLayer/CLI/report/bandwidth.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ def _get_virtual_bandwidth(env, start, end):
143143
label='Calculating for virtual',
144144
file=sys.stderr) as vms:
145145
for instance in vms:
146+
metric_tracking_id = utils.lookup(instance,
147+
'metricTrackingObjectId')
148+
149+
if metric_tracking_id is None:
150+
continue
151+
146152
pool_name = None
147153
if utils.lookup(instance,
148154
'virtualRack',
@@ -161,7 +167,7 @@ def _get_virtual_bandwidth(env, start, end):
161167
end.strftime('%Y-%m-%d %H:%M:%S %Z'),
162168
types,
163169
3600,
164-
id=instance['metricTrackingObjectId'],
170+
id=metric_tracking_id,
165171
),
166172
}
167173

SoftLayer/CLI/virt/create.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def _parse_create_args(client, args):
8080
"disks": args['disk'],
8181
"cpus": args.get('cpu', None),
8282
"memory": args.get('memory', None),
83-
"flavor": args.get('flavor', None)
83+
"flavor": args.get('flavor', None),
84+
"boot_mode": args.get('boot_mode', None)
8485
}
8586

8687
# The primary disk is included in the flavor and the local_disk flag is not needed
@@ -175,6 +176,9 @@ def _parse_create_args(client, args):
175176
help="OS install code. Tip: you can specify <OS>_LATEST")
176177
@click.option('--image',
177178
help="Image ID. See: 'slcli image list' for reference")
179+
@click.option('--boot-mode',
180+
help="Specify the mode to boot the OS in. Supported modes are HVM and PV.",
181+
type=click.STRING)
178182
@click.option('--billing',
179183
type=click.Choice(['hourly', 'monthly']),
180184
default='hourly',

SoftLayer/CLI/virt/create_options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def _add_flavor_rows(flavor_key, flavor_label, flavor_options):
5151
_add_flavor_rows('BL2', 'balanced local - ssd', result['flavors'])
5252
_add_flavor_rows('C1', 'compute', result['flavors'])
5353
_add_flavor_rows('M1', 'memory', result['flavors'])
54+
_add_flavor_rows('AC', 'GPU', result['flavors'])
5455

5556
# CPUs
5657
standard_cpus = [int(x['template']['startCpus']) for x in result['processors']

SoftLayer/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
VERSION = 'v5.4.0'
8+
VERSION = 'v5.4.2'
99
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
1010
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
1111
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'

SoftLayer/fixtures/SoftLayer_Virtual_Guest.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,26 @@
121121
}
122122
}
123123
},
124+
{
125+
'flavor': {
126+
'keyName': 'AC1_1X2X100'
127+
},
128+
'template': {
129+
'supplementalCreateObjectOptions': {
130+
'flavorKeyName': 'AC1_1X2X100'
131+
}
132+
}
133+
},
134+
{
135+
'flavor': {
136+
'keyName': 'ACL1_1X2X100'
137+
},
138+
'template': {
139+
'supplementalCreateObjectOptions': {
140+
'flavorKeyName': 'ACL1_1X2X100'
141+
}
142+
}
143+
},
124144
],
125145
'processors': [
126146
{

SoftLayer/managers/vs.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def reload_instance(self, instance_id,
272272
:param string post_url: The URI of the post-install script to run
273273
after reload
274274
:param list ssh_keys: The SSH keys to add to the root user
275-
:param int image_id: The ID of the image to load onto the server
275+
:param int image_id: The GUID of the image to load onto the server
276276
277277
.. warning::
278278
This will reformat the primary drive.
@@ -307,7 +307,7 @@ def _generate_create_dict(
307307
dedicated=False, public_vlan=None, private_vlan=None,
308308
userdata=None, nic_speed=None, disks=None, post_uri=None,
309309
private=False, ssh_keys=None, public_security_groups=None,
310-
private_security_groups=None, **kwargs):
310+
private_security_groups=None, boot_mode=None, **kwargs):
311311
"""Returns a dict appropriate to pass into Virtual_Guest::createObject
312312
313313
See :func:`create_instance` for a list of available options.
@@ -339,11 +339,14 @@ def _generate_create_dict(
339339
"hostname": hostname,
340340
"domain": domain,
341341
"localDiskFlag": local_disk,
342-
"hourlyBillingFlag": hourly
342+
"hourlyBillingFlag": hourly,
343+
"supplementalCreateObjectOptions": {
344+
"bootMode": boot_mode
345+
}
343346
}
344347

345348
if flavor:
346-
data["supplementalCreateObjectOptions"] = {"flavorKeyName": flavor}
349+
data["supplementalCreateObjectOptions"]["flavorKeyName"] = flavor
347350

348351
if dedicated and not host_id:
349352
data["dedicatedAccountHostOnlyFlag"] = dedicated
@@ -534,7 +537,7 @@ def create_instance(self, **kwargs):
534537
:param bool local_disk: Flag to indicate if this should be a local disk (default) or a SAN disk.
535538
:param string datacenter: The short name of the data center in which the VS should reside.
536539
:param string os_code: The operating system to use. Cannot be specified if image_id is specified.
537-
:param int image_id: The ID of the image to load onto the server. Cannot be specified if os_code is specified.
540+
:param int image_id: The GUID of the image to load onto the server. Cannot be specified if os_code is specified.
538541
:param bool dedicated: Flag to indicate if this should be housed on adedicated or shared host (default).
539542
This will incur a fee on your account.
540543
:param int public_vlan: The ID of the public VLAN on which you want this VS placed.

0 commit comments

Comments
 (0)