• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xmlutil.make_links函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make_app

def make_app(elem, detailed=False):
    elem.set('name')
    elem.set('id')

    global XML_WARNING
    if not XML_WARNING:
        LOG.warn(_LW('XML support has been deprecated and may be removed '
                     'as early as the Juno release.'))
        XML_WARNING = True

    if detailed:
        elem.set('network_bandwidth')
        elem.set('memory_mb')
        elem.set('disk_gb')

        # Attach image node
        image = xmlutil.SubTemplateElement(elem, 'image', selector='image')
        image.set('id')
        xmlutil.make_links(image, 'links')

        # Attach fault node
        make_fault(elem)

        # Attach metadata node
        elem.append(common.MetadataTemplate())

    xmlutil.make_links(elem, 'links')
开发者ID:SriniNa,项目名称:hadev,代码行数:27,代码来源:apps.py


示例2: test__serialize_with_empty_datum_selector

    def test__serialize_with_empty_datum_selector(self):
        # Our test object to serialize
        obj = {
            'test': {
                'name': 'foobar',
                'image': ''
                },
            }

        root = xmlutil.TemplateElement('test', selector='test',
                                       name='name')
        master = xmlutil.MasterTemplate(root, 1)
        root_slave = xmlutil.TemplateElement('test', selector='test')
        image = xmlutil.SubTemplateElement(root_slave, 'image',
                                           selector='image')
        image.set('id')
        xmlutil.make_links(image, 'links')
        slave = xmlutil.SlaveTemplate(root_slave, 1)
        master.attach(slave)

        siblings = master._siblings()
        result = master._serialize(None, obj, siblings)
        self.assertEqual(result.tag, 'test')
        self.assertEqual(result[0].tag, 'image')
        self.assertEqual(result[0].get('id'), str(obj['test']['image']))
开发者ID:AsherBond,项目名称:nova,代码行数:25,代码来源:test_xmlutil.py


示例3: make_network

def make_network(elem, detailed=False):
    elem.set('name')
    elem.set('id')
    if detailed:
        elem.set('name')
        elem.set('vms')
    
    xmlutil.make_links(elem, 'links')
开发者ID:HolySparky,项目名称:Openstack-NetworkAPI,代码行数:8,代码来源:networks.py


示例4: make_flavor

def make_flavor(elem, detailed=False):
    elem.set('name')
    elem.set('id')
    if detailed:
        elem.set('ram')
        elem.set('disk')
        elem.set('vcpus', xmlutil.EmptyStringSelector('vcpus'))

    xmlutil.make_links(elem, 'links')
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:9,代码来源:flavors.py


示例5: make_ext

def make_ext(elem):
    elem.set("name")
    elem.set("namespace")
    elem.set("alias")
    elem.set("updated")

    desc = xmlutil.SubTemplateElement(elem, "description")
    desc.text = "description"

    xmlutil.make_links(elem, "links")
开发者ID:henriquetruta,项目名称:nova,代码行数:10,代码来源:extensions.py


示例6: make_flavor

def make_flavor(elem, detailed=False):
    elem.set("name")
    elem.set("id")
    if detailed:
        elem.set("ram")
        elem.set("disk")

        for attr in ("vcpus", "swap", "rxtx_factor"):
            elem.set(attr, xmlutil.EmptyStringSelector(attr))

    xmlutil.make_links(elem, "links")
开发者ID:nimbis,项目名称:nova,代码行数:11,代码来源:flavors.py


示例7: make_flavor

def make_flavor(elem, detailed=False):
    elem.set('name')
    elem.set('id')
    if detailed:
        elem.set('ram')
        elem.set('disk')
        elem.set('vcpus', xmlutil.EmptyStringSelector('vcpus'))
        # NOTE(vish): this was originally added without a namespace
        elem.set('swap', xmlutil.EmptyStringSelector('swap'))

    xmlutil.make_links(elem, 'links')
