@@ -329,14 +329,11 @@ class HardwareCreateOptions(CLIRunnable):
329329 --disk Show disk options
330330 --os Show operating system options
331331 --memory Show memory size options
332- --gpus Show GPU options (if any)
333- --bandwidth Show bandwidth options
334332 --controller Show disk controller options
335333"""
336334
337335 action = 'create-options'
338- options = ['datacenter' , 'cpu' , 'memory' , 'os' , 'disk' , 'nic' , 'bandwidth' ,
339- 'gpus' , 'ps' , 'controller' ]
336+ options = ['datacenter' , 'cpu' , 'memory' , 'os' , 'disk' , 'nic' , 'controller' ]
340337
341338 @classmethod
342339 def execute (cls , client , args ):
@@ -401,20 +398,6 @@ def execute(cls, client, args):
401398 item [0 ] for item in sorted (result [1 ],
402399 key = lambda x : x [0 ]))])
403400
404- gpu_categories = ds_options ['categories' ].get ('gpu0' )
405- if (args ['--gpus' ] or show_all ) and gpu_categories :
406- results = cls .get_create_options (ds_options , 'gpus' )
407-
408- for result in results :
409- t .add_row ([result [0 ], listing (item [0 ] for item in result [1 ])])
410-
411- if args ['--bandwidth' ] or show_all :
412- results = cls .get_create_options (ds_options , 'bandwidth' )[0 ]
413-
414- t .add_row ([results [0 ], listing (
415- item [0 ] for item in sorted (results [1 ],
416- key = lambda x : x [0 ]))])
417-
418401 if args ['--controller' ] or show_all :
419402 results = cls .get_create_options (ds_options , 'disk_controller' )[0 ]
420403
@@ -586,21 +569,6 @@ def _generate_windows_code(description):
586569 single .append ((int (item ['capacity' ]), item ['price_id' ]))
587570
588571 return [('single nic' , single ), ('dual nic' , dual )]
589- elif 'gpus' == section :
590- results = []
591-
592- for item in ds_options ['categories' ]['gpu0' ]['items' ]:
593- text = 'gpu: ' + item ['description' ]
594- results .append ((text , [(str (item ['id' ]), item ['price_id' ])]))
595-
596- return results
597- elif 'bandwidth' == section :
598- options = []
599- for item in ds_options ['categories' ]['bandwidth' ]['items' ]:
600- if item ['capacity' ]:
601- options .append ((int (item ['capacity' ]), item ['price_id' ]))
602-
603- return [('bandwidth' , options )]
604572 elif 'disk_controller' == section :
605573 options = []
606574 for item in ds_options ['categories' ]['disk_controller' ]['items' ]:
@@ -638,9 +606,6 @@ class CreateHardware(CLIRunnable):
638606 Note: Omitting this value defaults to the first
639607 available datacenter
640608 -n MBPS, --network=MBPS Network port speed in Mbps
641- -b MBPS, --bandwidth=MBPS Outbound bandwidth in Mbps
642- --gpu0=GPU First GPU option for chassis that support them.
643- --gpu1=GPU Second GPU option for chassis that support them.
644609 --controller=RAID The RAID configuration for the server.
645610 Defaults to None.
646611 --dry-run, --test Do not create the server, just get a quote
@@ -675,18 +640,15 @@ def execute(cls, client, args):
675640 order ['ram' ] = cls ._get_price_id_from_options (ds_options , 'memory' ,
676641 int (args ['--memory' ]))
677642 # Set the disk sizes
678- has_disks = False
679- disk_count = 0
643+ disk_prices = []
680644 for disk in args .get ('--disk' ):
681645 disk_price = cls ._get_price_id_from_options (ds_options , 'disk' ,
682646 disk )
683647
684648 if disk_price :
685- order ['disk' + str (disk_count )] = disk_price
686- disk_count += 1
687- has_disks = True
649+ disk_prices .append (disk_price )
688650
689- if not has_disks :
651+ if not disk_prices :
690652 disk_price = cls ._get_default_value (ds_options , 'disk0' )
691653
692654 # Set the disk controller price
@@ -701,16 +663,6 @@ def execute(cls, client, args):
701663
702664 order ['disk_controller' ] = dc_price
703665
704- if args .get ('--gpu0' ):
705- gpu0_price = cls ._get_price_id_from_options (ds_options , 'gpus' ,
706- args .get ('--gpu0' ))
707- order ['gpu0' ] = gpu0_price
708-
709- if args .get ('--gpu1' ):
710- gpu1_price = cls ._get_price_id_from_options (ds_options , 'gpus' ,
711- args .get ('--gpu1' ))
712- order ['gpu1' ] = gpu1_price
713-
714666 # Set the port speed
715667 port_speed = args .get ('--network' ) or 10
716668
@@ -722,54 +674,6 @@ def execute(cls, client, args):
722674 else :
723675 raise CLIAbort ('Invalid NIC speed specified.' )
724676
725- # Get the bandwidth limit and convert it to a price ID.
726- # Yes, these should be multiplied by 1000, not 1024.
727- if not args .get ('--bandwidth' ):
728- bw_price = cls ._get_default_value (ds_options , 'bandwidth' )
729- else :
730- try :
731- bandwidth = int (args .get ('--bandwidth' , 0 ))
732- if bandwidth < 1000 :
733- bandwidth = bandwidth * 1000
734- except ValueError :
735- unit = args ['--bandwidth' ][- 1 ]
736- bandwidth = int (args ['--bandwidth' ][0 :- 1 ])
737- if unit in ['G' , 'g' ]:
738- bandwidth = bandwidth * 1000
739-
740- bw_price = cls ._get_price_id_from_options (ds_options , 'bandwidth' ,
741- bandwidth )
742-
743- if bw_price :
744- order ['bandwidth' ] = bw_price
745- else :
746- raise CLIAbort ('Invalid bandwidth cap specified.' )
747-
748- # Now add in the other required values that the user did not specify.
749- # TODO - Does this need to be generic? What if stuff costs money?
750- order ['pri_ip_addresses' ] = cls ._get_default_value (ds_options ,
751- 'pri_ip_addresses' )
752-
753- order ['monitoring' ] = cls ._get_default_value (ds_options , 'monitoring' )
754- vuln_scanner = cls ._get_default_value (ds_options ,
755- 'vulnerability_scanner' )
756- order ['vulnerability_scanner' ] = vuln_scanner
757- order ['response' ] = cls ._get_default_value (ds_options , 'response' )
758- order ['vpn_management' ] = cls ._get_default_value (ds_options ,
759- 'vpn_management' )
760- remote_mgmt = cls ._get_default_value (ds_options , 'remote_management' )
761- order ['remote_management' ] = remote_mgmt
762- order ['notification' ] = cls ._get_default_value (ds_options ,
763- 'notification' )
764- order ['lockbox' ] = cls ._get_default_value (ds_options , 'lockbox' )
765-
766- # Add in additional required values for this chassis.
767- ps = ds_options ['categories' ].get ('power_supply' )
768-
769- if ps and ps ['is_required' ]:
770- order ['power_supply' ] = cls ._get_default_value (ds_options ,
771- 'power_supply' )
772-
773677 # Begin output
774678 t = Table (['Item' , 'cost' ])
775679 t .align ['Item' ] = 'r'
0 commit comments