コード例 #1
0
ファイル: test_db.py プロジェクト: tomegathericon/manila
 def test_share_server_delete_with_details(self):
     server = self._create_share_server()
     details = {
         'value1': '1',
         'value2': '2',
     }
     db.share_server_backend_details_set(self.ctxt, server['id'], details)
     num_records = len(db.share_server_get_all(self.ctxt))
     db.share_server_delete(self.ctxt, server['id'])
     self.assertEqual(len(db.share_server_get_all(self.ctxt)),
                      num_records - 1)
コード例 #2
0
    def test_share_server_backend_details_set(self):
        details = {
            'value1': '1',
            'value2': '2',
        }
        server = self._create_share_server()
        db.share_server_backend_details_set(self.ctxt, server['id'], details)

        self.assertDictMatch(
            details,
            db.share_server_backend_details_get(self.ctxt, server['id']))
コード例 #3
0
ファイル: test_share.py プロジェクト: mbr4v0v/manila
 def _create_share_server(state='new', share_network_id=None, host=None):
     """Create a share server object."""
     srv = {}
     srv['host'] = host
     srv['share_network_id'] = share_network_id
     srv['status'] = state
     share_srv = db.share_server_create(context.get_admin_context(), srv)
     backend_details = {'fake': 'fake'}
     db.share_server_backend_details_set(context.get_admin_context(),
                                         share_srv['id'], backend_details)
     return db.share_server_get(context.get_admin_context(),
                                share_srv['id'])
コード例 #4
0
ファイル: test_db.py プロジェクト: tomegathericon/manila
    def test_share_server_backend_details_set(self):
        details = {
            'value1': '1',
            'value2': '2',
        }
        server = self._create_share_server()
        db.share_server_backend_details_set(self.ctxt, server['id'], details)

        self.assertDictMatch(
            details,
            db.share_server_get(self.ctxt, server['id'])['backend_details']
        )
コード例 #5
0
ファイル: db_utils.py プロジェクト: bopopescu/OpenStack-Ocata
def create_share_server(**kwargs):
    """Create a share server object."""
    backend_details = kwargs.pop('backend_details', {})
    srv = {
        'host': 'host1',
        'share_network_id': 'fake_srv_id',
        'status': constants.STATUS_ACTIVE
    }
    share_srv = _create_db_row(db.share_server_create, srv, kwargs)
    if backend_details:
        db.share_server_backend_details_set(context.get_admin_context(),
                                            share_srv['id'], backend_details)
    return db.share_server_get(context.get_admin_context(), share_srv['id'])
コード例 #6
0
 def test_share_server_delete_with_details(self):
     server = self._create_share_server()
     details = {
         'value1': '1',
         'value2': '2',
     }
     db.share_server_backend_details_set(self.ctxt, server['id'], details)
     num_records = len(db.share_server_get_all(self.ctxt))
     db.share_server_delete(self.ctxt, server['id'])
     self.assertEqual(len(db.share_server_get_all(self.ctxt)),
                      num_records - 1)
     self.assertFalse(
         db.share_server_backend_details_get(self.ctxt, server['id']))
コード例 #7
0
ファイル: test_share.py プロジェクト: grafuls/manila
 def _create_share_server(state='ACTIVE', share_network_id=None, host=None):
     """Create a share server object."""
     srv = {}
     srv['host'] = host
     srv['share_network_id'] = share_network_id
     srv['status'] = state
     share_srv = db.share_server_create(context.get_admin_context(), srv)
     backend_details = {'fake': 'fake'}
     db.share_server_backend_details_set(context.get_admin_context(),
                                         share_srv['id'],
                                         backend_details)
     return db.share_server_get(context.get_admin_context(),
                                share_srv['id'])
コード例 #8
0
ファイル: db_utils.py プロジェクト: vponomaryov/manila
def create_share_server(**kwargs):
    """Create a share server object."""
    backend_details = kwargs.pop('backend_details', {})
    srv = {
        'host': 'host1',
        'share_network_id': 'fake_srv_id',
        'status': constants.STATUS_ACTIVE
    }
    share_srv = _create_db_row(db.share_server_create, srv, kwargs)
    if backend_details:
        db.share_server_backend_details_set(
            context.get_admin_context(), share_srv['id'], backend_details)
    return db.share_server_get(context.get_admin_context(),
                               share_srv['id'])
コード例 #9
0
 def test_share_server_get_with_details(self):
     values = {
         'share_network_id': 'fake-share-net-id',
         'host': 'hostname',
         'status': 'ACTIVE'
     }
     details = {
         'value1': '1',
         'value2': '2',
     }
     srv_id = self._create_share_server(values)['id']
     db.share_server_backend_details_set(self.ctxt, srv_id, details)
     server = db.share_server_get(self.ctxt, srv_id)
     self.assertEqual(srv_id, server['id'])
     self.assertEqual(server.share_network_id, values['share_network_id'])
     self.assertEqual(server.host, values['host'])
     self.assertEqual(server.status, values['status'])
     self.assertDictMatch(details, server['backend_details'])
コード例 #10
0
 def test_share_server_get_with_details(self):
     values = {
         'share_network_id': 'fake-share-net-id',
         'host': 'hostname',
         'status': 'ACTIVE'
     }
     details = {
         'value1': '1',
         'value2': '2',
     }
     srv_id = self._create_share_server(values)['id']
     db.share_server_backend_details_set(self.ctxt, srv_id, details)
     server = db.share_server_get(self.ctxt, srv_id)
     self.assertEqual(srv_id, server['id'])
     self.assertEqual(server.share_network_id, values['share_network_id'])
     self.assertEqual(server.host, values['host'])
     self.assertEqual(server.status, values['status'])
     self.assertDictMatch(details, server['backend_details'])