当前位置: 首页>>代码示例>>Python>>正文


Python base.reflect_db_metadata函数代码示例

本文整理汇总了Python中nailgun.test.base.reflect_db_metadata函数的典型用法代码示例。如果您正苦于以下问题:Python reflect_db_metadata函数的具体用法?Python reflect_db_metadata怎么用?Python reflect_db_metadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reflect_db_metadata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare

def prepare():
    meta = base.reflect_db_metadata()

    result = db.execute(
        meta.tables['releases'].insert(),
        [{
            'name': 'test_name',
            'version': '2015.1-8.0',
            'operating_system': 'ubuntu',
            'state': 'available',
            'networks_metadata': jsonutils.dumps({
                'neutron': {
                    'networks': [],
                    'config': {}
                }
            })
        }]
    )
    releaseid = result.inserted_primary_key[0]

    db.execute(
        meta.tables['clusters'].insert(),
        [{
            'name': 'test_env',
            'release_id': releaseid,
            'mode': 'ha_compact',
            'status': 'new',
            'net_provider': 'neutron',
            'grouping': 'roles',
            'fuel_version': '8.0',
            'deployment_tasks': '[]',
            'replaced_deployment_info': '{}'
        }])

    db.commit()
开发者ID:ekorekin,项目名称:fuel-web,代码行数:35,代码来源:test_migration_fuel_9_0_1.py

示例2: prepare

def prepare():
    meta = base.reflect_db_metadata()

    result = db.execute(
        meta.tables['releases'].insert(),
        [{
            'name': 'test_name',
            'version': '2015.1-10.0',
            'operating_system': 'ubuntu',
            'state': 'available',
            'deployment_tasks': '{}',
            'roles': '{}',
            'roles_metadata': '{}',
            'is_deployable': True,
            'required_component_types': ['network', 'storage']
        }]
    )

    release_id = result.inserted_primary_key[0]

    result = db.execute(
        meta.tables['clusters'].insert(),
        [{
            'name': 'test',
            'release_id': release_id,
            'mode': 'ha_compact',
            'status': 'new',
            'net_provider': 'neutron',
            'grouping': 'roles',
            'fuel_version': '10.0',
        }]
    )
    cluster_id = result.inserted_primary_key[0]

    TestPluginLinksConstraints.prepare(meta, cluster_id)
开发者ID:sebrandon1,项目名称:fuel-web,代码行数:35,代码来源:test_downgrade_fuel_10_0.py

示例3: test_set_attributes

    def test_set_attributes(self):
        meta = base.reflect_db_metadata()
        bond_config = self.env.get_default_plugin_bond_config()
        self.env.create_plugin(
            name='plugin_a_with_bond_attributes',
            package_version='5.0.0',
            bond_attributes_metadata=bond_config)
        cluster = self._create_test_cluster(
            nodes=[{'roles': ['controller']}])

        bond_config.update({
            'type__': {'value': consts.BOND_TYPES.linux},
            'mode': {'value': {'value': consts.BOND_MODES.balance_rr}}})
        for node in cluster.nodes:
            nic_names = [iface.name for iface in node.nic_interfaces]
            self.env.make_bond_via_api(
                'lnx_bond', '', nic_names, node.id, attrs=bond_config)

        node_bond_interface_cluster_plugin = self.db.execute(
            meta.tables['node_bond_interface_cluster_plugins'].select()
        ).fetchall()[0]

        _id = node_bond_interface_cluster_plugin.id
        attributes = {'test_attr': 'a'}
        NodeBondInterfaceClusterPlugin.set_attributes(_id, attributes)

        node_bond_interface_cluster_plugin = self.db.execute(
            meta.tables['node_bond_interface_cluster_plugins'].select()
        ).fetchall()[0]

        self.assertDictEqual(
            attributes,
            jsonutils.loads(node_bond_interface_cluster_plugin[1]))
开发者ID:openstack,项目名称:fuel-web,代码行数:33,代码来源:test_object_plugin.py

示例4: prepare

def prepare():
    meta = base.reflect_db_metadata()

    releaseid = insert_table_row(
        meta.tables["releases"],
        {"name": "test_name", "version": "2014.2.2-6.1", "operating_system": "ubuntu", "state": "available"},
    )

    clusterid = insert_table_row(
        meta.tables["clusters"],
        {
            "name": "test_env",
            "release_id": releaseid,
            "mode": "ha_compact",
            "status": "new",
            "net_provider": "neutron",
            "grouping": "roles",
            "fuel_version": "6.1",
        },
    )

    db.execute(
        meta.tables["nodegroups"].insert(),
        [
            {"cluster_id": clusterid, "name": "test_nodegroup_a"},
            {"cluster_id": clusterid, "name": "test_nodegroup_a"},
            {"cluster_id": clusterid, "name": "test_nodegroup_b"},
            {"cluster_id": clusterid, "name": "test_nodegroup_b"},
        ],
    )

    db.commit()
开发者ID:ibelikov,项目名称:fuel-web,代码行数:32,代码来源:test_migration_fuel_8_0.py

示例5: test_add_nodes_for_cluster_plugin_with_empty_attributes

    def test_add_nodes_for_cluster_plugin_with_empty_attributes(self):
        meta = base.reflect_db_metadata()
        self.env.create_node(
            cluster_id=self.cluster.id,
            roles=['compute']
        )
        plugin = Plugin.create({
            'name': 'plugin_a_with_node_attributes',
            'title': 'Test Plugin',
            'package_version': '5.0.0',
            'version': '1.0.0',
            'node_attributes_metadata': {}
        })
        cluster_plugin = ClusterPlugin.create({
            'cluster_id': self.cluster.id,
            'plugin_id': plugin.id,
            'enabled': False,
            'attributes': plugin.node_attributes_metadata
        })

        NodeClusterPlugin.add_nodes_for_cluster_plugin(cluster_plugin)

        node_cluster_plugins = self.db.execute(
            meta.tables['node_cluster_plugins'].select()
        ).fetchall()
        self.assertEqual(0, len(node_cluster_plugins))
开发者ID:openstack,项目名称:fuel-web,代码行数:26,代码来源:test_object_plugin.py

示例6: test_add_cluster_plugin_for_node_bond

    def test_add_cluster_plugin_for_node_bond(self):
        meta = base.reflect_db_metadata()
        plugin_bond_config = self.env.get_default_plugin_bond_config()
        self.env.create_plugin(
            name='plugin_a_with_bond_attributes',
            package_version='5.0.0',
            bond_attributes_metadata=plugin_bond_config)
        self.env.create_plugin(
            name='plugin_b_with_bond_attributes',
            package_version='5.0.0',
            bond_attributes_metadata={})
        cluster = self._create_test_cluster(
            nodes=[{'roles': ['controller']}, {'roles': ['compute']}])
        bond_config = {
            'type__': {'value': consts.BOND_TYPES.linux},
            'mode': {'value': {'value': consts.BOND_MODES.balance_rr}}}
        for node in cluster.nodes:
            nic_names = [iface.name for iface in node.nic_interfaces]
            self.env.make_bond_via_api(
                'lnx_bond', '', nic_names, node.id, attrs=bond_config)

        node_bond_interface_cluster_plugins = self.db.execute(
            meta.tables['node_bond_interface_cluster_plugins'].select()
        ).fetchall()

        self.assertEqual(2, len(node_bond_interface_cluster_plugins))
        for item in node_bond_interface_cluster_plugins:
            self.assertDictEqual(
                plugin_bond_config, jsonutils.loads(item.attributes))
开发者ID:openstack,项目名称:fuel-web,代码行数:29,代码来源:test_object_plugin.py

示例7: get_master_node_settings

def get_master_node_settings():
    meta = base.reflect_db_metadata()
    master_node_settings_table = meta.tables['master_node_settings']

    settings = db.execute(sa.select(
        [master_node_settings_table.c.settings])).scalar()
    db().commit()
    return settings
开发者ID:ansumanbebarta,项目名称:fuel-web,代码行数:8,代码来源:test_migration_fuel_8_0.py

示例8: test_connect_to_cluster

 def test_connect_to_cluster(self):
     meta = base.reflect_db_metadata()
     self._create_test_plugins()
     self._create_test_cluster()
     cluster_plugins = self.db.execute(
         meta.tables['cluster_plugins'].select()
     ).fetchall()
     self.assertEqual(len(cluster_plugins), 5)
