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


Python flavors.create函数代码示例

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


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

示例1: test_create_flavor_ephemeral_error

 def test_create_flavor_ephemeral_error(self):
     args = ("ephemeral_test", "1024", "1", "10", "9999999999")
     try:
         flavors.create(*args)
         self.fail("Be sure this will never be executed.")
     except exception.InvalidInput as e:
         self.assertIn("ephemeral", e.message)
开发者ID:375670450,项目名称:nova,代码行数:7,代码来源:test_flavors.py

示例2: test_ephemeral_gb_must_be_nonnegative_db_integer

 def test_ephemeral_gb_must_be_nonnegative_db_integer(self):
     self.assertInvalidInput('flavor1', 64, 1, 120, ephemeral_gb='foo')
     self.assertInvalidInput('flavor1', 64, 1, 120, ephemeral_gb=-1)
     self.assertInvalidInput('flavor1', 64, 1, 120,
                             ephemeral_gb=db.MAX_INT + 1)
     flavors.create('flavor1', 64, 1, 120, ephemeral_gb=0)
     flavors.create('flavor2', 64, 1, 120, ephemeral_gb=120)
开发者ID:mahak,项目名称:nova,代码行数:7,代码来源:test_flavors.py

示例3: test_swap_must_be_nonnegative_db_integer

 def test_swap_must_be_nonnegative_db_integer(self):
     self.assertInvalidInput('flavor1', 64, 1, 120, swap='foo')
     self.assertInvalidInput('flavor1', 64, 1, 120, swap=-1)
     self.assertInvalidInput('flavor1', 64, 1, 120,
                             swap=db.MAX_INT + 1)
     flavors.create('flavor1', 64, 1, 120, swap=0)
     flavors.create('flavor2', 64, 1, 120, swap=1)
开发者ID:mahak,项目名称:nova,代码行数:7,代码来源:test_flavors.py

示例4: test_add_flavor_access_already_exists

 def test_add_flavor_access_already_exists(self):
     user_id = "fake"
     project_id = "fake"
     ctxt = context.RequestContext(user_id, project_id, is_admin=True)
     flavor_id = "flavor1"
     flavors.create("some flavor", 256, 1, 120, 100, flavorid=flavor_id)
     flavors.add_flavor_access(flavor_id, project_id, ctxt=ctxt)
     self.assertRaises(exception.FlavorAccessExists, flavors.add_flavor_access, flavor_id, project_id, ctxt)
开发者ID:newgoliath,项目名称:nova,代码行数:8,代码来源:test_flavors.py

示例5: test_flavorid_populated

    def test_flavorid_populated(self):
        flavor1 = flavors.create('flavor1', 64, 1, 120)
        self.assertIsNot(None, flavor1['flavorid'])

        flavor2 = flavors.create('flavor2', 64, 1, 120, flavorid='')
        self.assertIsNot(None, flavor2['flavorid'])

        flavor3 = flavors.create('flavor3', 64, 1, 120, flavorid='foo')
        self.assertEqual('foo', flavor3['flavorid'])
开发者ID:MasterZ40,项目名称:nova,代码行数:9,代码来源:test_flavors.py

示例6: test_remove_flavor_access_doesnt_exists

 def test_remove_flavor_access_doesnt_exists(self):
     user_id = 'fake'
     project_id = 'fake'
     ctxt = context.RequestContext(user_id, project_id, is_admin=True)
     flavor_id = 'flavor1'
     flavors.create('some flavor', 256, 1, 120, 100, flavorid=flavor_id)
     self.assertRaises(exception.FlavorAccessNotFound,
                       flavors.remove_flavor_access,
                       flavor_id, project_id, ctxt=ctxt)
开发者ID:Charu-Sharma,项目名称:nova,代码行数:9,代码来源:test_flavors.py

示例7: test_flavorid_populated

    def test_flavorid_populated(self):
        flavor1 = flavors.create("flavor1", 64, 1, 120)
        self.assertIsNot(None, flavor1["flavorid"])

        flavor2 = flavors.create("flavor2", 64, 1, 120, flavorid="")
        self.assertIsNot(None, flavor2["flavorid"])

        flavor3 = flavors.create("flavor3", 64, 1, 120, flavorid="foo")
        self.assertEqual("foo", flavor3["flavorid"])
开发者ID:sdague,项目名称:nova,代码行数:9,代码来源:test_instance_types.py

示例8: test_flavorid_populated

    def test_flavorid_populated(self):
        flavor1 = flavors.create('flavor1', 64, 1, 120)
        self.assertIsNotNone(flavor1.flavorid)

        flavor2 = flavors.create('flavor2', 64, 1, 120, flavorid='')
        self.assertIsNotNone(flavor2.flavorid)

        flavor3 = flavors.create('flavor3', 64, 1, 120, flavorid='foo')
        self.assertEqual('foo', flavor3.flavorid)
开发者ID:mahak,项目名称:nova,代码行数:9,代码来源:test_flavors.py

