[libvirt] [test-API PATCH 0/4]testcases will use xml file directly

Guannan Ren gren at redhat.com
Fri Apr 20 08:51:34 UTC 2012


Right now, for testcases that needs xml to define domain or storage, etc
they call module *utils/xmlbuilder.py  utils/xmlgenerator.py* to get back
a string of xml. These two module create xml string by "xml.dom.minidom"
This approach is hard to maintain and not easy to use. So we will depreciate it
in near furture.

The new way is to use xml file directly. There will be a new folder named
'xmls' in path repos/*/xmls, testcases will use the xmlfile in the foler
directly.

For example: domain:define
required_params = ('guestname', 'diskpath',)
optional_params = {'memory': 1048576,
                   'vcpu': 1,
                   'hddriver' : 'virtio',
                   'nicdriver': 'virtio',
                   'macaddr': '52:54:00:97:e4:28',
                   'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
                   'username': None,
                   'password': None,
                   'guesttype': 'kvm',
                   'xml': 'xmls/kvm_guest_define.xml'
                  }


The define.py will get the xml string of "xmls/kvm_guest_define.xml" and define it
directly. 
The framework takes the charge of getting the content of the file, replacing
some TEXT in it and passing the string to define.py for use.

The define.py supports any file in absolute path if the xml option is given in testcase
file like

domain:eventhandler
    guestname
        fedoraVM
    diskpath
        /var/lib/libvirt/images/fedoraVM
    xml
        /PATH/TO/FILE




More information about the libvir-list mailing list