Example #1
0
 def __init__(self, group):
     gid = group.get('group_type_id')
     specs = group_types.get_group_type_specs(gid) if gid else {}
     self.type_cg_snapshot = specs.get(
         'consistent_group_snapshot_enabled', '<is> %s' %
         EXTRA_SPECS_DEFAULTS['consistent_group_snapshot_enabled']).upper(
         ) == strings.METADATA_IS_TRUE
Example #2
0
def get_group_specs(group, spec_key):
    spec_value = None
    if group.group_type_id:
        group_specs = group_types.get_group_type_specs(group.group_type_id)
        if spec_key in group_specs:
            spec_value = group_specs[spec_key]
    return spec_value
Example #3
0
    def from_group(cls, group):
        group_specs = {}

        if group and group.group_type_id:
            group_specs = group_types.get_group_type_specs(group.group_type_id)

        return cls(extra_specs={}, group_specs=group_specs)
Example #4
0
def is_group_a_type(group, key):
    if group.group_type_id is not None:
        spec = group_types.get_group_type_specs(
            group.group_type_id, key=key
        )
        return spec == "<is> True"
    return False
Example #5
0
def is_group_a_type(group, key):
    if group.group_type_id is not None:
        spec = group_types.get_group_type_specs(
            group.group_type_id, key=key
        )
        return spec == "<is> True"
    return False
Example #6
0
def is_group_a_cg_snapshot_type(group_or_snap):
    LOG.debug("Checking if %s is a consistent snapshot group", group_or_snap)
    if group_or_snap["group_type_id"] is not None:
        spec = group_types.get_group_type_specs(
            group_or_snap["group_type_id"],
            key="consistent_group_snapshot_enabled")
        return spec == "<is> True"
    return False
Example #7
0
    def from_group(cls, group):
        group_specs = {}

        if group and group.group_type_id:
            group_specs = group_types.get_group_type_specs(
                group.group_type_id)

        return cls(extra_specs={}, group_specs=group_specs)
Example #8
0
def is_group_a_cg_snapshot_type(group_or_snap):
    LOG.debug("Checking if %s is a consistent snapshot group",
              group_or_snap)
    if group_or_snap["group_type_id"] is not None:
        spec = group_types.get_group_type_specs(
            group_or_snap["group_type_id"],
            key="consistent_group_snapshot_enabled"
        )
        return spec == "<is> True"
    return False