예제 #1
0
def main_execution(
        machine_name, test_list, deps_list, machine_ram, machine_no_of_disks,
        machine_snap_name, machine_full_path, machine_ks_full_path,
        machine_iso_full_path, ssh_key, ssh_full_path, scp_copy_source):
    counter = 1
    for inc in test_list:

        if (subprocess.call(["virsh list --all | grep {}".format(machine_name)], shell=True) != 0):
            loginst.info("Creating virtual machine - creating disk array")
            disk_arg = virtual_machine.create_disks(
                machine_no_of_disks, machine_full_path, machine_name)
            loginst.info("Creating virtual machine - starting installation")
            virtual_machine.create_machine(
                machine_name, machine_full_path, disk_arg, machine_iso_full_path,
                machine_ram, machine_ks_full_path, machine_snap_name)

        loginst.info("Starting virtual machine.")
        virtual_machine.start_machine(machine_name)
        loginst.info("Virtual machine started, obtaining IP address.")
        ip_address = virtual_machine.find_ip_address(machine_name)
        loginst.debug("IP address of the machine is {}".format(ip_address))
        loginst.info("IP address ready, starting copying.")
        virtual_machine.scp_copy_files(
            ip_address, ssh_full_path, scp_copy_source,
            test_list, deps_list, False)
        loginst.info("Files copied, initiating test stage no {}".format(counter))
        virtual_machine.initiate_test(ip_address, ssh_full_path, counter)
        loginst.info(
            "Test completed, attempting to copy TEST_RESULT_{}".format(counter))
        virtual_machine.scp_copy_files(
            ip_address, ssh_full_path, scp_copy_source,
            test_list, deps_list, True)
        loginst.info(
            "Results copied, reverting machine to {}".format(machine_snap_name))
        virtual_machine.revert_machine(machine_name, machine_snap_name)
        counter = counter + 1
예제 #2
0
ssh_full_path = "{}{}".format(conf_object['SSH']['SSHFullPath'], ssh_key)
scp_copy_source = conf_object['SSH']['SCPCopySource']

ks_repo = conf_object['KICKSTART']['Repository']
ks_additionalrepo = conf_object['KICKSTART']['AdditionalRepository']
ks_keyboard = conf_object['KICKSTART']['Keyboard']
ks_timezone = conf_object['KICKSTART']['Timezone']
ks_rootpass = conf_object['KICKSTART']['RootPassword']


## Create (if does not exist) and start the machine.


test_list, deps_list = virtual_machine.get_scp_files(scp_copy_source)

counter = 1
for inc in test_list:

    if (subprocess.call(["virsh list --all | grep {}".format(machine_name)],shell=True) == 0):
        virtual_machine.start_machine(machine_name)
    else:
        disk_arg = virtual_machine.create_disks(machine_no_of_disks, machine_full_path, machine_name)
        virtual_machine.create_machine(machine_name, machine_full_path, disk_arg, machine_iso_full_path, machine_ram, machine_ks_full_path, machine_snap_name)

    ip_address = virtual_machine.find_ip_address(machine_name)                                   ## Get IP address
    virtual_machine.scp_copy_files(ip_address, ssh_full_path, scp_copy_source, test_list, deps_list, False)     ## Copy files to machine
    virtual_machine.initiate_test(ip_address, ssh_full_path, counter)
    virtual_machine.scp_copy_files(ip_address, ssh_full_path, scp_copy_source, test_list, deps_list, True)
    virtual_machine.revert_machine(machine_name, machine_snap_name)                             ## Revert back machine
    counter = counter + 1