print "No user name was specified." error() elif config.rhevmconfig["passwd"] == "": print "Enter password for user %s:" % (config.rhevmconfig['user']) config.rhevmconfig['passwd'] = getpass() # Connect to RHEV-M if config.vmconfig["quiet"]==False: print "Connecting to RHEV-M %s..." % (config.rhevmconfig['host']) api = API (url=config.rhevmconfig["host"], username=config.rhevmconfig["user"], password=config.rhevmconfig["passwd"], insecure=True) if config.vmconfig["quiet"]==False: print "Connection established" print "" if config.vmname!="": vm = vm(config.vmname, config.vmconfig, api) if command == "start": vm.start() elif command == "stop": vm.stop() elif command == "console": vm.console(config.rhevmconfig) elif command == "migrate": vm.migrate() elif command == "shutdown": vm.shutdown() elif command == "create": vm.create() elif command == "delete": vm.delete(config) elif command == "details":
print "Enter password for user %s:" % (config.rhevmconfig['user']) config.rhevmconfig['passwd'] = getpass() # Connect to RHEV-M if config.vmconfig["quiet"] == False: print "Connecting to RHEV-M %s..." % (config.rhevmconfig['host']) api = API(url=config.rhevmconfig["host"], username=config.rhevmconfig["user"], password=config.rhevmconfig["passwd"], insecure=True) if config.vmconfig["quiet"] == False: print "Connection established" print "" if config.vmname != "": vm = vm(config.vmname, config.vmconfig, api) if command == "start": vm.start() elif command == "stop": vm.stop() elif command == "console": vm.console(config.rhevmconfig) elif command == "migrate": vm.migrate() elif command == "shutdown": vm.shutdown() elif command == "create": vm.create() elif command == "delete": vm.delete(config) elif command == "details":
print "\tImport failed, will not try to start this VM" # make VMs with more than one virtual disk startable # Case #00753220 print "" rc=os.system("psql engine postgres -c \"update base_disks set disk_alias = \'disk\' where disk_alias is null;\"") if rc != 0 : print "Updating database failed." else: print "Update of database was successful." if len(uplist)>0: while len(uplist)>0: print "\nVerifying VMs are in the correct Power State..." for currentvm in uplist: vmobject=vm(currentvm, config.vmconfig, api) state=vmobject.status() if state!="down": print "\tVM",currentvm,"not in status down, waiting..." else: print "\tSetting preferred Host for",currentvm,"to",importvms[currentvm]['host'] hostid=api.hosts.get(name=importvms[currentvm]['host']) v=api.vms.get(name=currentvm) v.usb.enabled='false' v.placement_policy.affinity="migratable" v.placement_policy.host=hostid v.update() print "\tVM",currentvm,"is down, starting it now." api.vms.get(name=currentvm).start() uplist.remove(currentvm)