def getVolumeInfo(target):
    ''' Returns a dict with information of the volume that lives in the backendSpec.
    @param target, specifies the backend and namespace
    @return, dict, a dict with information on the volume
    '''
    vol_info = ToolCut.VolumeInfo(target.params(), target.namespace())
    return {"volume_role": vol_info.role(), "volume_size": vol_info.size()}
示例#2
0
def testSP(target):
    sp = T.SnapshotPersistor(target.params(), target.namespace())
    count = 0
    for s in sp.getSnapshots():
        logger.info(s.name())
        logger.info(s.stored())
        logger.info(s.date())
        nose.tools.eq_(s.stored(), sp.snapshotStored(s.name()))
        count += s.stored()
    count += sp.currentStored()
    nose.tools.eq_(sp.stored(), count)
def getVolumeSnapshots(target, show_all=False):
    '''Returns a list of the snapshots in the backend.
        @param target, BackendWithNameSpace, specifies the backend
        @param show_all, boolean, also show snapshots that are not in the backend if True (default: False)
        @return, list, a list of snapshot names
    '''
    verifyBackendWithNameSpaceType(target)
    return [
        s.name() for s in ToolCut.SnapshotPersistor(
            target.params(), target.namespace()).getSnapshots()
        if show_all or s.inBackend()
    ]
def getScrubSnapshots(target):
    """Get scrubbing work from a backup target volume
        The target namespace must exist and have a valid volume for this to work.
    @param target : BackendWithNamespace
    """
    verifyBackendWithNameSpaceType(target)
    list_of_scrubbables = ToolCut.SnapshotPersistor(
        target.params(), target.namespace()).getScrubbingWork()
    # the stuff returned from getWork in the volume interface looks differently
    # We can return that here by finishing getDict on BackendToolcut and passing
    # in more parameters... just return a list of the snapshots to be scrubbed
    # now
    return list_of_scrubbables
def getVolumeSnapshotsTool(target):
    '''Creates a ToolCut.SnapshotPersistor object on which further snapshot queries can be performed
           target, BackendWithNameSpace, specifies the backend
           returns ToolCut.SnapshotPersistor

       Example usage:

       snapshotsTool = getVolumeSnapshotsTool(target)
       for s in snapshotsTool.getSnapshots():
            print s.name()
            print s.stored()
            print s.date()
    '''
    verifyBackendWithNameSpaceType(target)
    return ToolCut.SnapshotPersistor(target.params(), target.namespace())
示例#6
0
 def test_unicode(self):
     dct = json.loads(json_str, object_hook=auxiliary.noUnicode)
     ToolCut.BackendInterface(auxiliary.mapDict(str, dct), "bla")