Hi  jzupka and others:
    I need some help about cartesian config.
Example:
    (1). I config the subtests.cfg and tests.cfg as what I attached.
           (Actually, just copy the default config of unattended_install.)
    (2). I write a src file named parser_test.py in libvirt/tests/src/ to
           get the params in the two cases.
    (3). I execute "../../autotest libvirt/control --verbose"
    (4). Two files created on /tmp/other_name and /tmp/unattended_install.
(5). I write a python file named "diff.py" to diff the two params in the two file.
    (6). This is the result of diff.py in attached files named result.

Is there something special for the name of unattended_install??? Why the same
config in subtests.cfg will get a different params??
I need your help, Thanx :)

result:
*****Missing*****
Key: syslog_server_enabled not in other_name.
Key: syslog_server_proto not in other_name.
Key: md5sum_1m_cd1 not in other_name.
Key: cdrom_cd1 not in other_name.
Key: unattended_file not in other_name.
Key: cdrom_unattended not in other_name.
Key: kernel_params not in other_name.
Key: md5sum_cd1 not in other_name.
Key: boot_path not in other_name.
*****Diff*****
Key: kernel, diff: {'unattended_install': 'images/rhel63-64/vmlinuz', 'other_name': 'vmlinuz'}. Key: initrd, diff: {'unattended_install': 'images/rhel63-64/initrd.img', 'other_name': 'initrd.img'}.
Key: host_setup_flag, diff: {'unattended_install': 1, 'other_name': 2}.
# Do not edit, auto generated file from subtests config
variants:
    - unattended_install:
        result_name = "unattended_install"
        virt_test_type = qemu libvirt
        type = parser_test
        start_vm = no
        kill_vm = yes
        kill_vm_gracefully = yes
        kill_vm_on_error = yes
        shutdown_cleanly = yes
        shutdown_cleanly_timeout = 120
        force_create_image = yes
        guest_port_unattended_install = 12323
        kernel = vmlinuz
        initrd = initrd.img
        # Throw errors if guest screen is inactive
        inactivity_watcher = error
        # Inactivity treshold to error the test
        inactivity_treshold = 1800
        # Set migrate_background to yes to run migration in parallel
        # migrate_background = yes
        image_verify_bootable = no
    
        # Way of delivering ks file into the guest
        variants:
            # Additional iso with kickstart is attached into the guest
            - extra_cdrom_ks:
                only Linux
                unattended_delivery_method = cdrom
                cdroms += " unattended"
                drive_index_unattended = 1
                drive_index_cd1 = 2
            # Kickstart is packed into the installation iso
            - in_cdrom_ks:
                only Linux, unattended_install.cdrom
                unattended_delivery_method = integrated
            # Autotest starts simple http server providing kickstart
            - http_ks:
                only Linux
                unattended_delivery_method = url
            # Image with kickstart is attached into the guest as floppy drive
            - floppy_ks:
                only Linux
                unattended_delivery_method = floppy
            # Only perform a libvirt import. No cdroms, no floppies, no nothing
            - import:
                virt_test_type = libvirt
                no cdrom, url, nfs, remote_ks, pxe, kernel_initrd
                cdroms = ""
                floppy = ""
                timeout = 180
    
        variants:
            # Install guest from cdrom
            - cdrom:
                # TODO: is this needed for both kvm and libvirt?
                # This option is only used in windows installation case,
                # since linux use kernel/initrd option of qemu.
                boot_once = d
                medium = cdrom
                redirs += " unattended_install"
            # Install guest from http/ftp url
            - url:
                only Linux
                medium = url
                url = REPLACE_THIS_WITH_TREE_URL
            # Install guest from nfs nfs_server:nfs_dir
            - nfs:
                only Linux
                medium = nfs
                nfs_server = REPLACE_THIS_WITH_NFS_SERVER
                nfs_dir = REPLACE_THIS_WITH_NFS_DIRECTORY
            # Install guest with a remote kickstart
            - remote_ks:
                only Linux
                medium = url
                # TODO: does kvm need to prefix this with '--append'?
                extra_params = " ks=REPLACE_THIS_WITH_URL_OF_KS"
                url = REPLACE_THIS_WITH_TREE_URL
            # Install guest using pxe/tftp  (virt-install --pxe)
            - pxe:
                only Linux
                medium = pxe
            # Install guest using kernel/initrd pair from directory
            - kernel_initrd:
                only Linux
                medium = kernel_initrd
            - import:
                virt_test_type = libvirt
                no extra_cdrom_ks, in_cdrom_ks, http_ks, floppy_ks
                medium = import
                force_create_image = no
                create_image = no
    - svirt_install:
        result_name = "other_name"
        virt_test_type = qemu libvirt
        type = parser_test
        start_vm = no
        kill_vm = yes
        kill_vm_gracefully = yes
        kill_vm_on_error = yes
        shutdown_cleanly = yes
        shutdown_cleanly_timeout = 120
        force_create_image = yes
        guest_port_unattended_install = 12323
        kernel = vmlinuz
        initrd = initrd.img
        # Throw errors if guest screen is inactive
        inactivity_watcher = error
        # Inactivity treshold to error the test
        inactivity_treshold = 1800
        # Set migrate_background to yes to run migration in parallel
        # migrate_background = yes
        image_verify_bootable = no
    
        # Way of delivering ks file into the guest
        variants:
            # Additional iso with kickstart is attached into the guest
            - extra_cdrom_ks:
                only Linux
                unattended_delivery_method = cdrom
                cdroms += " unattended"
                drive_index_unattended = 1
                drive_index_cd1 = 2
            # Kickstart is packed into the installation iso
            - in_cdrom_ks:
                only Linux, unattended_install.cdrom
                unattended_delivery_method = integrated
            # Autotest starts simple http server providing kickstart
            - http_ks:
                only Linux
                unattended_delivery_method = url
            # Image with kickstart is attached into the guest as floppy drive
            - floppy_ks:
                only Linux
                unattended_delivery_method = floppy
            # Only perform a libvirt import. No cdroms, no floppies, no nothing
            - import:
                virt_test_type = libvirt
                no cdrom, url, nfs, remote_ks, pxe, kernel_initrd
                cdroms = ""
                floppy = ""
                timeout = 180
    
        variants:
            # Install guest from cdrom
            - cdrom:
                # TODO: is this needed for both kvm and libvirt?
                # This option is only used in windows installation case,
                # since linux use kernel/initrd option of qemu.
                boot_once = d
                medium = cdrom
                redirs += " unattended_install"
            # Install guest from http/ftp url
            - url:
                only Linux
                medium = url
                url = REPLACE_THIS_WITH_TREE_URL
            # Install guest from nfs nfs_server:nfs_dir
            - nfs:
                only Linux
                medium = nfs
                nfs_server = REPLACE_THIS_WITH_NFS_SERVER
                nfs_dir = REPLACE_THIS_WITH_NFS_DIRECTORY
            # Install guest with a remote kickstart
            - remote_ks:
                only Linux
                medium = url
                # TODO: does kvm need to prefix this with '--append'?
                extra_params = " ks=REPLACE_THIS_WITH_URL_OF_KS"
                url = REPLACE_THIS_WITH_TREE_URL
            # Install guest using pxe/tftp  (virt-install --pxe)
            - pxe:
                only Linux
                medium = pxe
            # Install guest using kernel/initrd pair from directory
            - kernel_initrd:
                only Linux
                medium = kernel_initrd
            - import:
                virt_test_type = libvirt
                no extra_cdrom_ks, in_cdrom_ks, http_ks, floppy_ks
                medium = import
                force_create_image = no
                create_image = no