示例9: test_rxtx_factor_must_be_positive_float

    def test_rxtx_factor_must_be_positive_float(self):
        self.assertInvalidInput("flavor1", 64, 1, 120, rxtx_factor="foo")
        self.assertInvalidInput("flavor1", 64, 1, 120, rxtx_factor=-1.0)
        self.assertInvalidInput("flavor1", 64, 1, 120, rxtx_factor=0.0)

        flavor = flavors.create("flavor1", 64, 1, 120, rxtx_factor=1.0)
        self.assertEqual(1.0, flavor["rxtx_factor"])

        flavor = flavors.create("flavor2", 64, 1, 120, rxtx_factor=1.1)
        self.assertEqual(1.1, flavor["rxtx_factor"])
开发者ID:sdague,项目名称:nova,代码行数:10,代码来源:test_instance_types.py

示例10: test_rxtx_factor_must_be_positive_float

    def test_rxtx_factor_must_be_positive_float(self):
        self.assertInvalidInput('flavor1', 64, 1, 120, rxtx_factor='foo')
        self.assertInvalidInput('flavor1', 64, 1, 120, rxtx_factor=-1.0)
        self.assertInvalidInput('flavor1', 64, 1, 120, rxtx_factor=0.0)

        flavor = flavors.create('flavor1', 64, 1, 120, rxtx_factor=1.0)
        self.assertEqual(1.0, flavor.rxtx_factor)

        flavor = flavors.create('flavor2', 64, 1, 120, rxtx_factor=1.1)
        self.assertEqual(1.1, flavor.rxtx_factor)
开发者ID:mahak,项目名称:nova,代码行数:10,代码来源:test_flavors.py

示例11: test_read_deleted_false_converting_flavorid

    def test_read_deleted_false_converting_flavorid(self):
        """Ensure deleted flavors are not returned when not needed (for
        example when creating a server and attempting to translate from
        flavorid to instance_type_id.
        """
        flavors.create("instance_type1", 256, 1, 120, 100, "test1")
        flavors.destroy("instance_type1")
        flavors.create("instance_type1_redo", 256, 1, 120, 100, "test1")

        instance_type = flavors.get_flavor_by_flavor_id("test1", read_deleted="no")
        self.assertEqual("instance_type1_redo", instance_type.name)
开发者ID:isyippee,项目名称:nova,代码行数:11,代码来源:test_flavors.py

示例12: test_name_length_checks

    def test_name_length_checks(self):
        MAX_LEN = 255

        # Flavor name with 255 characters or less is valid.
        flavors.create('a' * MAX_LEN, 64, 1, 120)

        # Flavor name which is more than 255 characters will cause error.
        self.assertInvalidInput('a' * (MAX_LEN + 1), 64, 1, 120)

        # Flavor name which is empty should cause an error
        self.assertInvalidInput('', 64, 1, 120)
开发者ID:MasterZ40,项目名称:nova,代码行数:11,代码来源:test_flavors.py

示例13: test_remove_flavor_access

    def test_remove_flavor_access(self):
        user_id = "fake"
        project_id = "fake"
        ctxt = context.RequestContext(user_id, project_id, is_admin=True)
        flavor_id = "flavor1"
        flavors.create("some flavor", 256, 1, 120, 100, flavorid=flavor_id)
        flavors.add_flavor_access(flavor_id, project_id, ctxt)
        flavors.remove_flavor_access(flavor_id, project_id, ctxt)

        projects = flavors.get_flavor_access_by_flavor_id(flavor_id, ctxt)
        self.assertEqual([], projects)
开发者ID:newgoliath,项目名称:nova,代码行数:11,代码来源:test_flavors.py

示例14: test_get_inactive_flavors

    def test_get_inactive_flavors(self):
        flav1 = flavors.create('flavor1', 256, 1, 120)
        flav2 = flavors.create('flavor2', 512, 4, 250)
        flavors.destroy('flavor1')

        returned_flavors_ids = flavors.get_all_flavors().keys()
        self.assertNotIn(flav1['id'], returned_flavors_ids)
        self.assertIn(flav2['id'], returned_flavors_ids)

        returned_flavors_ids = flavors.get_all_flavors(inactive=True).keys()
        self.assertIn(flav1['id'], returned_flavors_ids)
        self.assertIn(flav2['id'], returned_flavors_ids)
开发者ID:Acidburn0zzz,项目名称:nova,代码行数:12,代码来源:test_flavors.py

示例15: test_get_inactive_flavors_with_same_name

    def test_get_inactive_flavors_with_same_name(self):
        flavors.create('flavor1', 256, 1, 120, 100, "test_id1")
        flavors.destroy('flavor1')
        flavors.create('flavor1', 512, 4, 250, 100, "test_id2")

        returned_flavors_ids = flavors.get_all_flavors().keys()
        self.assertNotIn('test_id1', returned_flavors_ids)
        self.assertIn('test_id2', returned_flavors_ids)

        returned_flavors_ids = flavors.get_all_flavors(inactive=True).keys()
        self.assertIn('test_id1', returned_flavors_ids)
        self.assertIn('test_id2', returned_flavors_ids)
开发者ID:aspiers,项目名称:nova,代码行数:12,代码来源:test_flavors.py


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