Example #1
0
def create_node(ctx, cluster, profile, **kwargs):
    if cluster:
        cluster_id = cluster.id
        index = db_api.cluster_next_index(ctx, cluster_id)
    else:
        cluster_id = ''
        index = -1

    values = {
        'name': 'test_node_name',
        'physical_id': UUID1,
        'cluster_id': cluster_id,
        'profile_id': profile.id,
        'project': ctx.project,
        'index': index,
        'role': None,
        'created_at': None,
        'updated_at': None,
        'status': 'ACTIVE',
        'status_reason': 'create complete',
        'meta_data': jsonutils.loads('{"foo": "123"}'),
        'data': jsonutils.loads('{"key1": "value1"}'),
    }
    values.update(kwargs)
    return db_api.node_create(ctx, values)
Example #2
0
def create_node(ctx, cluster, profile, **kwargs):
    if cluster:
        cluster_id = cluster.id
        index = db_api.cluster_next_index(ctx, cluster_id)
    else:
        cluster_id = ''
        index = -1

    values = {
        'name': 'test_node_name',
        'physical_id': UUID1,
        'cluster_id': cluster_id,
        'profile_id': profile.id,
        'project': ctx.project,
        'index': index,
        'role': None,
        'created_at': None,
        'updated_at': None,
        'status': 'ACTIVE',
        'status_reason': 'create complete',
        'meta_data': jsonutils.loads('{"foo": "123"}'),
        'data': jsonutils.loads('{"key1": "value1"}'),
    }
    values.update(kwargs)
    return db_api.node_create(ctx, values)
Example #3
0
 def _create_nodes(self, cluster_id, profile_id, count):
     nodes = []
     for i in range(count):
         values = {
             'id': 'FAKE_NODE_%s_%s' % (profile_id, (i + 1)),
             'name': 'test_node_%s' % (i + 1),
             'physical_id': 'FAKE_PHY_ID_%s' % (i + 1),
             'cluster_id': cluster_id,
             'profile_id': profile_id,
             'project': self.context.project,
             'index': i + 1,
             'role': None,
             'created_time': timeutils.utcnow(),
             'updated_time': None,
             'deleted_time': None,
             'status': 'ACTIVE',
             'status_reason': 'create complete',
             'metadata': {
                 'foo': '123'
             },
             'data': {
                 'key1': 'value1'
             },
         }
         db_node = db_api.node_create(self.context, values)
         nodes.append(six.text_type(db_node.id))
     return nodes
Example #4
0
 def _create_node(self, node_id):
     values = {
         'id': node_id,
         'profile_id': self.profile.id,
         'cluster_id': self.cluster.id,
         'project': self.context.project,
         'name': 'node1',
         'role': 'test_node',
         }
     return db_api.node_create(self.context, values)
Example #5
0
 def _create_node(self, node_id):
     values = {
         'id': node_id,
         'profile_id': self.profile.id,
         'cluster_id': self.cluster.id,
         'project': self.context.project,
         'name': 'node1',
         'role': 'test_node',
     }
     return db_api.node_create(self.context, values)
Example #6
0
def create_node(ctx, cluster, profile, **kwargs):
    values = {
        'name': 'test_node_name',
        'physical_id': UUID1,
        'cluster_id': cluster.id if cluster else None,
        'profile_id': profile.id,
        'project': ctx.tenant_id,
        'index': 0,
        'role': None,
        'created_time': None,
        'updated_time': None,
        'deleted_time': None,
        'status': 'ACTIVE',
        'status_reason': 'create complete',
        'tags': json.loads('{"foo": "123"}'),
        'data': json.loads('{"key1": "value1"}'),
    }
    values.update(kwargs)
    return db_api.node_create(ctx, values)
Example #7
0
 def _create_nodes(self, cluster_id, profile_id, count):
     nodes = []
     for i in range(count):
         values = {
             'id': 'FAKE_NODE_%s_%s' % (profile_id, (i + 1)),
             'name': 'test_node_%s' % (i + 1),
             'physical_id': 'FAKE_PHY_ID_%s' % (i + 1),
             'cluster_id': cluster_id,
             'profile_id': profile_id,
             'project': self.context.project,
             'index': i + 1,
             'role': None,
             'created_at': timeutils.utcnow(),
             'updated_at': None,
             'status': 'ACTIVE',
             'status_reason': 'create complete',
             'metadata': {'foo': '123'},
             'data': {'key1': 'value1'},
         }
         db_node = db_api.node_create(self.context, values)
         nodes.append(six.text_type(db_node.id))
     return nodes