lib/publiccloud/instance.pm

run_ssh_command

    run_ssh_command(cmd => 'command'[, timeout => 90][, ssh_opts =>'..'][, username => 'XXX'][, no_quote => 0][, rc_only => 0]);

Runs a command cmd via ssh in the given VM. Retrieves the output. If the command retrieves not zero, a exception is thrown.. Timeout can be set by timeout or 90 sec by default. <proceed_on_failure=1>> allows to proceed with validation when cmd is failing (return non-zero exit code) By default, the command is passed in single quotes to SSH. To avoid quoting us <no_quote=1>>. With <ssh_opts='...'>> you can overwrite all default ops which are in <$instance-ssh_opts>>. Use argument username to specify a different username then <$instance-username()>>. Use argument rc_only to only check for the return code of the command.

scp

    scp($from, $to, timeout => 90);

Use scp to copy a file from or to this instance. A url starting with remote: is replaced with the IP from this instance. E.g. a call to copy the file /var/log/cloudregister to /tmp looks like: <<$instance-scp('remote:/var/log/cloudregister', '/tmp');>>>

upload_log

    upload_log($filename);

Upload a file from this instance to openqa using upload_logs(). If the file doesn't exists on the instance, no error is thrown.

wait_for_guestregister

    wait_for_guestregister([timeout => 300]);

Run command systemctl is-active guestregister on the instance in a loop and wait till guestregister is ready. If guestregister finish with state failed, a soft-failure will be recorded. If guestregister will not finish within timeout seconds, job dies.

wait_for_ssh

    wait_for_ssh([timeout => 600] [, proceed_on_failure => 0])

Check if the SSH port of the instance is reachable and open.

softreboot

    ($shutdown_time, $bootup_time) = softreboot([timeout => 600]);

Does a softreboot of the instance by running the command shutdown -r. Return an array of two values, first one is the time till the instance isn't reachable anymore. The second one is the estimated bootup time.

stop

    stop();

Stop the instance using the CSP api calls.

start

    start([timeout => ?]);

Start the instance and check SSH connectivity. Return the number of seconds till the SSH port was available.