def _get_instance_avail_set(self, instance_name): """ _get_instance_avail_set is a helper method which, given the name of an instance, returns the fully qualified URI of the availabilitySet the instance is a part of. """ # first; check for the instance's existence: if instance_name not in self._context.heat_resource_stack: raise exceptions.AutoScalingGroupInvalidFieldException( "'%s': referenced Instance '%s' does not exist." % ( self, instance_name ) ) instance = self._context.heat_resource_stack[instance_name] # now; check if the instance has an explicit AvailabilityZone set: if 'AvailabilityZone' in instance.properties: # if so, return a reference to the availabilitySet # which the EC2InstanceTranslator will create: self._required_avail_set_name = instance_name return autoscale_utils.create_avail_set_uri( instance.properties["AvailabilityZone"] ) # else, default to returning the uri of an availabilitySet we will be # creating especially for this AutoScalingGroup's instance. # NOTE: we must also set _requires_own_avail_set beforehand: self._requires_own_avail_set = True self._required_avail_set_name = instance_name return autoscale_utils.create_avail_set_uri(instance_name)
def _get_instance_avail_set(self, instance_name): """ _get_instance_avail_set is a helper method which, given the name of an instance, returns the fully qualified URI of the availabilitySet the instance is a part of. """ # first; check for the instance's existence: if instance_name not in self._context.heat_resource_stack: raise exceptions.AutoScalingGroupInvalidFieldException( "'%s': referenced Instance '%s' does not exist." % (self, instance_name)) instance = self._context.heat_resource_stack[instance_name] # now; check if the instance has an explicit AvailabilityZone set: if 'AvailabilityZone' in instance.properties: # if so, return a reference to the availabilitySet # which the EC2InstanceTranslator will create: self._required_avail_set_name = instance_name return autoscale_utils.create_avail_set_uri( instance.properties["AvailabilityZone"]) # else, default to returning the uri of an availabilitySet we will be # creating especially for this AutoScalingGroup's instance. # NOTE: we must also set _requires_own_avail_set beforehand: self._requires_own_avail_set = True self._required_avail_set_name = instance_name return autoscale_utils.create_avail_set_uri(instance_name)
def _get_launch_config_avail_set(self, launch_config_name): """ _get_launch_config_avail_set is a helper method which recieves the name of a LaunchConfiguration and returns the fully qualified URI of the resulting Azure availabilitySet which the instances partaking in the LaunchConfiguration will be a part of. """ # first; make sure the LaunchConfiguration is defined: if launch_config_name not in self._context.heat_resource_stack: raise exceptions.AutoScalingGroupInvalidFieldException( "'%s': referenced LaunchConfiguration '%s' doesn't exist." % (self, launch_config_name)) # default to returning the uri of an availabilitySet we will be # creating especially for this AutoScalingGroup's instance. # NOTE: considering LaunchConfigs are translated roughly the same way # as instances; we simply apply the same logic here: self._requires_own_avail_set = True self._required_avail_set_name = launch_config_name return autoscale_utils.create_avail_set_uri(launch_config_name)
def _get_launch_config_avail_set(self, launch_config_name): """ _get_launch_config_avail_set is a helper method which recieves the name of a LaunchConfiguration and returns the fully qualified URI of the resulting Azure availabilitySet which the instances partaking in the LaunchConfiguration will be a part of. """ # first; make sure the LaunchConfiguration is defined: if launch_config_name not in self._context.heat_resource_stack: raise exceptions.AutoScalingGroupInvalidFieldException( "'%s': referenced LaunchConfiguration '%s' doesn't exist." % ( self, launch_config_name ) ) # default to returning the uri of an availabilitySet we will be # creating especially for this AutoScalingGroup's instance. # NOTE: considering LaunchConfigs are translated roughly the same way # as instances; we simply apply the same logic here: self._requires_own_avail_set = True self._required_avail_set_name = launch_config_name return autoscale_utils.create_avail_set_uri(launch_config_name)