开发者ID:vangogh-ken,项目名称:fuel-web,代码行数:8,代码来源:test_object_plugin.py

示例9: prepare

def prepare():
    meta = base.reflect_db_metadata()
    db.execute(
        meta.tables['releases'].insert(),
        [{
            'name': 'test_name',
            'version': '2015.1-8.0',
            'operating_system': 'ubuntu',
            'state': 'available',
            'networks_metadata': jsonutils.dumps({
                'neutron': {
                    'networks': [],
                    'config': {}
                }
            }),
            'volumes_metadata': jsonutils.dumps({})
        }])

    db.execute(
        meta.tables['nodes'].insert(),
        [{
            'uuid': '26b508d0-0d76-4159-bce9-f67ec2765480',
            'cluster_id': None,
            'group_id': None,
            'status': 'discover',
            'meta': '{}',
            'mac': 'aa:aa:aa:aa:aa:aa',
            'timestamp': datetime.datetime.utcnow(),
        }]
    )

    db.execute(
        meta.tables['tasks'].insert(),
        [
            {
                'id': 55,
                'uuid': '219eaafe-01a1-4f26-8edc-b9d9b0df06b3',
                'name': 'deployment',
                'status': 'running',
                'deployment_info': jsonutils.dumps({})
            },
        ]
    )
    db.execute(
        meta.tables['deployment_history'].insert(),
        [
            {
                'uuid': 'fake_uuid_0',
                'deployment_graph_task_name': 'fake',
                'node_id': 'fake_node_id',
                'task_id': 55,
                'status': 'pending',
                'summary': jsonutils.dumps({'fake': 'fake'}),
            }
        ]
    )

    db.commit()
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:58,代码来源:test_migration_fuel_9_0_2.py

示例10: test_set_plugin_attributes

    def test_set_plugin_attributes(self):
        meta = base.reflect_db_metadata()
        self._create_test_plugins()
        cluster = self._create_test_cluster()

        plugin = ClusterPlugin.get_connected_plugins(cluster).first()
        ClusterPlugin.set_attributes(cluster.id, plugin.id, enabled=True)

        columns = meta.tables["cluster_plugins"].c
        enabled = self.db.execute(
            sa.select([columns.enabled]).where(columns.cluster_id == cluster.id).where(columns.plugin_id == plugin.id)
        ).fetchone()
        self.assertTrue(enabled[0])
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:13,代码来源:test_object_plugin.py

示例11: prepare

def prepare():
    meta = base.reflect_db_metadata()

    # Fill in migration table with data
    db.execute(
        meta.tables[extensions_migration_buffer_table_name].insert(),
        [{'extension_name': 'volume_manager',
          'data': jsonutils.dumps({'node_id': 1, 'volumes': [{'volume': 1}]})},
         {'extension_name': 'volume_manager',
          'data': jsonutils.dumps({'node_id': 2, 'volumes': [{'volume': 2}]})},
         {'extension_name': 'some_different_extension',
          'data': 'some_data'}])

    db.commit()
开发者ID:ekorekin,项目名称:fuel-web,代码行数:14,代码来源:test_migration_volume_manager_extension_001_add_volumes_table.py

示例12: test_populate_nic_with_empty_plugin_attributes

    def test_populate_nic_with_empty_plugin_attributes(self):
        # create cluster with 2 nodes
        # install plugin without nic attributes which compatible with cluster
        meta = base.reflect_db_metadata()
        self._create_test_cluster(
            nodes=[{'roles': ['controller']}, {'roles': ['compute']}])
        self.env.create_plugin(
            name='plugin_b_with_nic_attributes',
            package_version='5.0.0',
            nic_attributes_metadata={})

        node_nic_interface_cluster_plugins = self.db.execute(
            meta.tables['node_nic_interface_cluster_plugins'].select()
        ).fetchall()

        self.assertEqual(0, len(node_nic_interface_cluster_plugins))
开发者ID:openstack,项目名称:fuel-web,代码行数:16,代码来源:test_object_plugin.py

示例13: prepare

