Example #1
0
 def test6_Reboot(self):
     """Reboot instance ensure IP connectivity and volumes stay attached"""
     for instance in self.reservation.instances:
         ### Create 1GB volume in first AZ
         volume = self.tester.create_volume(self.tester.ec2.get_all_zones()[0].name)
         
         ### Pass in check the devices on the instance before the attachment
         device_path = "/dev/" + self.device_prefix  +"j"
         instance_ssh = Eucaops( hostname=instance.public_dns_name,  keypath= self.keypath)
         before_attach = instance_ssh.sys("ls -1 /dev/ | grep " + self.device_prefix)
         
         ### Attach the volume to the instance
         self.assertTrue(self.tester.attach_volume(instance, volume, device_path), "Failure attaching volume")
         
         ### Check devices after attachment
         after_attach = instance_ssh.sys("ls -1 /dev/ | grep " + self.device_prefix)
         new_devices = self.tester.diff(after_attach, before_attach)
         
         ### Check for device in instance
         self.assertTrue(instance_ssh.check_device("/dev/" + new_devices[0]), "Did not find device on instance before reboot")
         
         ### Reboot instance
         instance.reboot()
         self.tester.sleep(30)
         
         ### Check for device in instance
         instance_ssh = Eucaops( hostname=instance.public_dns_name,  keypath= self.keypath)
         self.assertTrue(instance_ssh.check_device("/dev/" + new_devices[0]), "Did not find device on instance after reboot")
         self.assertTrue(self.tester.detach_volume(volume), "Unable to detach volume")
         self.assertTrue(self.tester.delete_volume(volume), "Unable to delete volume")