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


Python XMLBuilder.description方法代码示例

本文整理汇总了Python中xmlbuilder.XMLBuilder.description方法的典型用法代码示例。如果您正苦于以下问题:Python XMLBuilder.description方法的具体用法?Python XMLBuilder.description怎么用?Python XMLBuilder.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlbuilder.XMLBuilder的用法示例。


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

示例1: build_snapshot_xml

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import description [as 别名]
 def build_snapshot_xml(self, name=None, description=None):
     """
     :rtype : String
     :type name: String
     :type description: String
     """
     xml_builder = XMLBuilder('domainsnapshot')
     if not (name is None):
         xml_builder.name(name)
     if not (description is None):
         xml_builder.description(description)
     return str(xml_builder)
开发者ID:korshenin,项目名称:devops,代码行数:14,代码来源:libvirt_xml_builder.py

示例2: create_snapshot

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import description [as 别名]
    def create_snapshot(self, domain, snapshot_name, \
                        snapshot_description):
        """Create VM snapshot
           connection: object with a connection to the Hypervisor
           domain: VM name
           snapshot_name
           snapshot_description
        """
        try:
            libvirt_domain = self.libvirt_connection.lookupByName(domain)
            xml_base = XMLBuilder('domainsnapshot')
            xml_base.name(snapshot_name)
            xml_base.description(snapshot_description)
            xml = str(xml_base)
            libvirt_domain.snapshotCreateXML(xml)
        except:
            print 'Unable to create snapshot'
            sys.exit(1)

        print 'Snapshot has been created successfully.'
开发者ID:tlzr,项目名称:vm-tools,代码行数:22,代码来源:create_snapshot.py

示例3: build_snapshot_xml

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import description [as 别名]
    def build_snapshot_xml(self, name=None, description=None, node=None,
                           disk_only=False, external=False, external_dir=None):
        """Generate snapshot XML

        :rtype : String
        :type name: String
        :type description: String
        """
        xml_builder = XMLBuilder('domainsnapshot')
        if name is not None:
            xml_builder.name(name)
        if description is not None:
            xml_builder.description(description)
        if external:
            domain = self.driver.conn.lookupByUUIDString(node.uuid)
            # Add memory file for active machines
            if domain.isActive() and not disk_only:
                memory_file = '{0}/snapshot-memory-{1}_{2}.{3}'.format(
                    external_dir,
                    node.environment.name,
                    node.name,
                    name)
                file_count = 0
                tmp_memory_file = memory_file
                while os.path.exists(tmp_memory_file):
                    tmp_memory_file = memory_file + '-' + str(file_count)
                    file_count += 1
                xml_builder.memory(
                    file=tmp_memory_file,
                    snapshot='external')
            else:
                xml_builder.memory(snapshot='no')
            for disk in node.disk_devices:
                if disk.device == 'disk':
                    with xml_builder.disks:
                        xml_builder.disk(name=disk.target_dev,
                                         file=disk.volume.get_path(),
                                         snapshot='external')
        return str(xml_builder)
开发者ID:asledzinskiy,项目名称:fuel-devops,代码行数:41,代码来源:libvirt_xml_builder.py

示例4: make_story_xml

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import description [as 别名]
    def make_story_xml(self, name=None, description=None, story_type=None,
                       owned_by=None, requested_by=None, estimate=None, current_state=None, labels=None):
        story = XMLBuilder('story')
        if name is not None:
            story.name(name)
        if description is not None:
            story.description(description)
        if requested_by is not None:
            story.requested_by(requested_by)
        if owned_by is not None:
            story.owned_by(owned_by)
        if story_type is not None:
            story.story_type(story_type)
        if estimate is not None:
            story.estimate(str(estimate), type='integer')
        if current_state is not None:
            story.current_state(current_state)
        if labels is not None:
            label_string = ','
            if labels:
                label_string = ','.join(labels)
            story.labels(label_string)

        return str(story)
开发者ID:salsita,项目名称:gitflow,代码行数:26,代码来源:__init__.py


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