开发者ID:joseluizrf,项目名称:nova,代码行数:11,代码来源:flavors.py


示例8: make_flavor

def make_flavor(elem, detailed=False):
    elem.set('name')
    elem.set('id')
    if detailed:
        elem.set('ram')
        elem.set('disk')
        elem.set('vcpus')
        elem.set('swap')
        elem.set('ephemeral')
        elem.set('disabled')

    xmlutil.make_links(elem, 'links')
开发者ID:dnguyenutsa,项目名称:nova,代码行数:12,代码来源:flavors.py


示例9: make_version

def make_version(elem):
    elem.set("id")
    elem.set("status")
    elem.set("updated")

    mts = MediaTypesTemplateElement("media-types")
    elem.append(mts)

    mt = xmlutil.SubTemplateElement(mts, "media-type", selector="media-types")
    mt.set("base")
    mt.set("type")

    xmlutil.make_links(elem, "links")
开发者ID:rossella,项目名称:nova,代码行数:13,代码来源:versions.py


示例10: make_image

def make_image(elem, detailed=False):
    elem.set('name')
    elem.set('id')

    if detailed:
        elem.set('updated')
        elem.set('created')
        elem.set('status')
        elem.set('progress')
        elem.set('minRam')
        elem.set('minDisk')

        server = xmlutil.SubTemplateElement(elem, 'server', selector='server')
        server.set('id')
        xmlutil.make_links(server, 'links')

        elem.append(common.MetadataTemplate())

    xmlutil.make_links(elem, 'links')
开发者ID:emonty,项目名称:nova,代码行数:19,代码来源:images.py


示例11: make_server

def make_server(elem, detailed=False):
    elem.set('name')
    elem.set('id')

    if detailed:
        elem.set('userId', 'user_id')
        elem.set('tenantId', 'tenant_id')
        elem.set('updated')
        elem.set('created')
        elem.set('hostId')
        elem.set('accessIPv4')
        elem.set('accessIPv6')
        elem.set('status')
        elem.set('progress')

        # Attach image node
        image = xmlutil.SubTemplateElement(elem, 'image', selector='image')
        image.set('id')
        xmlutil.make_links(image, 'links')

        # Attach flavor node
        flavor = xmlutil.SubTemplateElement(elem, 'flavor', selector='flavor')
        flavor.set('id')
        xmlutil.make_links(flavor, 'links')

        # Attach fault node
        make_fault(elem)

        # Attach metadata node
        elem.append(common.MetadataTemplate())

        # Attach addresses node
        elem.append(ips.AddressesTemplate())

    xmlutil.make_links(elem, 'links')
开发者ID:corystone,项目名称:nova,代码行数:35,代码来源:servers.py


示例12: test_make_links

 def test_make_links(self):
     elem = xmlutil.TemplateElement('image', selector='image')
     self.assertTrue(repr(xmlutil.make_links(elem, 'links')))
开发者ID:AsherBond,项目名称:nova,代码行数:3,代码来源:test_xmlutil.py


示例13: construct

 def construct(self):
     root = xmlutil.TemplateElement('servers')
     elem = xmlutil.SubTemplateElement(root, 'server', selector='servers')
     make_server(elem)
     xmlutil.make_links(root, 'servers_links')
     return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap)
开发者ID:westmaas,项目名称:nova,代码行数:6,代码来源:servers.py


示例14: construct

 def construct(self):
     root = xmlutil.TemplateElement('images')
     elem = xmlutil.SubTemplateElement(root, 'image', selector='images')
     make_image(elem)
     xmlutil.make_links(root, 'images_links')
     return xmlutil.MasterTemplate(root, 1, nsmap=image_nsmap)
开发者ID:emonty,项目名称:nova,代码行数:6,代码来源:images.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xmlutil.safe_minidom_parse_string函数代码示例发布时间:2022-05-27
下一篇:
Python xmlutil.make_flat_dict函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap