Exemplo n.º 1
0
def requiresUpgrade(path):
    # if the metadata requires upgrade either by pre-Boston logic
    # or Boston logic upgrade it

    # First check if this is a pre-6.0 pool using the old metadata
    pre_boston_upgrade = False
    boston_upgrade = False
    try:
        if metadata.requiresUpgrade(path):
            pre_boston_upgrade = True
    except Exception, e:
        util.SMlog("This looks like a 6.0 or later pool, try checking " \
                   "for upgrade using the new metadata header format. " \
                    "Error: %s" % str(e))
def requiresUpgrade(path):
    # if the metadata requires upgrade either by pre-Boston logic
    # or Boston logic upgrade it
    
    # First check if this is a pre-6.0 pool using the old metadata
    pre_boston_upgrade = False
    boston_upgrade = False
    try:
        if metadata.requiresUpgrade(path):
            pre_boston_upgrade = True
    except Exception, e:
        util.SMlog("This looks like a 6.0 or later pool, try checking " \
                   "for upgrade using the new metadata header format. " \
                    "Error: %s" % str(e))
Exemplo n.º 3
0
def requiresUpgrade(path):
    # if the metadata requires upgrade either by pre-Boston logic
    # or Boston logic upgrade it
    
    # First check if this is a pre-6.0 pool using the old metadata
    pre_boston_upgrade = False
    boston_upgrade = False
    try:
        if metadata.requiresUpgrade(path):
            pre_boston_upgrade = True
    except Exception as e:
        util.SMlog("This looks like a 6.0 or later pool, try checking " \
                   "for upgrade using the new metadata header format. " \
                    "Error: %s" % str(e))
      
    try:  
        # Now check for upgrade using the header format for 6.0/post-6.0
        try:
            fd = -1
            fd = open_file(path)
            min_blk_size = get_min_blk_size_wrapper(fd)
            sector1 = \
                file_read_wrapper(fd, 0, SECTOR_SIZE, min_blk_size).strip()
            hdr = unpackHeader(sector1)
            mdmajor = int(hdr[2])
            mdminor = int(hdr[3])
               
            if mdmajor < metadata.MD_MAJOR:
                boston_upgrade = True
            elif mdmajor == metadata.MD_MAJOR and mdminor < metadata.MD_MINOR:
                boston_upgrade = True
           
        except Exception as e:
            util.SMlog("Exception checking header version, upgrading metadata."\
                       " Error: %s" % str(e))
            return True
    finally:
        close(fd)
        
    return pre_boston_upgrade or boston_upgrade