コード例 #1
0
ファイル: shares.py プロジェクト: sharkconi/manila
    def update(self, req, id, body):
        """Update a share."""
        context = req.environ['manila.context']

        if not body or 'share' not in body:
            raise exc.HTTPUnprocessableEntity()

        share_data = body['share']
        valid_update_keys = (
            'display_name',
            'display_description',
            'is_public',
        )

        update_dict = dict([(key, share_data[key])
                            for key in valid_update_keys
                            if key in share_data])

        try:
            share = self.share_api.get(context, id)
        except exception.NotFound:
            raise exc.HTTPNotFound()

        share = self.share_api.update(context, share, update_dict)
        share.update(update_dict)
        return self._view_builder.detail(req, share)
コード例 #2
0
ファイル: shares.py プロジェクト: stackhpc/manila
    def update(self, req, id, body):
        """Update a share."""
        context = req.environ['manila.context']

        if not body or 'share' not in body:
            raise exc.HTTPUnprocessableEntity()

        share_data = body['share']
        valid_update_keys = (
            'display_name',
            'display_description',
            'is_public',
        )

        update_dict = {
            key: share_data[key]
            for key in valid_update_keys if key in share_data
        }

        try:
            share = self.share_api.get(context, id)
        except exception.NotFound:
            raise exc.HTTPNotFound()

        share = self.share_api.update(context, share, update_dict)
        share.update(update_dict)
        return self._view_builder.detail(req, share)
コード例 #3
0
ファイル: test_share_api.py プロジェクト: aostapenko/manila
def fake_share(id, **kwargs):
    share = {
        'id': id,
        'size': 1,
        'user_id': 'fakeuser',
        'project_id': 'fakeproject',
        'snapshot_id': None,
        'availability_zone': 'fakeaz',
        'status': 'fakestatus',
        'display_name': 'fakename',
        'display_description': 'fakedesc',
        'share_proto': 'nfs',
        'export_location': 'fake_location',
        'host': 'fakehost',
        'scheduled_at': datetime.datetime(1, 1, 1, 1, 1, 1),
        'launched_at': datetime.datetime(1, 1, 1, 1, 1, 1),
        'terminated_at': datetime.datetime(1, 1, 1, 1, 1, 1)
    }
    share.update(kwargs)
    return share
コード例 #4
0
ファイル: test_share_api.py プロジェクト: resker/manila
def fake_share(id, **kwargs):
    share = {
        "id": id,
        "size": 1,
        "user_id": "fakeuser",
        "project_id": "fakeproject",
        "snapshot_id": None,
        "share_network_id": None,
        "availability_zone": "fakeaz",
        "status": "fakestatus",
        "display_name": "fakename",
        "metadata": None,
        "display_description": "fakedesc",
        "share_proto": "nfs",
        "export_location": "fake_location",
        "host": "fakehost",
        "scheduled_at": datetime.datetime(1, 1, 1, 1, 1, 1),
        "launched_at": datetime.datetime(1, 1, 1, 1, 1, 1),
        "terminated_at": datetime.datetime(1, 1, 1, 1, 1, 1),
    }
    share.update(kwargs)
    return share
コード例 #5
0
ファイル: test_api.py プロジェクト: Hussnain1/manila
def fake_share(id, **kwargs):
    share = {
        'id': id,
        'size': 1,
        'user_id': 'fakeuser',
        'project_id': 'fakeproject',
        'snapshot_id': None,
        'share_network_id': None,
        'volume_type_id': None,
        'availability_zone': 'fakeaz',
        'status': 'fakestatus',
        'display_name': 'fakename',
        'metadata': None,
        'display_description': 'fakedesc',
        'share_proto': 'nfs',
        'export_location': 'fake_location',
        'host': 'fakehost',
        'scheduled_at': datetime.datetime(1, 1, 1, 1, 1, 1),
        'launched_at': datetime.datetime(1, 1, 1, 1, 1, 1),
        'terminated_at': datetime.datetime(1, 1, 1, 1, 1, 1)
    }
    share.update(kwargs)
    return share