Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package os-autoinst for openSUSE:Factory checked in at 2026-03-27 16:50:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/os-autoinst (Old) and /work/SRC/openSUSE:Factory/.os-autoinst.new.8177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "os-autoinst" Fri Mar 27 16:50:31 2026 rev:579 rq:1343075 version:5.1774551362.dd2a78c Changes: -------- --- /work/SRC/openSUSE:Factory/os-autoinst/os-autoinst.changes 2026-03-27 06:46:21.430177535 +0100 +++ /work/SRC/openSUSE:Factory/.os-autoinst.new.8177/os-autoinst.changes 2026-03-27 16:53:00.452237061 +0100 @@ -1,0 +2,11 @@ +Fri Mar 27 01:51:47 UTC 2026 - [email protected] + +- Update to version 5.1774551362.dd2a78c: + * feat(svirt): add "stop_vm" in consoles::sshVirtsh + * feat: correct isotovideo handle_shutdown log calls + * refactor(consoles/sshVirtsh): properly concatenate remote_vmm + * feat(svirt): retry disk create also in case of copy-img + * chore: Reduce permissions of workflows + * feat(VNC): Add AltGr key + +------------------------------------------------------------------- Old: ---- os-autoinst-5.1774435114.41aff24.obscpio New: ---- os-autoinst-5.1774551362.dd2a78c.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ os-autoinst-devel-test.spec ++++++ --- /var/tmp/diff_new_pack.3KcRPu/_old 2026-03-27 16:53:02.284315661 +0100 +++ /var/tmp/diff_new_pack.3KcRPu/_new 2026-03-27 16:53:02.284315661 +0100 @@ -18,7 +18,7 @@ %define short_name os-autoinst-devel Name: %{short_name}-test -Version: 5.1774435114.41aff24 +Version: 5.1774551362.dd2a78c Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-openvswitch-test.spec ++++++ --- /var/tmp/diff_new_pack.3KcRPu/_old 2026-03-27 16:53:02.420321497 +0100 +++ /var/tmp/diff_new_pack.3KcRPu/_new 2026-03-27 16:53:02.432322011 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst-openvswitch Name: %{short_name}%{?name_ext} -Version: 5.1774435114.41aff24 +Version: 5.1774551362.dd2a78c Release: 0 Summary: test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-test.spec ++++++ --- /var/tmp/diff_new_pack.3KcRPu/_old 2026-03-27 16:53:02.588328704 +0100 +++ /var/tmp/diff_new_pack.3KcRPu/_new 2026-03-27 16:53:02.592328875 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst Name: %{short_name}%{?name_ext} -Version: 5.1774435114.41aff24 +Version: 5.1774551362.dd2a78c Release: 0 Summary: test package for os-autoinst License: GPL-2.0-or-later ++++++ os-autoinst.spec ++++++ --- /var/tmp/diff_new_pack.3KcRPu/_old 2026-03-27 16:53:02.792337261 +0100 +++ /var/tmp/diff_new_pack.3KcRPu/_new 2026-03-27 16:53:02.796337428 +0100 @@ -17,7 +17,7 @@ Name: os-autoinst -Version: 5.1774435114.41aff24 +Version: 5.1774551362.dd2a78c Release: 0 Summary: OS-level test automation License: GPL-2.0-or-later ++++++ os-autoinst-5.1774435114.41aff24.obscpio -> os-autoinst-5.1774551362.dd2a78c.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/author-tests.yaml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/author-tests.yaml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/author-tests.yaml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/author-tests.yaml 2026-03-26 19:56:02.000000000 +0100 @@ -5,6 +5,8 @@ jobs: author-tests: + permissions: + contents: read runs-on: ubuntu-latest name: Author tests container: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/checklist.yml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/checklist.yml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/checklist.yml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/checklist.yml 2026-03-26 19:56:02.000000000 +0100 @@ -3,6 +3,9 @@ on: [pull_request_target] jobs: checklist_job: + permissions: + contents: read + pull-requests: write runs-on: ubuntu-latest name: Checklist job steps: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/ci.yml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/ci.yml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/ci.yml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/ci.yml 2026-03-26 19:56:02.000000000 +0100 @@ -7,6 +7,8 @@ PERL_TEST_WARNINGS_ONLY_REPORT_WARNINGS: 0 jobs: test: + permissions: + contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/ci_extended.yml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/ci_extended.yml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/ci_extended.yml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/ci_extended.yml 2026-03-26 19:56:02.000000000 +0100 @@ -10,6 +10,8 @@ - container/** jobs: test-containers: + permissions: + contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/commit-message-checker.yml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/commit-message-checker.yml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/commit-message-checker.yml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/commit-message-checker.yml 2026-03-26 19:56:02.000000000 +0100 @@ -10,4 +10,6 @@ jobs: check-commit-message: + permissions: + contents: read uses: os-autoinst/os-autoinst-common/.github/workflows/base-commit-message-checker.yml@master diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/obs-helper.yaml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/obs-helper.yaml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/obs-helper.yaml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/obs-helper.yaml 2026-03-26 19:56:02.000000000 +0100 @@ -9,6 +9,7 @@ name: Report OBS URL runs-on: ubuntu-latest permissions: + contents: read issues: write steps: - uses: actions/checkout@v4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/.github/workflows/openqa_fullstack.yml new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/openqa_fullstack.yml --- old/os-autoinst-5.1774435114.41aff24/.github/workflows/openqa_fullstack.yml 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/.github/workflows/openqa_fullstack.yml 2026-03-26 19:56:02.000000000 +0100 @@ -18,6 +18,8 @@ jobs: fullstack: + permissions: + contents: read runs-on: ubuntu-latest container: image: registry.opensuse.org/devel/openqa/ci/containers/base:latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/OpenQA/Isotovideo/Interface.pm new/os-autoinst-5.1774551362.dd2a78c/OpenQA/Isotovideo/Interface.pm --- old/os-autoinst-5.1774435114.41aff24/OpenQA/Isotovideo/Interface.pm 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/OpenQA/Isotovideo/Interface.pm 2026-03-26 19:56:02.000000000 +0100 @@ -9,7 +9,7 @@ # -> increment on every change of such APIs # -> never move that variable to another place (when refactoring) # because it may be accessed by the tests itself -our $version = 50; +our $version = 51; # major version of the (web socket) API relevant to the developer mode # -> increment when making non-backward compatible changes to that API diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/backend/svirt.pm new/os-autoinst-5.1774551362.dd2a78c/backend/svirt.pm --- old/os-autoinst-5.1774435114.41aff24/backend/svirt.pm 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/backend/svirt.pm 2026-03-26 19:56:02.000000000 +0100 @@ -42,6 +42,12 @@ sub vmname ($self) { $self->console('svirt')->name } +sub virsh () { + my $virsh = 'virsh'; + $virsh .= ' ' . $bmwqemu::vars{VMWARE_REMOTE_VMM} if $bmwqemu::vars{VMWARE_REMOTE_VMM}; + return $virsh; +} + # we don't do anything actually sub do_start_vm ($self, @) { my $vars = \%bmwqemu::vars; @@ -72,10 +78,8 @@ sub do_stop_vm_svirt ($self) { my $vmname = $self->vmname; - my $virsh = 'virsh'; - $virsh .= ' ' . $bmwqemu::vars{VMWARE_REMOTE_VMM} if $bmwqemu::vars{VMWARE_REMOTE_VMM}; - $self->run_ssh_cmd("$virsh destroy $vmname"); - $self->run_ssh_cmd("$virsh undefine --snapshots-metadata $vmname"); + $self->run_ssh_cmd(virsh() . " destroy $vmname"); + $self->run_ssh_cmd(virsh() . " undefine --snapshots-metadata $vmname"); } sub do_stop_vm ($self, @) { @@ -117,8 +121,7 @@ sub is_shutdown_cmd_hyperv ($vmname) { qq{powershell -Command "if (\$(Get-VM -VMName $vmname \| Where-Object {\$_.state -eq 'Off'})) { exit 1 } else { exit 0 }"} } sub is_shutdown_cmd_svirt ($vmname) { - my $libvirt_connector = $bmwqemu::vars{VMWARE_REMOTE_VMM} // ''; - return "! virsh $libvirt_connector dominfo $vmname | grep -w 'shut off'"; + return '! ' . virsh() . " dominfo $vmname | grep -w 'shut off'"; } sub is_shutdown ($self, @) { @@ -132,8 +135,7 @@ } sub save_snapshot_cmd_svirt ($vmname, $snapname) { - my $libvirt_connector = $bmwqemu::vars{VMWARE_REMOTE_VMM} // ''; - return "virsh $libvirt_connector snapshot-delete $vmname $snapname; virsh $libvirt_connector snapshot-create-as $vmname $snapname"; + return virsh() . " snapshot-delete $vmname $snapname; " . virsh() . " snapshot-create-as $vmname $snapname"; } sub save_snapshot ($self, $args) { @@ -167,8 +169,7 @@ } } else { - my $libvirt_connector = $bmwqemu::vars{VMWARE_REMOTE_VMM} // ''; - $rsp = $self->run_ssh_cmd("virsh $libvirt_connector snapshot-revert $vmname $snapname"); + $rsp = $self->run_ssh_cmd(virsh() . " snapshot-revert $vmname $snapname"); $post_load_snapshot_command = 'vmware_fixup' if _is_vmware; } bmwqemu::diag "LOAD snapshot $snapname to $vmname, return code=$rsp"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/consoles/VNC.pm new/os-autoinst-5.1774551362.dd2a78c/consoles/VNC.pm --- old/os-autoinst-5.1774435114.41aff24/consoles/VNC.pm 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/consoles/VNC.pm 2026-03-26 19:56:02.000000000 +0100 @@ -508,6 +508,7 @@ 'caps' => 0xffe5, 'meta' => 0xffe7, # left, right is e8 'alt' => 0xffe9, # left one, right is ea + 'altgr' => 0xffea, # alt-graphical, right alt key 'ret' => 0xff0d, 'tab' => 0xff09, 'backspace' => 0xff08, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/consoles/sshVirtsh.pm new/os-autoinst-5.1774551362.dd2a78c/consoles/sshVirtsh.pm --- old/os-autoinst-5.1774435114.41aff24/consoles/sshVirtsh.pm 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/consoles/sshVirtsh.pm 2026-03-26 19:56:02.000000000 +0100 @@ -300,6 +300,26 @@ return; } +sub _do_create_disk ($self, $file, $size, $args = undef) { + my $bucket = 5; + my @cmd = "qemu-img create '$file' -f qcow2"; + push @cmd, $args->{additional_args} if $args->{additional_args}; + push @cmd, $size; + + # Avoid qemu-img's failure to get a write lock to be the reason for a job to fail + while (1) { + my ($ret, $stdout, $stderr) = $self->run_cmd((join ' ', @cmd), wantarray => 1); + if (($stderr // '') =~ /lock/i) { + $bucket--; + die 'Too many attempts to create disk' unless $bucket; + bmwqemu::diag("Resource is still not free, waiting a bit more. $bucket attempts left"); + sleep 5; + next; + } + last unless $ret; + } +} + sub _create_disk ($self, $args, $vmware_openqa_datastore, $file, $name, $basedir) { my $size = $args->{size} || '20G'; if ($self->vmm_family eq 'vmware') { @@ -319,19 +339,7 @@ } else { $file = $basedir . $file; - my $bucket = 5; - # Avoid qemu-img's failure to get a write lock to be the reason for a job to fail - while (1) { - my ($ret, $stdout, $stderr) = $self->run_cmd("qemu-img create $file $size -f qcow2", wantarray => 1); - if ($stderr =~ /lock/i) { - $bucket--; - die 'Too many attempts to format HDD' unless $bucket; - bmwqemu::diag("Resource is still not free, waiting a bit more. $bucket attempts left"); - sleep 5; - next; - } - last unless $ret; - } + $self->_do_create_disk($file, $size); } return $file; } @@ -469,8 +477,7 @@ my (undef, $json) = $self->run_cmd("qemu-img info --output=json $args->{file}", wantarray => 1); my $image_vsize = decode_json($json)->{'virtual-size'}; $size = (($size * 1024 * 1024 * 1024) <= $image_vsize) ? $image_vsize : $size . 'G'; - $self->run_cmd(sprintf("qemu-img create '${file}' -f qcow2 -F qcow2 -b '$basedir/%s' ${size}", $file_basename)) - && die 'qemu-img create with backing file failed'; + $self->_do_create_disk($file, $size, {additional_args => "-F qcow2 -b '$basedir/$file_basename'"}); } return $file; } @@ -542,19 +549,13 @@ return; } -sub virsh () { - my $virsh = 'virsh'; - $virsh .= ' ' . $bmwqemu::vars{VMWARE_REMOTE_VMM} if $bmwqemu::vars{VMWARE_REMOTE_VMM}; - return $virsh; -} - sub suspend ($self) { - $self->run_cmd(virsh() . ' suspend ' . $self->name) && die q{Can't suspend VM }; + $self->run_cmd(backend::svirt::virsh() . ' suspend ' . $self->name) && die q{Can't suspend VM }; bmwqemu::diag 'VM ' . $self->name . ' suspended'; } sub resume ($self) { - $self->run_cmd(virsh() . ' resume ' . $self->name) && die q{Can't resume VM }; + $self->run_cmd(backend::svirt::virsh() . ' resume ' . $self->name) && die q{Can't resume VM }; bmwqemu::diag 'VM ' . $self->name . ' resumed'; } @@ -574,8 +575,9 @@ return $encoded_config; } -sub define_and_start ($self) { - my $remote_vmm = ''; +sub define_and_start ($self, %args) { + $args{pre_cleanup} //= 1; + my $remote_vmm; if ($self->vmm_family eq 'vmware') { my ($fh, $libvirtauthfilename) = File::Temp::tempfile('libvirtauth-XXXX', DIR => '/tmp/'); @@ -607,14 +609,11 @@ $chan->send_eof(); $chan->close(); - # shut down possibly running previous test (just to be sure) - ignore errors - # just making sure we continue after the command finished - my $ignore = ' |& grep -v "\(failed to get domain\|Domain not found\)"'; - $self->run_cmd("virsh $remote_vmm destroy " . $self->name . $ignore); - $self->run_cmd("virsh $remote_vmm undefine --snapshots-metadata " . $self->name . $ignore); + # shut down possibly running previous test (just to be sure) + $self->backend->do_stop_vm_svirt() if $args{pre_cleanup}; # define the new domain - $self->run_cmd("virsh $remote_vmm define $xmlfilename") && die 'virsh define failed'; + $self->run_cmd(backend::svirt::virsh() . " define $xmlfilename") && die 'virsh define failed'; if ($self->vmm_family eq 'vmware') { my $vmx = sprintf('/vmfs/volumes/%s/openQA/%s.vmx', $bmwqemu::vars{VMWARE_DATASTORE} // 'datastore1', $self->name); @@ -656,9 +655,9 @@ } } - $ret = $self->run_cmd("virsh $remote_vmm start " . $self->name . ' 2> >(tee /tmp/os-autoinst-' . $self->name . '-stderr.log >&2)'); + $ret = $self->run_cmd(backend::svirt::virsh() . ' start ' . $self->name . ' 2> >(tee /tmp/os-autoinst-' . $self->name . '-stderr.log >&2)'); bmwqemu::diag('Dump actually used libvirt configuration file ' . ($ret ? '(broken)' : '(working)')); - my $config = $self->get_cmd_output("virsh $remote_vmm dumpxml " . $self->name); + my $config = $self->get_cmd_output(backend::svirt::virsh() . ' dumpxml ' . $self->name); die "virsh start failed: $ret\n\nvirsh domain XML:\n$config" if $ret; my $config_domain = Mojo::DOM->new($config)->at('domain'); my $vm_id = $config_domain ? $config_domain->attr('id') : ''; @@ -670,6 +669,10 @@ return; } +sub stop_vm ($self) { + $self->backend->do_stop_vm_svirt(); +} + sub attach_to_running ($self, $args = undef) { $args = {name => $args} unless ref $args; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/script/isotovideo new/os-autoinst-5.1774551362.dd2a78c/script/isotovideo --- old/os-autoinst-5.1774435114.41aff24/script/isotovideo 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/script/isotovideo 2026-03-26 19:56:02.000000000 +0100 @@ -141,7 +141,7 @@ sub handle_shutdown () { # terminate/kill the command server and let it inform its websocket clients before - diag('isotovideo handle_shutdown'); + diag('isotovideo starting handle_shutdown'); $runner->stop_commands('test execution ended'); if ($runner->testfd) { # unusual shutdown @@ -149,10 +149,10 @@ CORE::close $runner->testfd; # uncoverable statement $runner->stop_autotest(); # uncoverable statement } - diag 'isotovideo ' . ($RETURN_CODE ? 'failed' : 'done'); my $clean_shutdown = $runner->handle_shutdown(\$RETURN_CODE); bmwqemu::load_vars(); # read calculated variables from backend and tests $RETURN_CODE = handle_generated_assets($runner->command_handler, $clean_shutdown) unless $RETURN_CODE; + diag 'isotovideo completed handle_shutdown: ' . ($RETURN_CODE ? 'failed' : 'done'); } GetOptions(\%options, 'debug|d', 'workdir=s', 'color=s', 'help|h|?', 'version|v', 'exit-status-from-test-results|e') or usage(1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/t/22-svirt.t new/os-autoinst-5.1774551362.dd2a78c/t/22-svirt.t --- old/os-autoinst-5.1774435114.41aff24/t/22-svirt.t 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/t/22-svirt.t 2026-03-26 19:56:02.000000000 +0100 @@ -144,18 +144,12 @@ like $svirt_console->{domainxml}->toString, qr/<funny><guy hello="world"\/><\/funny>/i, 'set attributes successfully in the domain XML'; }; -subtest 'check virsh() method' => sub { - $bmwqemu::vars{VMWARE_REMOTE_VMM} = 'my_vmm'; - my $virsh = consoles::sshVirtsh::virsh(); - is $virsh, 'virsh my_vmm', 'correct output from virsh()'; -}; - subtest 'check suspend() method' => sub { my $console_mock = Test::MockModule->new('consoles::sshVirtsh'); my @cmds; $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $svirt_console->suspend(); - is_deeply \@cmds, ['virsh my_vmm suspend openQA-SUT-1'], 'correct command from suspend()'; + is_deeply \@cmds, ['virsh suspend openQA-SUT-1'], 'correct command from suspend()'; }; subtest 'check resume() method' => sub { @@ -163,7 +157,15 @@ my @cmds; $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $svirt_console->resume(); - is_deeply \@cmds, ['virsh my_vmm resume openQA-SUT-1'], 'correct command from suspend()'; + is_deeply \@cmds, ['virsh resume openQA-SUT-1'], 'correct command from suspend()'; +}; + +subtest 'check stop_vm() method' => sub { + my $backend_mock = Test::MockModule->new('backend::svirt'); + my $called = 0; + $backend_mock->redefine(do_stop_vm_svirt => sub { $called = 1 }); + $svirt_console->stop_vm(); + is $called, 1, 'do_stop_vm_svirt called from stop_vm()'; }; subtest 'check get_remote_vmm() method' => sub { @@ -197,10 +199,11 @@ my $backend_mock = Test::MockModule->new('backend::svirt'); my $console_mock = Test::MockModule->new('consoles::sshVirtsh'); my $tmp_mock = Test::MockModule->new('File::Temp'); - my (@cmds, @ssh_cmds); + my @cmds; $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $console_mock->redefine(get_cmd_output => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); - $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { push @ssh_cmds, $cmd; (undef, $chan_mock) }); + $backend_mock->redefine(run_ssh_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); + $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { (undef, $chan_mock) }); $backend_mock->redefine(start_serial_grab => 1); $console_mock->redefine(get_ssh_credentials => sub { (hostname => 'foo', username => 'root', password => '123') }); $tmp_mock->redefine(tempfile => sub { (undef, '/t') }); @@ -209,8 +212,8 @@ like shift @cmds, qr/cat > \/t <<.*username=u.*password=p.*auth-esx-h/s, 'config written'; my $s = 'virsh -c esx://u@h/?no_verify=1\\&authfile=/t '; is_deeply \@cmds, [ - $s . ' destroy openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', - $s . ' undefine --snapshots-metadata openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', + $s . ' destroy openQA-SUT-1', + $s . ' undefine --snapshots-metadata openQA-SUT-1', $s . ' define /var/lib/libvirt/images/openQA-SUT-1.xml', 'echo \'bios.bootDelay = "10000"\' >> /vmfs/volumes/datastore1/openQA/openQA-SUT-1.vmx', 'test -e /vmfs/volumes/datastore1/openQA/openQA-SUT-1.nvram', @@ -270,10 +273,11 @@ my $backend_mock = Test::MockModule->new('backend::svirt'); my $console_mock = Test::MockModule->new('consoles::sshVirtsh'); my $tmp_mock = Test::MockModule->new('File::Temp'); - my (@cmds, @ssh_cmds); + my @cmds; $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $console_mock->redefine(get_cmd_output => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); - $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { push @ssh_cmds, $cmd; (undef, $chan_mock) }); + $backend_mock->redefine(run_ssh_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); + $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { (undef, $chan_mock) }); $backend_mock->redefine(start_serial_grab => 1); $console_mock->redefine(get_ssh_credentials => sub { (hostname => 'foo', username => 'root', password => '123') }); $tmp_mock->redefine(tempfile => sub { (undef, '/t') }); @@ -283,8 +287,8 @@ like shift @cmds, qr/cat > \/t <<.*username=u.*password=p.*auth-esx-h/s, 'config written'; my $s = 'virsh -c esx://u@h/?no_verify=1\\&authfile=/t '; is_deeply \@cmds, [ - $s . ' destroy openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', - $s . ' undefine --snapshots-metadata openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', + $s . ' destroy openQA-SUT-1', + $s . ' undefine --snapshots-metadata openQA-SUT-1', $s . ' define /var/lib/libvirt/images/openQA-SUT-1.xml', 'echo \'bios.bootDelay = "10000"\' >> /vmfs/volumes/datastore1/openQA/openQA-SUT-1.vmx', 'test -e /vmfs/volumes/datastore1/openQA/openQA-SUT-1.nvram', @@ -307,10 +311,11 @@ my $backend_mock = Test::MockModule->new('backend::svirt'); my $console_mock = Test::MockModule->new('consoles::sshVirtsh'); my $tmp_mock = Test::MockModule->new('File::Temp'); - my (@cmds, @ssh_cmds); + my @cmds; $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $console_mock->redefine(get_cmd_output => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); - $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { push @ssh_cmds, $cmd; (undef, $chan_mock) }); + $backend_mock->redefine(run_ssh_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); + $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { (undef, $chan_mock) }); $backend_mock->redefine(start_serial_grab => 1); $console_mock->redefine(get_ssh_credentials => sub { (hostname => 'foo', username => 'root', password => '123') }); $tmp_mock->redefine(tempfile => sub { (undef, '/t') }); @@ -320,8 +325,8 @@ like shift @cmds, qr/cat > \/t <<.*username=u.*password=p.*auth-esx-h/s, 'config written'; my $s = 'virsh -c esx://u@h/?no_verify=1\\&authfile=/t '; is_deeply \@cmds, [ - $s . ' destroy openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', - $s . ' undefine --snapshots-metadata openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', + $s . ' destroy openQA-SUT-1', + $s . ' undefine --snapshots-metadata openQA-SUT-1', $s . ' define /var/lib/libvirt/images/openQA-SUT-1.xml', 'echo \'bios.bootDelay = "10000"\' >> /vmfs/volumes/datastore1/openQA/openQA-SUT-1.vmx', 'test -e /vmfs/volumes/datastore1/openQA/openQA-SUT-1.nvram', @@ -348,6 +353,7 @@ my (@cmds, @ssh_cmds); $console_mock->redefine(run_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $console_mock->redefine(get_cmd_output => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); + $backend_mock->redefine(run_ssh_cmd => sub ($self, $cmd, %args) { push @cmds, $cmd; 0 }); $backend_mock->redefine(run_ssh => sub ($self, $cmd, %args) { push @ssh_cmds, $cmd; (undef, $chan_mock) }); $backend_mock->redefine(start_serial_grab => 1); $console_mock->redefine(get_ssh_credentials => sub { (hostname => 'foo', username => 'root', password => '123') }); @@ -358,8 +364,8 @@ like shift @cmds, qr/cat > \/t <<.*username=u.*password=p.*auth-esx-h/s, 'config written'; my $s = 'virsh -c esx://u@h/?no_verify=1\\&authfile=/t '; is_deeply \@cmds, [ - $s . ' destroy openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', - $s . ' undefine --snapshots-metadata openQA-SUT-1 |& grep -v "\\(failed to get domain\\|Domain not found\\)"', + $s . ' destroy openQA-SUT-1', + $s . ' undefine --snapshots-metadata openQA-SUT-1', $s . ' define /var/lib/libvirt/images/openQA-SUT-1.xml', 'echo \'bios.bootDelay = "10000"\' >> /vmfs/volumes/datastore1/openQA/openQA-SUT-1.vmx', 'test -e /vmfs/volumes/datastore1/openQA/openQA-SUT-1.nvram', @@ -734,11 +740,11 @@ my $dev_id = 'dev_id_005'; my $exp_file = $svirt->name . $dev_id . '.img'; - throws_ok { $svirt->add_disk({create => 1, size => '88G', dev_id => $dev_id}) } qr/Too many attempts to format HDD/, 'Died after 5 retry attempts'; + throws_ok { $svirt->add_disk({create => 1, size => '88G', dev_id => $dev_id}) } qr/Too many attempts to create disk/, 'Died after 5 retry attempts'; @ssh_cmd_return = ([1, '', 'lock'], [1, '', 'lock'], [1, '', 'lock'], [1, '', 'lock'], [0, '', '']); $svirt->add_disk({create => 1, size => '88G', dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file 88G -f qcow2", 'Triggered img creation, after 4 errors'); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 88G", 'Triggered img creation, after 4 errors'); @ssh_cmd_return = ([0, '', ''], [0, '', ''], [0, '', ''], [0, '', ''], [0, '', '']); @@ -748,7 +754,7 @@ $exp_file = $svirt->name . $dev_id . '.img'; $svirt->add_disk({create => 1, size => $size, dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file $size -f qcow2", "Check different size type $size"); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 $size", "Check different size type $size"); } }; @@ -756,7 +762,7 @@ $dev_id = 'dev_id_007_NO_SIZE'; $exp_file = $svirt->name . $dev_id . '.img'; $svirt->add_disk({create => 1, dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file 20G -f qcow2", 'Check for default size 20G'); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 20G", 'Check for default size 20G'); }; # Reset xml @@ -768,7 +774,7 @@ @ssh_cmd_return = ([0, '', '']); @last_ssh_commands = (); $svirt->add_disk({create => 1, size => '999G', dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file 999G -f qcow2", 'Check create image was triggered'); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 999G", 'Check create image was triggered'); svirt_xml_validate($svirt, dev => 'xvd' . $dev_id, @@ -873,13 +879,13 @@ my $dev_id = 'dev_id_013' . $size; my $exp_file = $svirt->name . $dev_id . '.img'; $svirt->add_disk({create => 1, size => $size, dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file $size -f qcow2", "Check different size type $size"); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 $size", "Check different size type $size"); } my $dev_id = 'dev_id_014_NO_SIZE'; my $exp_file = $svirt->name . $dev_id . '.img'; $svirt->add_disk({create => 1, dev_id => $dev_id}); - is($last_ssh_commands[-1], "qemu-img create $basedir$exp_file 20G -f qcow2", 'Default size is 20G'); + is($last_ssh_commands[-1], "qemu-img create '$basedir$exp_file' -f qcow2 20G", 'Default size is 20G'); }; subtest 'family svirt-xen-hvm backingfile=1' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-5.1774435114.41aff24/t/29-backend-svirt.t new/os-autoinst-5.1774551362.dd2a78c/t/29-backend-svirt.t --- old/os-autoinst-5.1774435114.41aff24/t/29-backend-svirt.t 2026-03-25 11:38:34.000000000 +0100 +++ new/os-autoinst-5.1774551362.dd2a78c/t/29-backend-svirt.t 2026-03-26 19:56:02.000000000 +0100 @@ -120,4 +120,10 @@ is $backend->is_shutdown, 'Power OFF', 'can call is_shutdown'; }; +subtest 'check virsh() method' => sub { + $bmwqemu::vars{VMWARE_REMOTE_VMM} = 'my_vmm'; + my $virsh = backend::svirt::virsh(); + is $virsh, 'virsh my_vmm', 'correct output from virsh()'; +}; + done_testing; ++++++ os-autoinst.obsinfo ++++++ --- /var/tmp/diff_new_pack.3KcRPu/_old 2026-03-27 16:53:05.456448785 +0100 +++ /var/tmp/diff_new_pack.3KcRPu/_new 2026-03-27 16:53:05.460448952 +0100 @@ -1,5 +1,5 @@ name: os-autoinst -version: 5.1774435114.41aff24 -mtime: 1774435114 -commit: 41aff24aeef5d4ce83a117e0a070e8edcecbff42 +version: 5.1774551362.dd2a78c +mtime: 1774551362 +commit: dd2a78cacef0b65bcb91483b21415b09b5ce6cf6
