def createServer(): """ Creates a server with entered name, then shows how to poll for it to be created. """ print "Server Name to Create: " name = stdin.readline().strip() s = Server(name=name, imageId=3, flavorId=1) # Create doesn't return anything, but fills in the server with info # (including) admin p/w serverManager.create(s) serverManager.notify(s, notifyCallback) pprint(s) print "Server is now: ", s # show the server with all values filled in # sleepTime = getSleepTime() # status = s.status # while status == "BUILD": # status = s.status # # print "Status : ", s.status # print "Progress : ", s.progress # # print "Sleeping : ", sleepTime # # sleep(sleepTime) print "Built!"
def createServerAndWait(): """ Creates a server with entered name, then uses the wait() method to poll for it to be created. """ print "Server Name to Create: " name = stdin.readline().strip() s = Server(name=name, imageId=3, flavorId=1) # Create doesn't return anything, but fills in the server with info # (including) admin p/w serverManager.create(s) pprint(s) print "Server is now: ", s # show the server with all values filled in serverManager.wait(s) print "Built!"