def __init__(self, scenario, vm_group_name, annotate=False): super(ResetGroupPlacement, self).__init__(scenario, annotate=annotate) self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = ("%s: Migrating VMs to original placement" % self.vm_group.name())
def __init__(self, scenario, vm_group_name, annotate=False): """ Raises: CurieTestException: If no VM group named vm_group_name exists. """ super(PowerOff, self).__init__(scenario, annotate=annotate) self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Powering off VMs" % self.vm_group.name()
def __init__(self, scenario, vm_group_name, wait_secs=600, annotate=False): """ Raises: CurieTestException: If no VM group named vm_group_name exists. """ super(WaitForPowerOn, self).__init__(scenario, annotate=annotate) self.wait_secs = wait_secs self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Waiting for VMs to power on" % self.vm_group.name( )
def __init__(self, scenario, vm_group_name, annotate=False): """ Disables HA on a VMGroup's VMs. Args: scenario (Scenario): Scenario this step belongs to. vm_group_name (str): Name of VM group to disable HA. annotate (bool): Whether or not to annotate events for this step. """ super(DisableHA, self).__init__(scenario, annotate=annotate) self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Disabling HA on VMs" % self.vm_group.name()
def __init__(self, scenario, vm_group_name, dest_datastore_name, annotate=False): """Relocates an entire VMGroup to a new datastore/container. (Storage VMotion). Args: scenario (Scenario): Scenario this step belongs to. vm_group_name (str): Name of VM group to run the command. dest_datastore_name (str): The name of the destination datastore. annotate (bool): Whether or not to annotate events for this step. """ super(RelocateGroupDatastore, self).__init__(scenario, annotate=annotate) self.dest_datastore_name = dest_datastore_name self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = ("%s: Relocating VMs to datastore '%s'" % (self.vm_group.name(), self.dest_datastore_name))
def __init__(self, scenario, vm_group_name, power_on=False, annotate=False, linked_clone=False, disable_drs=True, disable_ha=True): """ Raises: CurieTestException: If no VM group named vm_group_name exists. """ super(CloneFromTemplate, self).__init__(scenario, annotate=annotate) self.power_on = power_on self.linked_clone = linked_clone self.disable_drs = disable_drs self.disable_ha = disable_ha self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Cloning from template" % self.vm_group.name()
class CreatePeriodicSnapshots(BaseStep): """Create a number of snapshots periodically on a VM group. Args: scenario (Scenario): Scenario this step belongs to. vm_group_name (str): Name of VM group associated with the snapshots. num_snapshots (int): Number of snapshots to take. interval_minutes (int): Amount of time to wait between snapshots. annotate (bool): If True, annotate key points in the step in the test's results. async (bool): If False, blocks until all snapshots are created. If True, step returns immediately, and a daemon thread is run to create all snapshots in the background. """ def __init__(self, scenario, vm_group_name, num_snapshots, interval_minutes, annotate=True, async=False): """ Raises: CurieTestException: If no VM group named vm_group_name exists. """ super(CreatePeriodicSnapshots, self).__init__(scenario, annotate=annotate) self.num_snapshots = num_snapshots self.num_intervals = num_snapshots - 1 self.interval_minutes = interval_minutes self.nutanix_snapshot_id_set = set() self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Creating periodic snapshots" % self.vm_group.name( ) self. async = async
def __init__(self, scenario, vm_group_name, from_node, to_node, annotate=False): """Migrates a VMGroup with VMs on from_node to to_node. Args: scenario (Scenario): Scenario this step belongs to. vm_group_name (str): Name of VM group to run the command. from_node (int): The index of a node to migrate VMs from. to_node (int): The index of a node to migrate VMs to. annotate (bool): Whether or not to annotate events for this step. """ super(MigrateGroup, self).__init__(scenario, annotate=annotate) self.from_node_index = int(from_node) self.to_node_index = int(to_node) self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = ("%s: Migrating VMs from node '%s' to node '%s'" % (self.vm_group.name(), from_node, to_node))
def __init__(self, scenario, vm_group_name, command, fail_on_error=True, user="******", annotate=False, timeout_secs=120): """ Raises: CurieTestException: If no VM group named vm_group_name exists. """ super(RunCommand, self).__init__(scenario, annotate=annotate) self.command = command self.timeout_secs = timeout_secs self.fail_on_error = fail_on_error self.user = user self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) self.description = "%s: Executing '%s'" % (self.vm_group.name(), self.command)
def __init__(self, scenario, vm_group_name, count_per_node=None, count_per_cluster=None, annotate=False, linked_clone=False): super(Grow, self).__init__(scenario, annotate=annotate) self.count_per_node = count_per_node self.count_per_cluster = count_per_cluster self.linked_clone = linked_clone self.vm_group = scenario.vm_groups.get(vm_group_name) if self.vm_group is None: raise NoVMGroupDefinedError(vm_group_name=vm_group_name, step=self) if self.count_per_node is None and self.count_per_cluster is None: raise CurieTestException( cause= "Must specify either 'count_per_node' or 'count_per_cluster' in %s." % self.name, impact="The scenario '%s' is not valid, and can not be started." % self.scenario.display_name, corrective_action= "If you are the author of the scenario, please check the syntax of " "the %s step; Ensure that either 'count_per_node' or " "'count_per_cluster' is given." % self.name) if self.count_per_node is not None and self.count_per_cluster is not None: raise CurieTestException( cause= "Must specify either 'count_per_node' or 'count_per_cluster' in %s, " "but not both." % self.name, impact="The scenario '%s' is not valid, and can not be started." % self.scenario.display_name, corrective_action= "If you are the author of the scenario, please check the syntax of " "the %s step; Ensure that either 'count_per_node' or " "'count_per_cluster' is given, but not both." % self.name) self.description = "%s: Cloning new VMs" % self.vm_group.name()