def _is_cluster_volume(cluster_id, ebs_volume): """ Helper function to check if given volume belongs to given cluster. :param UUID cluster_id: UUID of Flocker cluster to check for membership. :param boto3.resources.factory.ec2.Volume ebs_volume: EBS volume to check for input cluster membership. :return bool: True if input volume belongs to input Flocker cluster. False otherwise. """ if ebs_volume.tags is not None: actual_cluster_id = [tag["Value"] for tag in ebs_volume.tags if tag["Key"] == CLUSTER_ID_LABEL] if actual_cluster_id: actual_cluster_id = UUID(actual_cluster_id.pop()) if actual_cluster_id == cluster_id: return True return False
def _is_cluster_volume(cluster_id, ebs_volume): """ Helper function to check if given volume belongs to given cluster. :param UUID cluster_id: UUID of Flocker cluster to check for membership. :param boto3.resources.factory.ec2.Volume ebs_volume: EBS volume to check for input cluster membership. :return bool: True if input volume belongs to input Flocker cluster. False otherwise. """ if ebs_volume.tags is not None: actual_cluster_id = [ tag['Value'] for tag in ebs_volume.tags if tag['Key'] == CLUSTER_ID_LABEL ] if actual_cluster_id: actual_cluster_id = UUID(actual_cluster_id.pop()) if actual_cluster_id == cluster_id: return True return False