Python oslo_utils.timeutils.utcnow() Examples

The following are 30 code examples of oslo_utils.timeutils.utcnow(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module oslo_utils.timeutils , or try the search function .
Example #1
Source File: utils.py    From searchlight with Apache License 2.0 6 votes vote down vote up
def isotime(at=None, subsecond=False):
    """Stringify time in ISO 8601 format."""

    # Python provides a similar instance method for datetime.datetime objects
    # called isoformat(). The format of the strings generated by isoformat()
    # have a couple of problems:
    # 1) The strings generated by isotime are used in tokens and other public
    #    APIs that we can't change without a deprecation period. The strings
    #    generated by isoformat are not the same format, so we can't just
    #    change to it.
    # 2) The strings generated by isoformat do not include the microseconds if
    #    the value happens to be 0. This will likely show up as random failures
    #    as parsers may be written to always expect microseconds, and it will
    #    parse correctly most of the time.

    if not at:
        at = timeutils.utcnow()
    st = at.strftime(_ISO8601_TIME_FORMAT
                     if not subsecond
                     else _ISO8601_TIME_FORMAT_SUBSECOND)
    tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
    st += ('Z' if tz == 'UTC' else tz)
    return st 
Example #2
Source File: 3e7d62517afa_add_create_share_from_snapshot_support.py    From manila with Apache License 2.0 6 votes vote down vote up
def downgrade():
    """Performs DB downgrade removing create_share_from_snapshot_support.

    Remove 'create_share_from_snapshot_support' extra spec from all share types
    and attribute 'create_share_from_snapshot_support' from Share model.
    """
    connection = op.get_bind().connect()
    deleted_at = timeutils.utcnow()
    extra_specs = sa.Table(
        'share_type_extra_specs',
        sa.MetaData(),
        autoload=True,
        autoload_with=connection)

    # pylint: disable=no-value-for-parameter
    update = extra_specs.update().where(
        extra_specs.c.spec_key ==
        constants.ExtraSpecs.CREATE_SHARE_FROM_SNAPSHOT_SUPPORT).where(
        extra_specs.c.deleted == 0).values(deleted=extra_specs.c.id,
                                           deleted_at=deleted_at)
    connection.execute(update)

    op.drop_column('shares', 'create_share_from_snapshot_support') 
Example #3
Source File: test_api.py    From manila with Apache License 2.0 6 votes vote down vote up
def test_unmanage_snapshot(self):
        fake_host = 'fake_host'
        snapshot_data = {
            'status': constants.STATUS_UNMANAGING,
            'terminated_at': timeutils.utcnow(),
        }
        snapshot = fakes.fake_snapshot(
            create_instance=True, share_instance_id='id2', **snapshot_data)
        mock_db_snap_update_call = self.mock_object(
            db_api, 'share_snapshot_update', mock.Mock(return_value=snapshot))
        mock_rpc_call = self.mock_object(
            self.share_rpcapi, 'unmanage_snapshot')

        retval = self.api.unmanage_snapshot(
            self.context, snapshot, fake_host)

        self.assertIsNone(retval)
        mock_db_snap_update_call.assert_called_once_with(
            self.context, snapshot['id'], snapshot_data)
        mock_rpc_call.assert_called_once_with(
            self.context, snapshot, fake_host) 
Example #4
Source File: 1f0bd302c1a6_add_availability_zones_table.py    From manila with Apache License 2.0 6 votes vote down vote up
def collect_existing_az_from_services_table(connection, services_table,
                                            az_table):
    az_name_to_id_mapping = dict()
    existing_az = []
    for service in connection.execute(services_table.select()):
        if service.availability_zone in az_name_to_id_mapping:
            continue

        az_id = uuidutils.generate_uuid()
        az_name_to_id_mapping[service.availability_zone] = az_id
        existing_az.append({
            'created_at': timeutils.utcnow(),
            'id': az_id,
            'name': service.availability_zone
        })

    op.bulk_insert(az_table, existing_az)

    return az_name_to_id_mapping 
Example #5
Source File: 55761e5f59c5_add_snapshot_support_extra_spec_to_share_types.py    From manila with Apache License 2.0 6 votes vote down vote up
def downgrade():
    """Performs DB downgrade removing support of 'optional snapshots' feature.

    Remove 'snapshot_support' extra spec from all share types and
    attr 'snapshot_support' from Share model.
    """
    connection = op.get_bind().connect()
    extra_specs = sa.Table(
        'share_type_extra_specs',
        sa.MetaData(),
        autoload=True,
        autoload_with=connection)

    # pylint: disable=no-value-for-parameter
    update = extra_specs.update().where(
        extra_specs.c.spec_key == constants.ExtraSpecs.SNAPSHOT_SUPPORT).where(
        extra_specs.c.deleted == 0).values(
            deleted=extra_specs.c.id,
            deleted_at=timeutils.utcnow(),
    )
    connection.execute(update)

    op.drop_column('shares', 'snapshot_support') 
Example #6
Source File: test_container_action.py    From zun with Apache License 2.0 6 votes vote down vote up
def test_container_action_event_finish_success(self):
        """Finish a container action event."""
        uuid = uuidutils.generate_uuid()

        action = dbapi.action_start(self.context,
                                    self._create_action_values(uuid))

        dbapi.action_event_start(self.context,
                                 self._create_event_values(uuid))

        event_values = {
            'finish_time': timeutils.utcnow() + timedelta(seconds=5),
            'result': 'Success'
        }

        event_values = self._create_event_values(uuid, extra=event_values)
        event = dbapi.action_event_finish(self.context, event_values)

        self._assertActionEventSaved(event, action['id'])
        action = dbapi.action_get_by_request_id(self.context, uuid,
                                                self.context.request_id)
        self.assertNotEqual('Error', action['message']) 
Example #7
Source File: api.py    From manila with Apache License 2.0 6 votes vote down vote up
def backend_info_update(context, host, value=None, delete_existing=False):
    """Remove backend info for host name."""
    session = get_session()

    with session.begin():
        info_ref = _backend_info_query(session, context, host)
        if info_ref:
            if value:
                info_ref.update({"info_hash": value})
            elif delete_existing and info_ref['deleted'] != 1:
                info_ref.update({"deleted": 1,
                                 "deleted_at": timeutils.utcnow()})
        else:
            info_ref = models.BackendInfo()
            info_ref.update({"host": host,
                             "info_hash": value})
        info_ref.save(session)
        return info_ref 
Example #8
Source File: host_state.py    From zun with Apache License 2.0 6 votes vote down vote up
def set_update_time_on_success(function):
    """Set updated time of HostState when consuming succeed."""

    @functools.wraps(function)
    def decorated_function(self, container):
        return_value = None
        try:
            return_value = function(self, container)
        except Exception as e:
            # Ignores exception raised from consume_from_request() so that
            # booting container would fail in the resource claim of compute
            # node, other suitable node may be chosen during scheduling retry.
            LOG.warning("Selected host: %(host)s failed to consume from "
                        "container. Error: %(error)s",
                        {'host': self.hostname, 'error': e})
        else:
            self.updated = timeutils.utcnow()
        return return_value

    return decorated_function 
Example #9
Source File: api.py    From manila with Apache License 2.0 6 votes vote down vote up
def reservation_expire(context):
    session = get_session()
    with session.begin():
        current_time = timeutils.utcnow()
        reservation_query = (model_query(
            context, models.Reservation,
            session=session, read_deleted="no").
            filter(models.Reservation.expire < current_time))

        for reservation in reservation_query.all():
            if reservation.delta >= 0:
                quota_usage = model_query(context, models.QuotaUsage,
                                          session=session,
                                          read_deleted="no").filter(
                    models.QuotaUsage.id == reservation.usage_id).first()
                quota_usage.reserved -= reservation.delta
                session.add(quota_usage)

        reservation_query.soft_delete(synchronize_session=False)


################ 
Example #10
Source File: __init__.py    From ec2-api with Apache License 2.0 6 votes vote down vote up
def log_request_completion(self, response, request, start):
        apireq = request.environ.get('ec2.request', None)
        if apireq:
            action = apireq.action
        else:
            action = None
        ctxt = request.environ.get('ec2api.context', None)
        delta = timeutils.utcnow() - start
        seconds = delta.seconds
        microseconds = delta.microseconds
        LOG.info(
            "%s.%ss %s %s %s %s %s [%s] %s %s",
            seconds,
            microseconds,
            request.remote_addr,
            request.method,
            "%s%s" % (request.script_name, request.path_info),
            action,
            response.status_int,
            request.user_agent,
            request.content_type,
            response.content_type,
            context=ctxt) 
Example #11
Source File: api.py    From manila with Apache License 2.0 6 votes vote down vote up
def _quota_usage_create(context, project_id, user_id, resource, in_use,
                        reserved, until_refresh, share_type_id=None,
                        session=None):
    quota_usage_ref = models.QuotaUsage()
    if share_type_id:
        quota_usage_ref.share_type_id = share_type_id
    else:
        quota_usage_ref.user_id = user_id
    quota_usage_ref.project_id = project_id
    quota_usage_ref.resource = resource
    quota_usage_ref.in_use = in_use
    quota_usage_ref.reserved = reserved
    quota_usage_ref.until_refresh = until_refresh
    # updated_at is needed for judgement of max_age
    quota_usage_ref.updated_at = timeutils.utcnow()

    quota_usage_ref.save(session=session)

    return quota_usage_ref 
Example #12
Source File: manager.py    From zun with Apache License 2.0 6 votes vote down vote up
def _do_container_start(self, context, container):
        LOG.debug('Starting container: %s', container.uuid)
        with self._update_task_state(context, container,
                                     consts.CONTAINER_STARTING):
            try:
                # NOTE(hongbin): capsule shouldn't reach here
                container = self.driver.start(context, container)
                container.started_at = timeutils.utcnow()
                container.save(context)
                return container
            except exception.DockerError as e:
                with excutils.save_and_reraise_exception():
                    LOG.error("Error occurred while calling Docker start "
                              "API: %s", str(e))
                    self._fail_container(context, container, str(e))
            except Exception as e:
                with excutils.save_and_reraise_exception():
                    LOG.exception("Unexpected exception: %s",
                                  str(e))
                    self._fail_container(context, container, str(e)) 
Example #13
Source File: ec2utils.py    From ec2-api with Apache License 2.0 6 votes vote down vote up
def isotime(at=None, subsecond=False):
    """Stringify time in ISO 8601 format."""

    # Python provides a similar instance method for datetime.datetime objects
    # called isoformat(). The format of the strings generated by isoformat()
    # have a couple of problems:
    # 1) The strings generated by isotime are used in tokens and other public
    #    APIs that we can't change without a deprecation period. The strings
    #    generated by isoformat are not the same format, so we can't just
    #    change to it.
    # 2) The strings generated by isoformat do not include the microseconds if
    #    the value happens to be 0. This will likely show up as random failures
    #    as parsers may be written to always expect microseconds, and it will
    #    parse correctly most of the time.

    if not at:
        at = timeutils.utcnow()
    st = at.strftime(_ISO8601_TIME_FORMAT
                     if not subsecond
                     else _ISO8601_TIME_FORMAT_SUBSECOND)
    tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
    st += ('Z' if tz == 'UTC' else tz)
    return st 
Example #14
Source File: utils.py    From manila with Apache License 2.0 6 votes vote down vote up
def isotime(at=None, subsecond=False):
    """Stringify time in ISO 8601 format."""

    # Python provides a similar instance method for datetime.datetime objects
    # called isoformat(). The format of the strings generated by isoformat()
    # have a couple of problems:
    # 1) The strings generated by isotime are used in tokens and other public
    #    APIs that we can't change without a deprecation period. The strings
    #    generated by isoformat are not the same format, so we can't just
    #    change to it.
    # 2) The strings generated by isoformat do not include the microseconds if
    #    the value happens to be 0. This will likely show up as random failures
    #    as parsers may be written to always expect microseconds, and it will
    #    parse correctly most of the time.

    if not at:
        at = timeutils.utcnow()
    st = at.strftime(_ISO8601_TIME_FORMAT
                     if not subsecond
                     else _ISO8601_TIME_FORMAT_SUBSECOND)
    tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
    # Need to handle either iso8601 or python UTC format
    st += ('Z' if tz in ['UTC', 'UTC+00:00'] else tz)
    return st 
Example #15
Source File: heartbeat_emitter.py    From designate with Apache License 2.0 6 votes vote down vote up
def _emit_heartbeat(self):
        """
        Returns Status, Stats, Capabilities
        """
        status, stats, capabilities = self.get_status()

        service_status = objects.ServiceStatus(
            service_name=self._service_name,
            hostname=self._hostname,
            status=status,
            stats=stats,
            capabilities=capabilities,
            heartbeated_at=timeutils.utcnow()
        )

        LOG.trace('Emitting %s', service_status)

        self.transmit(service_status) 
Example #16
Source File: lib.py    From networking-l2gw with Apache License 2.0 6 votes vote down vote up
def add_pending_ucast_mac_remote(context, operation,
                                 ovsdb_identifier,
                                 logical_switch_id,
                                 physical_locator,
                                 mac_remotes):
    """Insert a pending ucast_mac_remote (insert/update/delete)."""
    session = context.session
    with session.begin(subtransactions=True):
        for mac in mac_remotes:
            pending_mac = models.PendingUcastMacsRemote(
                uuid=mac.get('uuid', None),
                mac=mac['mac'],
                logical_switch_uuid=logical_switch_id,
                vm_ip=mac['ip_address'],
                ovsdb_identifier=ovsdb_identifier,
                operation=operation,
                timestamp=timeutils.utcnow())
            if physical_locator:
                pending_mac['dst_ip'] = physical_locator.get('dst_ip', None)
                pending_mac['locator_uuid'] = physical_locator.get('uuid',
                                                                   None)
            session.add(pending_mac) 
Example #17
Source File: api.py    From magnum with Apache License 2.0 6 votes vote down vote up
def update_magnum_service(self, magnum_service_id, values):
        session = get_session()
        with session.begin():
            query = model_query(models.MagnumService, session=session)
            query = add_identity_filter(query, magnum_service_id)
            try:
                ref = query.with_lockmode('update').one()
            except NoResultFound:
                raise exception.MagnumServiceNotFound(
                    magnum_service_id=magnum_service_id)

            if 'report_count' in values:
                if values['report_count'] > ref.report_count:
                    ref.last_seen_up = timeutils.utcnow()

            ref.update(values)
        return ref 
Example #18
Source File: api.py    From manila with Apache License 2.0 5 votes vote down vote up
def delete_instance(self, context, share_instance, force=False):
        policy.check_policy(context, 'share', 'delete')

        statuses = (constants.STATUS_AVAILABLE, constants.STATUS_ERROR,
                    constants.STATUS_INACTIVE)
        if not (force or share_instance['status'] in statuses):
            msg = _("Share instance status must be one of %(statuses)s") % {
                "statuses": statuses}
            raise exception.InvalidShareInstance(reason=msg)

        share_instance = self.db.share_instance_update(
            context, share_instance['id'],
            {'status': constants.STATUS_DELETING,
             'terminated_at': timeutils.utcnow()}
        )

        self.share_rpcapi.delete_share_instance(context, share_instance,
                                                force=force)

        # NOTE(u_glide): 'updated_at' timestamp is used to track last usage of
        # share server. This is required for automatic share servers cleanup
        # because we should track somehow period of time when share server
        # doesn't have shares (unused). We do this update only on share
        # deletion because share server with shares cannot be deleted, so no
        # need to do this update on share creation or any other share operation
        if share_instance['share_server_id']:
            self.db.share_server_update(
                context,
                share_instance['share_server_id'],
                {'updated_at': timeutils.utcnow()}) 
Example #19
Source File: test_servicegroup.py    From magnum with Apache License 2.0 5 votes vote down vote up
def test_service_is_up_down_with_old_update(self):
        kwarg = {'last_seen_up': datetime.datetime(1970, 1, 1,
                                                   tzinfo=pytz.UTC),
                 'created_at': timeutils.utcnow(True),
                 'updated_at': timeutils.utcnow(True)}
        magnum_object = obj_util.get_test_magnum_service_object(
            self.context, **kwarg)
        is_up = self.servicegroup_api.service_is_up(magnum_object)
        self.assertFalse(is_up) 
Example #20
Source File: test_servicegroup.py    From magnum with Apache License 2.0 5 votes vote down vote up
def test_service_is_up_alive_with_all_three(self):
        kwarg = {'created_at': timeutils.utcnow(True),
                 'updated_at': timeutils.utcnow(True),
                 'last_seen_up': timeutils.utcnow(True)}
        magnum_object = obj_util.get_test_magnum_service_object(
            self.context, **kwarg)
        is_up = self.servicegroup_api.service_is_up(magnum_object)
        self.assertTrue(is_up) 
Example #21
Source File: test_servicegroup.py    From magnum with Apache License 2.0 5 votes vote down vote up
def test_service_is_up_alive_with_updated(self):
        kwarg = {'updated_at': timeutils.utcnow(True)}
        magnum_object = obj_util.get_test_magnum_service_object(
            self.context, **kwarg)
        is_up = self.servicegroup_api.service_is_up(magnum_object)
        self.assertTrue(is_up) 
Example #22
Source File: test_servicegroup.py    From magnum with Apache License 2.0 5 votes vote down vote up
def test_service_is_up_alive_with_created(self):
        kwarg = {'created_at': timeutils.utcnow(True)}
        magnum_object = obj_util.get_test_magnum_service_object(
            self.context, **kwarg)
        is_up = self.servicegroup_api.service_is_up(magnum_object)
        self.assertTrue(is_up) 
Example #23
Source File: test_api.py    From manila with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        super(ShareAPITestCase, self).setUp()
        self.context = context.get_admin_context()
        self.scheduler_rpcapi = mock.Mock()
        self.share_rpcapi = mock.Mock()
        self.api = share.API()
        self.mock_object(self.api, 'scheduler_rpcapi', self.scheduler_rpcapi)
        self.mock_object(self.api, 'share_rpcapi', self.share_rpcapi)
        self.mock_object(quota.QUOTAS, 'reserve',
                         lambda *args, **kwargs: None)

        self.dt_utc = datetime.datetime.utcnow()
        self.mock_object(timeutils, 'utcnow',
                         mock.Mock(return_value=self.dt_utc))
        self.mock_object(share_api.policy, 'check_policy') 
Example #24
Source File: test_servicegroup.py    From magnum with Apache License 2.0 5 votes vote down vote up
def test_service_is_up_alive(self):
        kwarg = {'last_seen_up': timeutils.utcnow(True)}
        magnum_object = obj_util.get_test_magnum_service_object(
            self.context, **kwarg)
        is_up = self.servicegroup_api.service_is_up(magnum_object)
        self.assertTrue(is_up) 
Example #25
Source File: baymodel.py    From magnum with Apache License 2.0 5 votes vote down vote up
def sample(cls):
        sample = cls(
            uuid='27e3153e-d5bf-4b7e-b517-fb518e17f34c',
            name='example',
            image_id='Fedora-k8s',
            flavor_id='m1.small',
            master_flavor_id='m1.small',
            dns_nameserver='8.8.1.1',
            keypair_id='keypair1',
            external_network_id='ffc44e4a-2319-4062-bce0-9ae1c38b05ba',
            fixed_network='private',
            fixed_subnet='private-subnet',
            network_driver='libnetwork',
            volume_driver='cinder',
            apiserver_port=8080,
            docker_volume_size=25,
            docker_storage_driver='devicemapper',
            cluster_distro='fedora-atomic',
            coe=fields.ClusterType.KUBERNETES,
            http_proxy='http://proxy.com:123',
            https_proxy='https://proxy.com:123',
            no_proxy='192.168.0.1,192.168.0.2,192.168.0.3',
            labels={'key1': 'val1', 'key2': 'val2'},
            server_type='vm',
            insecure_registry='10.238.100.100:5000',
            created_at=timeutils.utcnow(),
            updated_at=timeutils.utcnow(),
            public=False,
            master_lb_enabled=False,
            floating_ip_enabled=True,
            hidden=False,
        )
        return cls._convert_with_links(sample, 'http://localhost:9511') 
Example #26
Source File: cluster_template.py    From magnum with Apache License 2.0 5 votes vote down vote up
def sample(cls):
        sample = cls(
            uuid='27e3153e-d5bf-4b7e-b517-fb518e17f34c',
            name='example',
            image_id='Fedora-k8s',
            flavor_id='m1.small',
            master_flavor_id='m1.small',
            dns_nameserver='8.8.1.1',
            keypair_id='keypair1',
            external_network_id='ffc44e4a-2319-4062-bce0-9ae1c38b05ba',
            fixed_network='private',
            fixed_subnet='private-subnet',
            network_driver='libnetwork',
            volume_driver='cinder',
            apiserver_port=8080,
            docker_volume_size=25,
            docker_storage_driver='devicemapper',
            cluster_distro='fedora-atomic',
            coe=fields.ClusterType.KUBERNETES,
            http_proxy='http://proxy.com:123',
            https_proxy='https://proxy.com:123',
            no_proxy='192.168.0.1,192.168.0.2,192.168.0.3',
            labels={'key1': 'val1', 'key2': 'val2'},
            server_type='vm',
            insecure_registry='10.238.100.100:5000',
            created_at=timeutils.utcnow(),
            updated_at=timeutils.utcnow(),
            public=False,
            master_lb_enabled=False,
            floating_ip_enabled=True,
            hidden=False)
        return cls._convert_with_links(sample, 'http://localhost:9511') 
Example #27
Source File: certificate.py    From magnum with Apache License 2.0 5 votes vote down vote up
def sample(cls, expand=True):
        sample = cls(bay_uuid='7ae81bb3-dec3-4289-8d6c-da80bd8001ae',
                     cluster_uuid='7ae81bb3-dec3-4289-8d6c-da80bd8001ae',
                     created_at=timeutils.utcnow(),
                     csr='AAA....AAA')
        return cls._convert_with_links(sample, 'http://localhost:9511', expand) 
Example #28
Source File: cluster.py    From magnum with Apache License 2.0 5 votes vote down vote up
def sample(cls, expand=True):
        temp_id = '4a96ac4b-2447-43f1-8ca6-9fd6f36d146d'
        sample = cls(uuid='27e3153e-d5bf-4b7e-b517-fb518e17f34c',
                     name='example',
                     cluster_template_id=temp_id,
                     keypair=None,
                     node_count=2,
                     master_count=1,
                     docker_volume_size=1,
                     labels={},
                     master_flavor_id='m1.small',
                     flavor_id='m1.small',
                     create_timeout=15,
                     stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63',
                     status=fields.ClusterStatus.CREATE_COMPLETE,
                     status_reason="CREATE completed successfully",
                     health_status=fields.ClusterHealthStatus.HEALTHY,
                     health_status_reason={"api": "ok",
                                           "node-0.Ready": 'True'},
                     api_address='172.24.4.3',
                     node_addresses=['172.24.4.4', '172.24.4.5'],
                     created_at=timeutils.utcnow(),
                     updated_at=timeutils.utcnow(),
                     coe_version=None,
                     container_version=None,
                     fixed_network=None,
                     fixed_subnet=None,
                     floating_ip_enabled=True)
        return cls._convert_with_links(sample, 'http://localhost:9511', expand) 
Example #29
Source File: test_api.py    From manila with Apache License 2.0 5 votes vote down vote up
def test_unmanage_share_server(self):
        shr1 = {}
        share_server = db_utils.create_share_server(**shr1)
        update_data = {'status': constants.STATUS_UNMANAGING,
                       'terminated_at': timeutils.utcnow()}

        mock_share_instances_get_all = self.mock_object(
            db_api, 'share_instances_get_all_by_share_server',
            mock.Mock(return_value={}))
        mock_share_group_get_all = self.mock_object(
            db_api, 'share_group_get_all_by_share_server',
            mock.Mock(return_value={}))
        mock_share_server_update = self.mock_object(
            db_api, 'share_server_update',
            mock.Mock(return_value=share_server))

        mock_rpc = self.mock_object(
            self.api.share_rpcapi, 'unmanage_share_server')

        self.api.unmanage_share_server(self.context, share_server, True)

        mock_share_instances_get_all.assert_called_once_with(
            self.context, share_server['id']
        )
        mock_share_group_get_all.assert_called_once_with(
            self.context, share_server['id']
        )
        mock_share_server_update.assert_called_once_with(
            self.context, share_server['id'], update_data
        )

        mock_rpc.assert_called_once_with(
            self.context, share_server, force=True) 
Example #30
Source File: driver.py    From manila with Apache License 2.0 5 votes vote down vote up
def _get_replication_snapshot_tag(self, replica):
        """Returns replica- and time-based snapshot tag."""
        current_time = timeutils.utcnow().isoformat()
        snapshot_tag = "%s_time_%s" % (
            self._get_replication_snapshot_prefix(replica), current_time)
        return snapshot_tag