lib/guest_installation_and_configuration_base.pm

reveal_myself

reveal_myself($self)
  

Any subroutine calls this subroutine announces its identity and it is being executed.

create

create($self)
  

Create guest instance by assigning values to its parameters but do no install it.

initialize_guest_params

initialize_guest_params($self)
  

Initialize all guest parameters to avoid uninitialized parameters.

config_guest_params

config_guest_params($self, %_guest_params)

Assign real values to guest instance parameters. Reset [guest_name] to guest name used in [guest_metadata] if they are different. The subroutine can be called mainly in two different ways: Firstly, config_guest_params can be called in another subroutine, for example, create which takes a hash/dictionary as argument. my %testhash = ('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'), $self->create(%testhash) which calls $self->config_guest_params(@_). Secondly, config_guest_params can also be called direcly, for example, $self->config_guest_params(%testhash). Call revise_guest_version_and_build to correct guest version and build parameters to avoid mismatch if necessary.

revise_guest_version_and_build

revise_guest_version_and_build($self, %_guest_params)

Correct [guest_version], [guest_version_major], [guest_version_minor] and [guest_build] if they are not set correctly or mismatch with each other. Set [guest_version] to the developing product version if it is not given. Set [guest_version_major] and [guest_version_minor] from [guest_version] it they do not match with [guest_version]. Set [guest_build] to get_required_var('BUILD') if it is empty and developing [guest_version], or 'GM' if non-developing [guest_version]. This subroutine help make things better and life easier but the end user should always pay attention and use meaningful and correct guest parameter and profile.

print_guest_params($self)

Print out guest instance parameters.

prepare_common_environment

prepare_common_environment($self)

Install necessary packages, patterns, setup ssh config, create [common_log_folder]. These are common environment affairs which will be used for all guest instances.

prepare_ssh_key

prepare_ssh_key($self)

Prepare ssh key [ssh_public_key] and [ssh_private_key] for passwordless ssh login from host to guest. [ssh_command] stores options and username to be used with ssh login.

prepare_non_transactional_environment

prepare_non_transactional_environment($self)

Do preparation on non-transactional server.

clean_up_all_guests

clean_up_all_guests($self)

Remove all existing guests and affecting storage files.

prepare_guest_environment

prepare_guest_environment($self)

Create individual guest log folder using its name and remove existing entry in /etc/hosts.

config_guest_name

config_guest_name($self, @_)

Configure [guest_domain_name] and [guest_name_options].User can still change [guest_name] and [guest_domain_name] by passing non-empty arguments using hash.

config_guest_metadata

config_guest_metadata($self[, guest_metadata => 'metadata'])

Configure [guest_metadata_options]. User can still change [guest_metadata] by assing non-empty arguments using hash. If installation already passes, modify_guest_params will be called to modify [guest_metadata] using already modified [guest_metadata_options].

config_guest_vcpus

config_guest_vcpus($self[, guest_vcpus => 'vcpus'])

Configure [guest_vcpus_options].User can still change [guest_vcpus] by passing non-empty arguments using hash. If installations already passes,modify_guest_params will be called to modify [guest_vcpus] using already modified [guest_vcpus_options].

config_guest_memory

config_guest_memory($self[, guest_memory => 'memory'])

Configure [guest_memory_options]. User can still change [guest_memory], [guest_memballoon], [guest_memdev], [guest_memtune] and [guest_memorybacking] by passing non-empty arguments using hash. If installation already passes, modify_guest_params will be called to modify [guest_memory], [guest_memballoon], [guest_memdev], [guest_memtune] and [guest_memorybacking] using already modified [guest_memory_options].

config_guest_virtualization

config_guest_virtualization($self[, host_hypervisor_uri => 'uri', host_virt_type => 'type'])

Configure [guest_virt_options].User can still change [host_hypervisor_uri], [host_virt_type] and [guest_virt_options] by passing non-empty arguments using hash.

config_guest_platform

config_guest_platform($self[, guest_arch => 'arch', guest_machine_type => 'type'])

Configure [guest_platform_options].User can still change [guest_arch] and [guest_machine_type] by passing non-empty arguments using hash.

config_guest_os_variant

config_guest_os_variant($self[, guest_os_variant => 'os'])

