Revision e0525d86

b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
725 725
    def version_create(self, node, hash, size, type, source, muser, uuid,
726 726
                       checksum, cluster=0,
727 727
                       update_statistics_ancestors_depth=None,
728
                       available=True):
728
                       available=True, map_check_timestamp=None):
729 729
        """Create a new version from the given properties.
730 730
           Return the (serial, mtime) of the new version.
731 731
        """
......
734 734
        s = self.versions.insert().values(
735 735
            node=node, hash=hash, size=size, type=type, source=source,
736 736
            mtime=mtime, muser=muser, uuid=uuid, checksum=checksum,
737
            cluster=cluster, available=available)
737
            cluster=cluster, available=available,
738
            map_check_timestamp=map_check_timestamp)
738 739
        serial = self.conn.execute(s).inserted_primary_key[0]
739 740
        self.statistics_update_ancestors(node, 1, size, mtime, cluster,
740 741
                                         update_statistics_ancestors_depth)
b/snf-pithos-backend/pithos/backends/modular.py
945 945
        path, node = self._lookup_object(account, container, name)
946 946
        props = self._get_version(node, version)
947 947
        if version is None:
948
            if not props[self.AVAILABLE]:
949
                try:
950
                    self._update_available(props)
951
                except (NotAllowedError, IllegalOperationError):
952
                    pass  # just update the database
953
                finally:
954
                    # get updated properties
955
                    props = self._get_version(node, version)
948 956
            modified = props[self.MTIME]
949 957
        else:
950 958
            try:
......
1161 1169
        pre_version_id, dest_version_id = self._put_version_duplicate(
1162 1170
            user, node, src_node=src_node, size=size, type=type, hash=hash,
1163 1171
            checksum=checksum, is_copy=is_copy,
1164
            update_statistics_ancestors_depth=1, available=available)
1172
            update_statistics_ancestors_depth=1,
1173
            available=available, keep_available=False)
1165 1174

  
1166 1175
        # Handle meta.
1167 1176
        if src_version_id is None:
......
1692 1701
                               type=None, hash=None, checksum=None,
1693 1702
                               cluster=CLUSTER_NORMAL, is_copy=False,
1694 1703
                               update_statistics_ancestors_depth=None,
1695
                               available=True):
1704
                               available=True, keep_available=True):
1696 1705
        """Create a new version of the node."""
1697 1706

  
1698 1707
        props = self.node.version_lookup(
......
1703 1712
            src_size = props[self.SIZE]
1704 1713
            src_type = props[self.TYPE]
1705 1714
            src_checksum = props[self.CHECKSUM]
1715
            if keep_available:
1716
                src_available = props[self.AVAILABLE]
1717
                src_map_check_timestamp = props[self.MAP_CHECK_TIMESTAMP]
1718
            else:
1719
                src_available = available
1720
                src_map_check_timestamp = None
1706 1721
        else:
1707 1722
            src_version_id = None
1708 1723
            src_hash = None
1709 1724
            src_size = 0
1710 1725
            src_type = ''
1711 1726
            src_checksum = ''
1727
            src_available = available
1728
            src_map_check_timestamp = None
1712 1729
        if size is None:  # Set metadata.
1713 1730
            hash = src_hash  # This way hash can be set to None
1714 1731
                             # (account or container).
......
1734 1751
        dest_version_id, mtime = self.node.version_create(
1735 1752
            node, hash, size, type, src_version_id, user, uuid, checksum,
1736 1753
            cluster, update_statistics_ancestors_depth,
1737
            available=available)
1754
            available=src_available,
1755
            map_check_timestamp=src_map_check_timestamp)
1738 1756

  
1739 1757
        self.node.attribute_unset_is_latest(node, dest_version_id)
1740 1758

  

Also available in: Unified diff