Revision 5f9426d9

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
911 911
        path, node = self._lookup_object(account, container, name)
912 912
        props = self._get_version(node, version)
913 913
        if version is None:
914
            if not props[self.AVAILABLE]:
915
                try:
916
                    self._update_available(props)
917
                except (NotAllowedError, IllegalOperationError):
918
                    pass  # just update the database
919
                finally:
920
                    # get updated properties
921
                    props = self._get_version(node, version)
914 922
            modified = props[self.MTIME]
915 923
        else:
916 924
            try:
......
1123 1131
        pre_version_id, dest_version_id = self._put_version_duplicate(
1124 1132
            user, node, src_node=src_node, size=size, type=type, hash=hash,
1125 1133
            checksum=checksum, is_copy=is_copy,
1126
            update_statistics_ancestors_depth=1, available=available)
1134
            update_statistics_ancestors_depth=1,
1135
            available=available, keep_available=False)
1127 1136

  
1128 1137
        # Handle meta.
1129 1138
        if src_version_id is None:
......
1650 1659
                               type=None, hash=None, checksum=None,
1651 1660
                               cluster=CLUSTER_NORMAL, is_copy=False,
1652 1661
                               update_statistics_ancestors_depth=None,
1653
                               available=True):
1662
                               available=True, keep_available=True):
1654 1663
        """Create a new version of the node."""
1655 1664

  
1656 1665
        props = self.node.version_lookup(
......
1661 1670
            src_size = props[self.SIZE]
1662 1671
            src_type = props[self.TYPE]
1663 1672
            src_checksum = props[self.CHECKSUM]
1673
            if keep_available:
1674
                src_available = props[self.AVAILABLE]
1675
                src_map_check_timestamp = props[self.MAP_CHECK_TIMESTAMP]
1676
            else:
1677
                src_available = available
1678
                src_map_check_timestamp = None
1664 1679
        else:
1665 1680
            src_version_id = None
1666 1681
            src_hash = None
1667 1682
            src_size = 0
1668 1683
            src_type = ''
1669 1684
            src_checksum = ''
1685
            src_available = available
1686
            src_map_check_timestamp = None
1670 1687
        if size is None:  # Set metadata.
1671 1688
            hash = src_hash  # This way hash can be set to None
1672 1689
                             # (account or container).
......
1692 1709
        dest_version_id, mtime = self.node.version_create(
1693 1710
            node, hash, size, type, src_version_id, user, uuid, checksum,
1694 1711
            cluster, update_statistics_ancestors_depth,
1695
            available=available)
1712
            available=src_available,
1713
            map_check_timestamp=src_map_check_timestamp)
1696 1714

  
1697 1715
        self.node.attribute_unset_is_latest(node, dest_version_id)
1698 1716

  

Also available in: Unified diff