Configure [guest_os_variant_options]. User can still change [guest_os_variant] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_os_variant] using already modified [guest_os_variant_options].

config_guest_graphics_and_video

config_guest_graphics_and_video($self[, guest_video => 'video', guest_graphics => 'graphics'])

Configure [guest_graphics_and_video_options]. User can still change [guest_video] and [guest_graphics] by passing non-empty arguments using hash. If installations already passes,modify_guest_params will be called to modify [guest_video] and [guest_graphics] using already modified [guest_graphics_and_video_options].

config_guest_channels

config_guest_channels($self[, guest_channel => 'channel'])

Configure [guest_channel_options]. User can still change [guest_channel] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_channel] using already modified [guest_channel_options]. Multiple channels are allowd for a single guest, they should be passed in with hash symbol '#' as separator, for example, 'type=unix#spicevmc'.

config_guest_consoles

config_guest_consoles($self[, guest_console => 'console', guest_serial => 'serial'])

Configure [guest_console_options] and [guest_serial_options]. User can still change [guest_console] and [guest_serial] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_console] and [guest_serial] using already modified [guest_console_options] and [guest_serial_options].

config_guest_features

config_guest_features($self[, guest_features => 'features'])

Configure [guest_features_options]. User can still change [guest_features] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_features] using already modified [guest_features_options].

config_guest_events

config_guest_events($self[, guest_events => 'events'])

Configure [guest_events_options]. User can still change [guest_events] by passing non-empty arguments using hash. If installations already passes,modify_guest_params will be called to modify [guest_events] using already modified [guest_events_options].

config_guest_boot_settings

config_guest_boot_settings($self[, guest_boot_settings => 'settings'])

Configure [guest_boot_options]. User can still change [guest_boot_settings] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_boot_settings] using already modified [guest_boot_options].

config_guest_power_management

config_guest_power_management($self[, guest_power_management => 'power'])

Configure [guest_power_management_options]. User can still change [guest_power_management] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_power_management] using already modified [guest_power_management_options].

config_guest_xpath

config_guest_xpath($self[, guest_xpath => 'xpath'])

Configure [guest_xpath_options]. User can still change [guest_xpath] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_xpath] using already modified [guest_xpath_options].

config_guest_qemu_command

config_guest_qemu_command($self[, guest_qemu_command => 'command'])

Configure [guest_qemu_command_options]. User can still change [guest_qemu_command] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_qemu_command] using already modified [guest_qemu_command_options].

config_guest_security

config_guest_security($self [, guest_seclabel => 'seclabel'] [, guest_launchsecurity => 'launchsecurity'])

Configure [guest_security_options]. User can still change [guest_security] and [guest_launchsecurity] by passing non-empty arguments using hash. If installation already passes, modify_guest_params will be called to modify guest_security] and [guest_launchsecurity] using already modified [guest_security_options].

config_guest_controller

config_guest_controller($self [, guest_controller => 'controller'])

Configure [guest_controller_options]. User can still change [guest_controller] by passing non-empty arguments using hash. [guest_controller] can have more than one type controller which should be separated by hash symbol, for example, 'controller1 _config#controller2_config#controller3_config'. Then it will be splitted and passed to individual '--controller' argument to form [guest_controller_options] = '--controller controller1_config --controller controller2_config --controller controller3_config'. If installation already passes, modify_guest_params will be called to modify [guest_controller] using already modified [guest_controller_options].

config_guest_tpm

config_guest_tpm($self [, guest_tpm => 'tpm'])

Configure [guest_tpm_options]. User can still change [guest_tpm] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_tpm] using already modified [guest_tpm_options].

config_guest_rng

config_guest_rng($self [, guest_rng => 'rng'])

Configure [guest_rng_options]. User can still change [guest_rng] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_rng] using already modified [guest_rng_options].

config_guest_sysinfo

config_guest_sysinfo($self[, guest_sysinfo => 'sysinfo'])

Configure [guest_sysinfo_options]. User can still change [guest_sysinfo] by passing non-empty arguments using hash. Multiple sysinfos are allowd for a single guest, they should be passed in with hash symbol '#' as separator, for example, 'sysinfo1# sysinfo2'. If installation already passes, modify_guest_params will be called to modify [guest_sysinfo] using already modified [guest_sysinfo_options].

config_guest_storage

config_guest_rng($self [, key-value pairs of guest storage arguments])

