Ejemplo n.º 1
0
def test_set_unset_properties_instances(launch_instances):
    vm_helper.set_vm(vm_id=launch_instances, **{FlavorSpec.AUTO_RECOVERY: "true",
                                                FlavorSpec.LIVE_MIG_MAX_DOWNTIME: "500",
                                                FlavorSpec.LIVE_MIG_TIME_OUT: "180"})
    vm_helper.unset_vm(vm_id=launch_instances, properties=[FlavorSpec.AUTO_RECOVERY,
                                                           FlavorSpec.LIVE_MIG_MAX_DOWNTIME,
                                                           FlavorSpec.LIVE_MIG_TIME_OUT])
    def create_vms(self):
        LOG.tc_step('Create VMs')

        vm_name_format = 'pve_vm_{}'

        num_priorities = len(self.prioritizing)

        for sn in range(NUM_VM):

            name = vm_name_format.format(sn)
            if self.set_on_boot and sn < num_priorities:
                vm_id = vm_helper.boot_vm(
                    name=name,
                    meta={
                        VMMetaData.EVACUATION_PRIORITY: self.prioritizing[sn]
                    },
                    flavor=self.vms_info[sn]['flavor_id'],
                    source='volume',
                    avail_zone='cgcsauto',
                    vm_host=self.current_host,
                    cleanup='function')[1]
            else:
                vm_id = vm_helper.boot_vm(
                    name,
                    flavor=self.vms_info[sn]['flavor_id'],
                    source='volume',
                    avail_zone='cgcsauto',
                    vm_host=self.current_host,
                    cleanup='function')[1]
                if sn < num_priorities:
                    vm_helper.set_vm(vm_id,
                                     properties={
                                         VMMetaData.EVACUATION_PRIORITY:
                                         self.prioritizing[sn]
                                     })

            LOG.info('OK, VM{} created: id={}\n'.format(sn, vm_id))
            self.vms_info[sn].update(vm_id=vm_id,
                                     vm_name=name,
                                     priority=self.prioritizing[sn])

        LOG.info('OK, VMs created:\n{}\n'.format(
            [vm['vm_id'] for vm in self.vms_info.values()]))
Ejemplo n.º 3
0
def test_set_error_active_flags_instances(launch_instances, status):
    vm_helper.set_vm(vm_id=launch_instances, state=status)
def set_evacuate_priority(vm_id, priority, fail_ok=False):
    data = {VMMetaData.EVACUATION_PRIORITY: priority}
    return vm_helper.set_vm(vm_id, fail_ok=fail_ok, properties=data)