def prepare():
    meta = base.reflect_db_metadata()
    db.execute(
        meta.tables['releases'].insert(),
        [{
            'name': 'test_name',
            'version': '2015.1-8.0',
            'operating_system': 'ubuntu',
            'state': 'available',
            'networks_metadata': jsonutils.dumps({
                'neutron': {
                    'networks': [],
                    'config': {}
                }
            }),
            'volumes_metadata': jsonutils.dumps({})
        }])
    db.commit()
开发者ID:pod2metra,项目名称:fuel-web,代码行数:18,代码来源:test_migration_fuel_9_0_2.py

示例14: test_populate_nic_with_plugin_attributes

    def test_populate_nic_with_plugin_attributes(self):
        # create cluster with 2 nodes
        # install plugin with nic attributes which compatible with cluster
        meta = base.reflect_db_metadata()
        nic_config = self.env.get_default_plugin_nic_config()
        self._create_test_cluster(
            nodes=[{'roles': ['controller']}, {'roles': ['compute']}])
        self.env.create_plugin(
            name='plugin_a_with_nic_attributes',
            package_version='5.0.0',
            nic_attributes_metadata=nic_config)

        node_nic_interface_cluster_plugins = self.db.execute(
            meta.tables['node_nic_interface_cluster_plugins'].select()
        ).fetchall()

        self.assertEqual(4, len(node_nic_interface_cluster_plugins))
        for item in node_nic_interface_cluster_plugins:
            self.assertDictEqual(nic_config, jsonutils.loads(item.attributes))
开发者ID:openstack,项目名称:fuel-web,代码行数:19,代码来源:test_object_plugin.py

示例15: prepare

def prepare():
    meta = base.reflect_db_metadata()

    roles_metadata = jsonutils.dumps({
        "mongo": {
            "name": "Mongo",
            "description": "Mongo role"
        }
    })

    result = db.execute(
        meta.tables['releases'].insert(),
        [{
            'name': 'test_name',
            'version': '2014.2-6.0',
            'operating_system': 'ubuntu',
            'state': 'available',
            'roles_metadata': roles_metadata,
            'attributes_metadata': jsonutils.dumps({
                'editable': {
                    'storage': {
                        'volumes_lvm': {},
                    },
                    'common': {},
                },
                'generated': {
                    'cobbler': {'profile': {
                        'generator_arg': 'ubuntu_1204_x86_64'}}},
            }),
            'networks_metadata': jsonutils.dumps({
                'neutron': {
                    'networks': [
                        {
                            'assign_vip': True,
                        },
                    ]
                },
                'nova_network': {
                    'networks': [
                        {
                            'assign_vip': False,
                        },
                    ]
                },

            }),
            'is_deployable': True,
        }])
    releaseid = result.inserted_primary_key[0]

    result = db.execute(
        meta.tables['release_orchestrator_data'].insert(),
        [{
            'release_id': releaseid,
            'puppet_manifests_source': 'rsync://0.0.0.0:/puppet/manifests',
            'puppet_modules_source': 'rsync://0.0.0.0:/puppet/modules',
            'repo_metadata': jsonutils.dumps({
                'base': 'http://baseuri base-suite main',
                'test': 'http://testuri test-suite main',
            })
        }])

    result = db.execute(
        meta.tables['clusters'].insert(),
        [{
            'name': 'test_env',
            'release_id': releaseid,
            'mode': 'ha_compact',
            'status': 'new',
            'net_provider': 'neutron',
            'grouping': 'roles',
            'fuel_version': '6.0',
        }])
    clusterid = result.inserted_primary_key[0]

    db.execute(
        meta.tables['attributes'].insert(),
        [{
            'cluster_id': clusterid,
            'editable': '{"common": {}}',
            'generated': '{"cobbler": {"profile": "ubuntu_1204_x86_64"}}',
        }])

    db.execute(
        meta.tables['ip_addrs'].insert(),
        [{
            'ip_addr': '192.168.0.2',
        }])

    db.execute(
        meta.tables['network_groups'].insert(),
        [{
            'name': 'public',
            'release': releaseid,
            'meta': jsonutils.dumps({'assign_vip': True})
        }])

    db.commit()
开发者ID:SmartInfrastructures,项目名称:fuel-web-dev,代码行数:98,代码来源:test_migration_fuel_6_1.py


注:本文中的nailgun.test.base.reflect_db_metadata函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。