Configure [guest_storage_options]. User can still change [guest_storage_type], [guest_storage_size], [guest_storage_format], [guest_storage_label], [guest_storage_path] and [guest_storage_others] by passing non-empty arguments using hash. If installations already passes, modify_guest_params will be called to modify [guest_storage_type], [guest_storage_size], [guest_storage_format], [guest_storage_path] and [guest_storage_others] using already modified [guest_storage_options].

config_guest_network_selection

config_guest_network_selection($self [, key-value pairs of guest network arguments])

Create network, type of which is either vnet or bridge, to be used with guest. In order to make network configuration consistent, global structure guest_network_matrix in module guest_installation_and_configuration_metadata.pm will be used for fetching network configuration. It covers almost all types of network configuration, including nat/forward/bridge/default mode in vnet and bridge/host mode in bridge networks. [guest_network_type] and [guest_network_mode] will be used for specifying desired network configuration, although customized network device name and address can still be specified by [guest_network_device] and [guest_netaddr]. For guest using static ip address, address info is derived from [guest_ipaddr] only.

config_guest_macaddr

config_guest_macaddr($self)

Generate nearly random mac address.

config_guest_network_vnet

config_guest_network_vent($self[, _device => 'device', _ipaddr => 'ip', 
_netmask => 'mask', _startaddr => 'start', _endaddr => 'end'])

Create virtual network to be used with guest based on [guest_network_device] and passed in arguments, $_ipaddr, $_netmask, $_startaddr and $_endaddr. Skip creating already existing and active virtual network.

config_guest_network_vnet_services

