Пример #1
0
    def storage_resource_query(self, storageres_type, volume_name, cg_name,
                               snapshot_name, project, tenant):
        resourcepath = "/" + project
        if tenant is not None:
            resourcepath = tenant + resourcepath

        resUri = None
        resourceObj = None

        if Volume.BLOCK == storageres_type and volume_name is not None:
            resUri = self.volume_query(resourcepath, volume_name)
            if snapshot_name is not None:
                from cinder.volume.drivers.coprhd.helpers import snapshot
                snapobj = snapshot.Snapshot(self.ipaddr, self.port)
                resUri = snapobj.snapshot_query(storageres_type,
                                                Volume.VOLUMES, resUri,
                                                snapshot_name)

        elif Volume.BLOCK == storageres_type and cg_name is not None:
            resourceObj = consistencygroup.ConsistencyGroup(
                self.ipaddr, self.port)
            resUri = resourceObj.consistencygroup_query(
                cg_name, project, tenant)
        else:
            resourceObj = None

        return resUri
Пример #2
0
    def storage_resource_query(self, storageres_type, volume_name, cg_name,
                               project, tenant):
        resourcepath = "/" + project
        if tenant is not None:
            resourcepath = tenant + resourcepath

        resUri = None
        resourceObj = None
        if Snapshot.BLOCK == storageres_type and volume_name is not None:
            resourceObj = volume.Volume(self.ipaddr, self.port)
            resUri = resourceObj.volume_query(resourcepath, volume_name)
        elif Snapshot.BLOCK == storageres_type and cg_name is not None:
            resourceObj = consistencygroup.ConsistencyGroup(
                self.ipaddr, self.port)
            resUri = resourceObj.consistencygroup_query(
                cg_name, project, tenant)
        else:
            resourceObj = None

        return resUri