@@ -306,7 +306,7 @@ def execute(client, args):
306306 t .align ['Chassis' ] = 'l'
307307
308308 mgr = HardwareManager (client )
309- chassis = mgr .get_available_dedicated_server_chassis ()
309+ chassis = mgr .get_available_dedicated_server_packages ()
310310
311311 for chassis in chassis :
312312 t .add_row ([chassis [0 ], chassis [1 ]])
@@ -329,13 +329,14 @@ 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)
332333 --bandwidth Show bandwidth options
333334 --controller Show disk controller options
334335"""
335336
336337 action = 'create-options'
337338 options = ['datacenter' , 'cpu' , 'memory' , 'os' , 'disk' , 'nic' , 'bandwidth' ,
338- 'controller' ]
339+ 'gpus' , 'ps' , ' controller' ]
339340
340341 @classmethod
341342 def execute (cls , client , args ):
@@ -400,6 +401,13 @@ def execute(cls, client, args):
400401 item [0 ] for item in sorted (result [1 ],
401402 key = lambda x : x [0 ]))])
402403
404+ if (args ['--gpus' ] or show_all ) \
405+ and ds_options ['categories' ].get ('gpu0' ):
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+
403411 if args ['--bandwidth' ] or show_all :
404412 results = cls .get_create_options (ds_options , 'bandwidth' )[0 ]
405413
@@ -436,7 +444,7 @@ def get_create_options(cls, ds_options, section, pretty=True):
436444 elif 'cpu' == section :
437445 results = []
438446 cpu_regex = re .compile ('\s(\w+)\s(\d+)\s+\-\s+([\d\.]+GHz)'
439- '\s+\(\w +\)\s+\-\s+(.+)$' )
447+ '\s+\([\w ] +\)\s+\-\s+(.+)$' )
440448
441449 for item in ds_options ['categories' ]['server' ]['items' ]:
442450 cpu = cpu_regex .search (item ['description' ])
@@ -562,10 +570,6 @@ def _generate_windows_code(description):
562570
563571 disk_type = disk_type .replace ('RPM' , '' ).strip ()
564572 disk_type = disk_type .replace (' ' , '_' ).upper ()
565-
566- #if 'SCSI' in disk['description']:
567- # disk_type = 'SCSI'
568-
569573 disk_type = str (int (disk ['capacity' ])) + '_' + disk_type
570574 disks .append ((disk_type , disk ['price_id' ]))
571575
@@ -582,6 +586,14 @@ def _generate_windows_code(description):
582586 single .append ((int (item ['capacity' ]), item ['price_id' ]))
583587
584588 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
585597 elif 'bandwidth' == section :
586598 options = []
587599 for item in ds_options ['categories' ]['bandwidth' ]['items' ]:
@@ -626,7 +638,9 @@ class CreateHardware(CLIRunnable):
626638 Note: Omitting this value defaults to the first
627639 available datacenter
628640 -n MBPS, --network=MBPS Network port speed in Mbps
629- -b MBPS, --bandwith=MBPS Outbound bandwidth 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.
630644 --controller=RAID The RAID configuration for the server.
631645 Defaults to None.
632646 --dry-run, --test Do not create the server, just get a quote
@@ -687,6 +701,16 @@ def execute(cls, client, args):
687701
688702 order ['disk_controller' ] = dc_price
689703
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+
690714 # Set the port speed
691715 port_speed = args .get ('--network' ) or 10
692716
@@ -739,6 +763,13 @@ def execute(cls, client, args):
739763 'notification' )
740764 order ['lockbox' ] = cls ._get_default_value (ds_options , 'lockbox' )
741765
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+
742773 # Begin output
743774 t = Table (['Item' , 'cost' ])
744775 t .align ['Item' ] = 'r'
0 commit comments