|
24 | 24 | default=None, |
25 | 25 | type=click.Choice(['Non-RAID', 'RAID'])) |
26 | 26 | @click.option('--public-bandwidth', type=click.INT, help="Public Bandwidth in GB") |
| 27 | +@click.option('--add-disk', nargs=2, multiple=True, type=(int, int), |
| 28 | + help="Add a Hard disk in GB to a specific channel, e.g 1000 GB in disk2, it will be " |
| 29 | + "--add-disk 1000 2") |
| 30 | +@click.option('--resize-disk', nargs=2, multiple=True, type=(int, int), |
| 31 | + help="Upgrade a specific disk size in GB, e.g --resize-disk 2000 2") |
27 | 32 | @click.option('--test', is_flag=True, default=False, help="Do not actually upgrade the hardware server") |
28 | 33 | @environment.pass_env |
29 | | -def cli(env, identifier, memory, network, drive_controller, public_bandwidth, test): |
| 34 | +def cli(env, identifier, memory, network, drive_controller, public_bandwidth, add_disk, resize_disk, test): |
30 | 35 | """Upgrade a Hardware Server.""" |
31 | 36 |
|
32 | 37 | mgr = SoftLayer.HardwareManager(env.client) |
33 | 38 |
|
34 | | - if not any([memory, network, drive_controller, public_bandwidth]): |
| 39 | + if not any([memory, network, drive_controller, public_bandwidth, add_disk, resize_disk]): |
35 | 40 | raise exceptions.ArgumentError("Must provide " |
36 | | - " [--memory], [--network], [--drive-controller], or [--public-bandwidth]") |
| 41 | + " [--memory], [--network], [--drive-controller], [--public-bandwidth]," |
| 42 | + "[--add-disk] or [--resize-disk]") |
37 | 43 |
|
38 | 44 | hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Hardware') |
39 | 45 | if not test: |
40 | 46 | if not (env.skip_confirmations or formatting.confirm( |
41 | 47 | "This action will incur charges on your account. Continue?")): |
42 | 48 | raise exceptions.CLIAbort('Aborted') |
43 | 49 |
|
| 50 | + disk_list = list() |
| 51 | + if add_disk: |
| 52 | + for guest_disk in add_disk: |
| 53 | + disks = {'description': 'add_disk', 'capacity': guest_disk[0], 'number': guest_disk[1]} |
| 54 | + disk_list.append(disks) |
| 55 | + if resize_disk: |
| 56 | + for guest_disk in resize_disk: |
| 57 | + disks = {'description': 'resize_disk', 'capacity': guest_disk[0], 'number': guest_disk[1]} |
| 58 | + disk_list.append(disks) |
| 59 | + |
44 | 60 | if not mgr.upgrade(hw_id, memory=memory, nic_speed=network, drive_controller=drive_controller, |
45 | | - public_bandwidth=public_bandwidth, test=test): |
| 61 | + public_bandwidth=public_bandwidth, disk=disk_list, test=test): |
46 | 62 | raise exceptions.CLIAbort('Hardware Server Upgrade Failed') |
47 | 63 | env.fout('Successfully Upgraded.') |
0 commit comments