#Launch an instance from the emi we've retrieved, instance is returned in the running state tester.poll_count = 96 reservation=tester.run_instance(image, keypair=keypair.name, group=group_name,zone=zone, ) if (reservation is not None): instance = reservation.instances[0] pmsg("Launched instance:"+instance.id) else: raise Exception("Failed to run an instance using emi:"+image.id) except Exception, e: pmsg("Doh, error while trying to run instance using emi:"+image.id) raise e try: keypath = os.getcwd() + "/" + keypair.name + ".pem" pmsg('Getting contents from /dev...') before_attach = instance.get_dev_dir() except Exception, ie: raise Exception("Failed to retrieve contents of /dev dir from instance, Error:"+str(ie)) pmsg("Got snapshot of /dev, now creating a volume of "+str(rfsize)+" to attach to our instance...") volume=tester.create_volume(zone, rfsize) dev = "/dev/sdf" pmsg("Attaching Volume ("+volume.id+") to instance("+instance.id+") trying dev("+dev+")") try: volume.attach(instance.id, "/dev/sdf") except Exception, ve: raise Exception("Error attaching volume:"+str(volume.id)+", Error:"+str(ve))