示例#1
0
文件: types.py 项目: apporc/cinder
def make_voltype(elem):
    elem.set('id')
    elem.set('name')
    elem.set('description')
    elem.set('qos_specs_id')
    extra_specs = xmlutil.make_flat_dict('extra_specs', selector='extra_specs')
    elem.append(extra_specs)
示例#2
0
文件: hosts.py 项目: ArikaChen/cinder
    def construct(self):
        root = xmlutil.TemplateElement('host')
        elem = xmlutil.make_flat_dict('resource', selector='host',
                                      subselector='resource')
        root.append(elem)

        return xmlutil.MasterTemplate(root, 1)
示例#3
0
 def test_make_flat_dict(self):
     expected_xml = ("<?xml version='1.0' encoding='UTF-8'?>\n"
                     '<wrapper><a>foo</a><b>bar</b></wrapper>')
     root = xmlutil.make_flat_dict('wrapper')
     tmpl = xmlutil.MasterTemplate(root, 1)
     result = tmpl.serialize(dict(wrapper=dict(a='foo', b='bar')))
     self.assertEqual(result, expected_xml)
示例#4
0
    def construct(self):
        root = xmlutil.TemplateElement('host')
        elem = xmlutil.make_flat_dict('resource', selector='host',
                                      subselector='resource')
        root.append(elem)

        return xmlutil.MasterTemplate(root, 1)
示例#5
0
def make_voltype(elem):
    elem.set('id')
    elem.set('name')
    elem.set('description')
    elem.set('qos_specs_id')
    extra_specs = xmlutil.make_flat_dict('extra_specs', selector='extra_specs')
    elem.append(extra_specs)
示例#6
0
 def construct(self):
     root = xmlutil.make_flat_dict('encryption', selector='encryption')
     return xmlutil.MasterTemplate(root, 1)
示例#7
0
 def construct(self):
     root = xmlutil.make_flat_dict('extra_specs', selector='extra_specs')
     return xmlutil.MasterTemplate(root, 1)
 def construct(self):
     root = xmlutil.make_flat_dict("encryption", selector="encryption")
     return xmlutil.MasterTemplate(root, 1)
示例#9
0
 def construct(self):
     root = xmlutil.make_flat_dict("qos_specs", selector="qos_specs")
     return xmlutil.MasterTemplate(root, 1)
示例#10
0
 def construct(self):
     return xmlutil.MasterTemplate(xmlutil.make_flat_dict('specs'), 1)
 def construct(self):
     return xmlutil.MasterTemplate(xmlutil.make_flat_dict('specs'), 1)
示例#12
0
 def test_make_flat_dict(self):
     expected_xml = "<?xml version='1.0' encoding='UTF-8'?>\n" "<wrapper><a>foo</a><b>bar</b></wrapper>"
     root = xmlutil.make_flat_dict("wrapper")
     tmpl = xmlutil.MasterTemplate(root, 1)
     result = tmpl.serialize(dict(wrapper=dict(a="foo", b="bar")))
     self.assertEqual(result, expected_xml)