Esempio n. 1
0
                    options.runs -= 1
                    continue

                ###Create an ssh session to the instance using a eutester object
                instance_ssh = Eucaops( hostname=instance.public_dns_name,  keypath=keypath)
                
                ### Ensure we know what device are on the instance before the attachment of a volume
                before_attach = instance_ssh.sys("ls -1 /dev/ | grep " + options.device_prefix)
                
                ### Check that the ephemeral is available to the VM
                if options.device_prefix + "a2\n" in before_attach:
                    print "Found ephemeral device"
                else:
                    instance.terminate()
                    tester.fail("Did not find ephemeral mounted from /dev/" + options.device_prefix + "a2"+ " to /mnt on " + str(instance))
                    tester.tee("\n".join(tester.grep_euca_log(component="nc00",regex=instance.id)) + "\n".join(tester.grep_euca_log(regex=instance.id)) )
                    options.runs -= 1
                    continue 
                
                ### If the --ebs flag was passed to the script, attach a volume and verify it can be used
                if options.ebs == True:
                    ## Create the volume
                    try:
                        volume = tester.create_volume(options.zone, size=1 )     
                    except Exception, e:
                        tester.fail("Something went wrong when creating the volume")
                        tester.tee( "Volume error\n".join(tester.grep_euca_log(regex=volume.id)) )
                        options.runs -= 1
                        continue
                    
                    ### Attach the volume (need to write a routine to validate the attachment)