# File reserved for test runner (./run) use, don't modify.
include tests-shared.cfg

variants:
    - @libvirt_f17_quick:
        virt_install_binary = /usr/bin/virt-install
        qemu_img_binary = /usr/bin/qemu-img
        hvm_or_pv = hvm
        only qcow2
        only virtio_net
        only virtio_blk
        only smp2
        only no_9p_export
        only no_pci_assignable
        only no_glusterfs_support
        only smallpages
        only RHEL.6.3.x86_64
        only svirt_install.cdrom.extra_cdrom_ks, 
unattended_install.cdrom.extra_cdrom_ks

only libvirt_f17_quick
def run_parser_test(test, params, env):
    import pdb
    pdb.set_trace()
    result_name = params.get("result_name")
    result_file = open("/tmp/%s" % result_name, "w")
    result_file.write(str(params))
    result_file.close()
def diff():
    unattended_install_file = open("/tmp/unattended_install")
    dict_unattended_install = eval(unattended_install_file.read())
    other_name_file = open('/tmp/other_name')
    dict_other_name = eval(other_name_file.read())
    miss_dict = {}
    diff_dict = {}
    for key in dict_unattended_install:
        if key not in dict_other_name.keys():
            miss_dict[key] = "other_name"
        elif not dict_unattended_install[key] == dict_other_name[key]:
            if key.count("name"):
                continue
            diff_dict[key] = {'unattended_install':dict_unattended_install[key],
                              'other_name':dict_other_name[key]}
    for key in dict_other_name:
        if key not in dict_unattended_install.keys():
            miss_dict[key] = "unattended_install"

    #print result.
    print "*****Missing*****"
    for key, value in miss_dict.items():
        print "Key: %s not in %s." % (key, value)
    print "*****Diff*****"
    for key, value in diff_dict.items():
        print "Key: %s, diff: %s." % (key, value)

if __name__ == "__main__":
    diff()
*****Missing*****
Key: syslog_server_enabled not in other_name.
Key: syslog_server_proto not in other_name.
Key: md5sum_1m_cd1 not in other_name.
Key: cdrom_cd1 not in other_name.
Key: unattended_file not in other_name.
Key: cdrom_unattended not in other_name.
Key: kernel_params not in other_name.
Key: md5sum_cd1 not in other_name.
Key: boot_path not in other_name.
*****Diff*****
Key: kernel, diff: {'unattended_install': 'images/rhel63-64/vmlinuz', 
'other_name': 'vmlinuz'}.
Key: initrd, diff: {'unattended_install': 'images/rhel63-64/initrd.img', 
'other_name': 'initrd.img'}.
Key: host_setup_flag, diff: {'unattended_install': 1, 'other_name': 2}.

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to