config_guest_network_vent_services($self[, )

Make sure virtual network provides services as expected by adding ip address of [guest_network_device] as nameserver and [guest_domain_name] as search domain in /etc/resolv.conf.

config_guest_network_vnet_policy

config_guest_network_vent_policy($self)

Loosen iptables rules for [guest_network_device]. Additionally, write commands executed into crontab to re-execute them automatically on reboot if host reboots somehow unexpectedly.

config_guest_network_bridge

config_guest_network_bridge($self)

Calls virt_autotest::utils::parse_subnet_address_ipv4 to parse detailed subnet information from [guest_netaddr].Create [guest_network_device] with parsed detailed subnet information by calling config_guest_network_bridge_device.Start DHCP and DNS services with parsed detailed subnet information by calling config_guest_network_bridge_services. If [guest_network_mode] is equal to 'host', guest chooses to use host network which is public facing. So there is no need to do subnet address parsing.

write_guest_network_bridge_device_config

write_guest_network_bridge_device_config($self, _name => $_name [, 
_ipaddr => $_ipaddr, _bootproto => $_bootproto, _startmode => $_startmode, 
_zone => $_zone, _bridge_type => $_bridge_type, _bridge_ports => $_bridge_ports, 
_bridge_stp => $_bridge_stp, _bridge_forwarddelay => $_bridge_forwarddelay])

Write network device settings to conventional /etc/sysconfig/network/ifcfg-* or /etc/NetworkManager/system-connections/*.nmconnection depends on whether system network is managed by NetworkManager or not. The supported arguments are listed out as below: $_ipaddr: IP address/mask length pair of the interface $_name: Identifier of the interface $_bootproto: DHCP automatic or manual configuration, 'static', 'dhcp' or 'none' $_startmode: Auto start up or connection: 'auto', 'manual' or 'off' $_zone: The trust level of this network connection $_bridge_type: 'master' or 'slave' to indicate master or slave interface $_bridge_port: Specify interface's master or slave interface name $_bridge_stp: 'on' or 'off' to turn stp on or off $_bridge_forwarddelay: The stp forwarding delay in seconds If $_ipaddr given is empty, it means there is no associated specific ip address to this interface which might be attached to another bridge interface or will not be assigned one ip address from dhcp, so set $_ipaddr to '0.0.0.0'.If $_ipaddr given is non-empty but not in ip address format,for example, 'host',it means the interface will not use a ip address from pre-defined subnet and will automically accept dhcp ip address from public facing host network.

write_guest_network_bridge_device_ifcfg

write_guest_network_bridge_device_ifcfg($self, _name => $_name [, 
_ipaddr => $_ipaddr, _name => $_name, _bootproto => $_bootproto, 
_startmode => $_startmode, _zone => $_zone, _bridge_type => $_bridge_type, 
_bridge_ports => $_bridge_ports, _bridge_stp => $_bridge_stp, 
_bridge_forwarddelay => $_bridge_forwarddelay])

Write bridge device config file to /etc/sysconfig/network/ifcfg-*. Please refer to https://github.com/openSUSE/sysconfig/blob/master/config/ifcfg.template for config file content.

write_guest_network_bridge_device_nmconnection

write_guest_network_bridge_device_nmconnection($self, _name => $_name [, 
_ipaddr => $_ipaddr, _name => $_name, _bootproto => $_bootproto, 
_startmode => $_startmode, _zone => $_zone, _bridge_type => $_bridge_type, 
_bridge_ports => $_bridge_ports, _bridge_stp => $_bridge_stp, 
_bridge_forwarddelay => $_bridge_forwarddelay])

Write bridge device config file to /etc/NetworkManager/system-connections/*. NM settings are a little bit different from ifcfg settings, but there are definite mapping between them. So translation from well-known and default ifcfg settings to NM settings is necessary. Please refer to nm-settings explanation as below: https://developer-old.gnome.org/NetworkManager/stable/nm-settings-keyfile.html

activate_guest_network_bridge_device

activate_guest_network_bridge_device($self, _host_device => $_host_device,
_bridge_device => $_bridge_device)

Activate guest network bridge device by using wicked or NetworkManager depends on system configuration. And also validate whether activation is successful or not.

config_guest_network_bridge_device

config_guest_network_bridge_device($self, $_bridge_network,
$_bridge_network_in_route, $_bridge_device)

Create [guest_network_device] by writing device information into ifcfg file in /etc/sysconfig/network. Mark guest installation as FAILED if [guest_network_device] can not be successfully started up. If [guest_network_device] or [guest_netaddr] already exists and active on host judging by 'ip route show', both of them will not be created anyway.

config_guest_network_bridge_services

config_guest_network_bridge_services($self, $_guest_network_device,
$_guest_network_ipaddr_gw, $_guest_network_mask, $_guest_network_ipaddr_start,
$_guest_network_ipaddr_end, $_guest_network_ipaddr_rev)

Start DHCP and DNS services by using dnsmasq command line. Add parsed subnet gateway ip address and [guest_domain_name] into /etc/resolv.conf. Empty NETCONFIG_DNS_POLICY in /etc/sysconfig/network/config. Mark guest installation as FAILED if dnsmasq command line can not be successfully fired up. Additionally, write dnsmasq command line used into crontab to start DHCP and DNS services automatically on reboot if host reboots somehow unexpectedly.

config_guest_network_bridge_policy

config_guest_network_bridge_policy($self, $_guest_network_device)

Stop firewall/apparmor, loosen iptables rules and enable forwarding globally and on all default route devices and [guest_network_device]. Additionally, write commands executed into crontab to re-execute them automatically on reboot if host reboots somehow unexpectedly.

schedule_tasks_on_boot

schedule_tasks_on_boot($self, _task => $_task)

Schedule tasks to be executed on system boot up, please refer to these documents: https://docs.oracle.com/en/learn/oracle-linux-crontab/ for using crontab utility and https://linuxconfig.org/how-to-schedule-tasks-with-systemd-timers-in-linux for using systemd service and timer. In order to schedule a task successfully, the _task argument should not be empty.

schedule_tasks_on_boot_crontab

schedule_tasks_on_boot_crontab($self, _task => $_task)

Schedule tasks on system boot up by using crontab utility.

schedule_tasks_on_boot_systemd

schedule_tasks_on_boot_systemd($self, _task => $_task)

Schedule tasks on system boot up by using systemd service and timer.

config_guest_installation_method

config_guest_installation_method($self[, key-value pairs of guest installation arguments])

Configure [guest_installation_method_options]. User can still change [guest_installation_method], [guest_installation_media], [guest_build], [guest_version], [guest_version_major], [guest_version_minor], [guest_installation_fine_grained] and [guest_autoconsole] by passing non-empty arguments using hash.Call config_guest_installation_media to set correct installation media.

config_guest_installation_media

config_guest_installation_media($self)

Set [guest_installation_media] to the current major and minor version if it does not match with [guest_version]. This subroutine also help mount nfs share if guest chooses to or has to use iso installation media, for example oracle linux guest uses iso installation media from https://yum.oracle.com/oracle-linux-isos.html. For guest using pre-built virtual disk image which will be downloaded and saved to [guest_storage_backing_path]. Although this subroutine can help correct installation media major and minor version if necessary, it is just auxiliary functionality and end user should always pay attendtion and use the meaningful and correct guest parameters and profile.

config_guest_installation_extra_args

config_guest_installation_extra_args($self[, key-value pairs of extra arguments])

Configure [guest_installation_extra_args_options]. User can still change [guest_installation_extra_args], [guest_ipaddr] and [guest_ipaddr_static] by passing non-empty arguments using hash.

config_guest_installation_automation_registration

config_guest_installation_automation_registration($self)

Configure registration/subscription/activation information in guest unattended installation file using guest parameters, including guest_do_registration, guest_registration_server, guest_registration_username, guest_registration_password, guest_registration_code, guest_registration_extensions and guest_registration_extensions_codes].

config_guest_firstboot_provision

config_guest_firstboot_provision($self)

Configure guest to use provisioning tool to configure system according to desired sepcification on first boot. The well-known provisioning tools are ignition and combustion which are specified by [guest_installation_automation_method]. Use flavors of supported platform from igntion as [guest_installation_automation_platform]. If provisioning config is passed in to [guest_sysinfo], user does not need to specify [guest_sysinfo] in guest profile. Instead only [guest_installation_automation_file] needs to be specified, all the others are taken care by this subroutine. Please refer to documentation: https://coreos.github.io/ignition/ and https://github.com/openSUSE/combustion.

config_guest_provision_ignition

config_guest_provision_ignition($self)

Configure ignition config file based on template specified by [guest_installation_automation_file]. If [guest_installation_automation_file] is empty, default ones will be used. If [guest_installation_automation_method] is 'ignition+combustion', their respective configuration files will be specified and joined with '#', for example, 'ignition_config #combustion_config', and their names should be prefixed with 'ignition' or 'combustion' respectively. Based on [guest_installation_automation_platform], for example, 'qemu' or 'metal', different ways of generating the final [guest_installation_automation_options] will be adopted. If [guest_installation_automation_platform] is 'qemu', ignition config file will be passed in via '--sysinfo' directly. If [guest_installation_automation_platform] is 'metal', ignition config file will be placed in the secondary disk vdb which is created by calling config_guest_provision_disk.

config_guest_provision_ignition_luks

config_guest_provision_ignition_luks($self[, _ignition_config => 'config'])

This subroutine is responsible for configuring luks devices in ignition config file. For details of luks devices in ignition, please refer to https://coreos.github.io/ignition/configuration-v3_2/.

config_guest_provision_combustion

config_guest_provision_combustion($self)

If [guest_installation_automation_method] is 'ignition+combustion', configuring combustion will be done after ignition. Combustion only is not supported, because 'ignition' or 'ignition+combustion' can already cover all scenarios. If [guest_installation_automation_file] is empty, default ones will be used. If [guest_installation_automation_method] is 'ignition+combustion', their respective configuration files will be specified and joined with '#', for example, 'ignition_config #combustion_config', and their names should be prefixed with 'ignition' or 'combustion' respectively. Based on [guest_installation_automation_platform], for example, 'qemu' or 'metal', different ways of generating the final [guest_installation_automation_options] will be adopted. If [guest_installation_automation_platform] is 'qemu', ignition config file will be passed in via '--sysinfo' directly. If [guest_installation_automation_platform] is 'metal', ignition config file will be placed in the secondary disk vdb which is created by calling config_guest_provision_disk.

config_guest_provision_disk

config_guest_provision_disk($self[, _provision_tool => 'tool'])

If [guest_installation_automation_platform] is 'metal', both ignition and combustion configurations will be placed in respective folders in the secondary disk vdb which is labeled as 'ignition"'. Because only 'ignition' or 'ignition+combustion' is supported, config_guest_provision_ignition will create a new ignition disk and config_guest_provision_combustion will only open an existing ignition disk to place combustion configuration in it.

config_guest_installation_automation

config_guest_installation_automation($self[, key-value of automated installation arguments])

Configure guest automatic installation. Based on [guest_installation_automation_method], either calling config_guest_firstboot_provision or config_guest_unattended_installation. The former is responsible for generating configuration for automatic firstboot provision which is used by booting from virtual disk image directly. The latter is responsible for generating unattended installation configuration for a fresh installation from installation media.

config_guest_unattended_installation

config_guest_unattended_installation($self)

Configure [guest_installation_automation_options]. Fill in unattended installation file with [guest_installation_media], [guest_secure_boot], [guest_boot_settings], [guest_storage_label], [guest_domain_name], [guest_name] and host public rsa key. User can also change [guest_do_registration], [guest_registration_server], [guest_registration_username], [guest_registration_password], [guest_registration_code], [guest_registration_extensions] and [guest_registration_extensions_codes] which are used in configuring guest installation automation registration. Subroutine config_guest_installation_automation_registration is called to perform this task. Start HTTP server using python3 modules in unattended automation file folder to serve unattended guest installation.Mark guest installation as FAILED if HTTP server can not be started up or unattended installation file is not accessible. Common varaibles are used in guest unattended installation file and to be replaced with actual values.They are common variables that are relevant to guest itself or its attributes, so they can be used in any unattended installation files regardless of autoyast or kickstart or others.For example, if you want to set guest ethernet interface mac address somewhere in your customized unattended installation file, put ##Device-MacAddr## there then it will be replaced with the real mac address. The actual kind of automation used matters less here than variables used in the unattended installation file, so keep using standardized common varialbes in unattened installation file will make it come alive automatically regardless of the actual kind of automation being used. Currently the following common variables are supported:[Module-Basesystem, Module-Desktop-Applications, Module-Development-Tools, Module-Legacy, Module-Server-Applications, Module-Web-Scripting, Product-SLES, Authorized-Keys, Secure-Boot, Boot-Loader-Type, Disk-Label, Domain-Name, Host-Name, Device-MacAddr, Logging-HostName, Logging-HostPort, Do-Registration, Registration-Server, Registration-UserName, Registration-Password and Registration-Code].

validate_guest_installation_automation_file

validate_guest_installation_automation_file($self)

Validate autoyast file using xmllint and yast2-schema. This is only for reference purpose if guest and host oses have different release major version. Output kickstart file content directly because its content can not be validated on SLES or opensuse host by using ksvalidator.

guest_installation_run

guest_installation_run($self, @_)

Calls prepare_guest_installation to do guest configuration. Call start_guest_installation to start guest installation. This subroutine also accepts hash/dictionary argument to be passed to prepare_guest_installation to further customize guest object if necessary.

prepare_guest_installation

prepare_guest_installation($self, @_)

Configure and prepare guest before installation starts. This subroutine also accepts hash/dictionary argument to be passed to config_guest_params to further customize guest object if necessary.

start_guest_installation

start_guest_installation($self)

If [virt_install_command_line_dryrun] succeeds, start real guest installation using screen and virt_install_command_line.

get_guest_installation_session

get_guest_installation_session($self)

Get guest installation screen process information and store it in [guest_installation_session] which is in the form of 3401.pts-1.vh017.

terminate_guest_installation_session

terminate_guest_installation_session($self)

Kill all guest installation screen processes stored in [guest_installation_session] after test finishes.

get_guest_ipaddr

get_guest_ipaddr($self, @subnets_in_route)

Get dynamic allocated guest ip address using nmap scan and store it in [guest_ipaddr].

monitor_guest_installation

monitor_guest_installation($self)

Monitor guest installation progress: If needle 'guest_installation_failures' is detected,mark it as FAILED. If needle 'text-login' is detected,this means guest installations finishes. Mark it as PASSED if ssh connection is good,otherwise mark it as FAILED. If needle 'grub2' is detected,this means guest is rebooting. Will check its result in the next round. If needle 'text-logged-in-root' is detected,this means installation screen is disconnected, terminated or broken.Will try to re-attach and check its result in the next round. If needle 'guest_installation_in_progress' is detected,this means installation is still in progress. Will check its result in the next round. If none of above needles is detected, makr it as PASSED if ssh connection to it is good, otherwise mark it as FAILED by calling check_guest_installation_result_via_ssh.

check_guest_installation_result_via_ssh

check_guest_installation_result_via_ssh($self)

Get guest ip address and check whether it is already up and running by using ip address and name sequentially. Use very common linux command 'hostname' to do the actual checking because it is almost available on any linux flavor and release.

attach_guest_installation_screen

attach_guest_installation_screen($self)

Attach guest installation screen before monitoring guest installation progress: If [guest_installation_session] is not available and no [guest_autoconsole], call do_attach_guest_installation_screen_without_sesssion. If [guest_installation_session] is not available and has [guest_autoconsole], call get_guest_installation_session, then attach based on whether installation session is available. If [guest_installation_session] is already available,call do_attach_guest_installation_screen directly.

do_attach_guest_installation_screen

do_attach_guest_installation_screen($self)

Call do_attach_guest_installation_screen_with_session anyway. Mark [guest_installation_attached] as true if needle 'text-logged-in-root' can not be detected. If fails to attach guest installation screen, [guest_installation_session] may terminate at reboot/shutoff or be in mysterious state or just broken somehow, call do_attach_guest_installation_screen_without_sesssion to re-attach.

do_attach_guest_installation_screen_with_session

do_attach_guest_installation_screen_with_session($self)

Retry attach [guest_installation_session] and detect needle 'text-logged-in-root'.

do_attach_guest_installation_screen_without_session

do_attach_guest_installation_screen_without_session($self)

If [guest_installation_session] is already terminated at reboot/shutoff or somehow, power it on and retry attaching using [guest_installation_session_command] and detect needle 'text-logged-in-root'.Mark it as FAILED if needle 'text-logged-in-root' can still be detected and poweron can not bring it back.

detach_guest_installation_screen

detach_guest_installation_screen($self)

Detach guest installation screen by calling do_detach_guest_installation_screen. Try to get guest installation screen information if [guest_installation_session] is not available.

do_detach_guest_installation_screen

do_detach_guest_installation_screen($self)

Retry doing real guest installation screen detach using send_key('ctrl-a-d') and detecting needle 'text-logged-in-root'. If either of the needles is detected, this means successful detach. If neither of the needle can be detected, recover ssh console by select_console('root-ssh').

has_autoconsole_for_sure

has_autoconsole_for_sure($self)

Return true if guest has [guest_autoconsole] and [guest_noautoconsole] that are not equal to 'none', 'true' or empty which indicates guest definitely has autoconsole. Empty value may indicate there is autoconsole or the opposite which depends on detailed configuration of guest.

has_noautoconsole_for_sure

has_noautoconsole_for_sure($self)

Return true if guest has [guest_autoconsole] or [guest_noautoconsole] that are equal to 'none' or 'true' which indicates guest definitely has no autoconsole. Empty value may indicate there is autoconsole or the opposite which depends on detailed configuration of guest.

record_guest_installation_result

record_guest_installation_result($self, $_guest_installation_result)

Record final guest installation result in [guest_installation_result] and set [stop_run] and [stop_timestamp].

collect_guest_installation_logs_via_ssh

collect_guest_installation_logs_via_ssh($self)

Collect guest y2logs via ssh and save guest config xml file.

upload_guest_installation_logs

upload_guest_installation_logs($self)

Upload logs collect by collect_guest_installation_logs_via_ssh.

detach_all_nfs_mounts

detach_all_nfs_mounts($self)

Unmount all mounted nfs shares to avoid unnecessary logs to be collected by supportconfig or sosreport which may take extremely long time.

power_cycle_guest

power_cycle_guest($self, _power_cycle_style => $_power_cycle_style)

Power cycle guest by force:virsh destroy, grace:virsh shutdown, reboot:virsh reboot and poweron:virsh start.

modify_guest_params

modify_guest_params($self, $_guest_name, $_guest_option, $_modify_operation)

Modify guest parameters after guest installation passes using virt-xml.

add_guest_device

add_guest_device()

Add device to guest after guest installation passes using virt-xml.

remove_guest_device

remove_guest_device()

Remove device from guest after guest installation passes using virt-xml.

AUTOLOAD

AUTOLOAD($self)

AUTOLOAD to be called if called subroutine does not exist.

post_fail_hook

post_fail_hook($self)

Collect logs and gues extra log '/root' by using virt_utils::collect_host_and_guest_logs. 'Root' directory on guest contains very valuable content that is generated automatically after guest installation finishes.