Esempio n. 1
0
    def boot_testvm_instance(self, net_id, vm_name, key=' ',
                             flavor='m1.micro', image='TestVM'):

        instance = self.shell('nova boot \
                        --key_name {0} \
                        --flavor {1} \
                        --image {2} \
                        --nic net-id={3} {4}'
                        .format(key, flavor, image, net_id, vm_name))
        for _ in range(5):
            status = self.get_instance_status(vm_name)
            print "Instance status:", status
            if status == 'ERROR':
                raise "Booting instance goes to an Error!!!"
            if status == 'ACTIVE':
                return parser.details_multiple(instance)
            time.sleep(5)
        return
Esempio n. 2
0
 def get_instance_status(self, name):
     instance = self.shell('nova show {0}'.format(name))
     instance = parser.details_multiple(instance)
     return [x['status'] for x in instance]