[pve-devel] [PATCH qemu-server v3 3/6] fix #4225: qemuserver, test: put eject_nonrequired_isos in place

Fiona Ebner f.ebner at proxmox.com
Fri Jan 31 10:36:14 CET 2025


Am 30.01.25 um 12:31 schrieb Daniel Herzig:
> @@ -393,6 +410,25 @@ $pci_module->mock(
>      }
>  );
>  
> +my $pve_storage_plugin_module = Test::MockModule->new("PVE::Storage::Plugin");
> +$pve_storage_plugin_module->mock(
> +    activate_storage => sub {
> +       return 1;
> +    },
> +);
> +
> +my $pve_storage_cifsplugin_module = Test::MockModule->new("PVE::Storage::CIFSPlugin");
> +$pve_storage_cifsplugin_module->mock(
> +    check_connection => sub {
> +	return 1;
> +    },
> +    cifs_is_mounted => sub {
> +	my ($scfg, $mountdata) = @_;
> +	my ($mountpoint, $server, $share) = $scfg->@{'path', 'server', 'share'};
> +	return $mountpoint;
> +    },
> +);
> +

Can't we avoid mocking PVE::Storage::Plugin and
PVE::Storage::CIFSPlugin? It should be enough to just mock the top-level
storage API from PVE::Storage. Ideally, the qemu-server package should
not have any idea how the storage package works internally. You can add
conditionals for the storage IDs if you need specific behavior for
certain storages.

>  sub diff($$) {
>      my ($a, $b) = @_;
>      return if $a eq $b;





More information about the pve-devel mailing list