]> git.proxmox.com Git - qemu-server.git/commitdiff
prefer storage_check_enabled over storage_check_node
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 18 Jun 2021 10:59:33 +0000 (12:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Jun 2021 09:17:48 +0000 (11:17 +0200)
storage_check_enabled simply checks for the 'disable' option and then calls
storage_check_node.

While not strictly necessary for a second call where only the storage differs,
e.g. in case of clone, it is more future-proof: if support for a target storage
is added at some point, it might be easy to miss adapting the call.

For the migration checks, the situation is improved by now always catching
disabled (target) storages.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index bc313f91e64da696121b972f3f640c0afacc084b..eeb07d1d167fc03bdd31cdacd69c5001cee56418 100644 (file)
@@ -3024,7 +3024,7 @@ __PACKAGE__->register_method({
            PVE::Storage::storage_check_enabled($storecfg, $storage);
            if ($target) {
                # check if storage is available on target node
-               PVE::Storage::storage_check_node($storecfg, $storage, $target);
+               PVE::Storage::storage_check_enabled($storecfg, $storage, $target);
                # clone only works if target storage is shared
                my $scfg = PVE::Storage::storage_config($storecfg, $storage);
                die "can't clone to non-shared storage '$storage'\n" if !$scfg->{shared};
@@ -3687,7 +3687,7 @@ __PACKAGE__->register_method({
        if (my $targetstorage = $param->{targetstorage}) {
            my $check_storage = sub {
                my ($target_sid) = @_;
-               PVE::Storage::storage_check_node($storecfg, $target_sid, $target);
+               PVE::Storage::storage_check_enabled($storecfg, $target_sid, $target);
                $rpcenv->check($authuser, "/storage/$target_sid", ['Datastore.AllocateSpace']);
                my $scfg = PVE::Storage::storage_config($storecfg, $target_sid);
                raise_param_exc({ targetstorage => "storage '$target_sid' does not support vm images"})
index 6375a158a6ea37933feb003202f7d2b9280a45f9..257619680d15d5f635b7dd5c3cc81c36b2214710 100644 (file)
@@ -340,8 +340,8 @@ sub prepare {
        # check if storage is available on both nodes
        my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
 
-       my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid);
-       PVE::Storage::storage_check_node($self->{storecfg}, $targetsid, $self->{node});
+       my $scfg = PVE::Storage::storage_check_enabled($self->{storecfg}, $sid);
+       PVE::Storage::storage_check_enabled($self->{storecfg}, $targetsid, $self->{node});
 
        if ($scfg->{shared}) {
            # PVE::Storage::activate_storage checks this for non-shared storages
@@ -402,7 +402,7 @@ sub scan_local_volumes {
 
            my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $storeid);
            # check if storage is available on target node
-           PVE::Storage::storage_check_node($storecfg, $targetsid, $self->{node});
+           PVE::Storage::storage_check_enabled($storecfg, $targetsid, $self->{node});
 
            # grandfather in existing mismatches
            if ($targetsid ne $storeid) {
@@ -467,8 +467,8 @@ sub scan_local_volumes {
 
            my $targetsid = PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
            # check if storage is available on both nodes
-           my $scfg = PVE::Storage::storage_check_node($storecfg, $sid);
-           PVE::Storage::storage_check_node($storecfg, $targetsid, $self->{node});
+           my $scfg = PVE::Storage::storage_check_enabled($storecfg, $sid);
+           PVE::Storage::storage_check_enabled($storecfg, $targetsid, $self->{node});
 
            return if $scfg->{shared};
 
index 6962d7d2a9e3e3e3d76cbd7b18d3f44223a78ff1..5ce3dd493e2e3cbdd83f5a196d68caa2a5bf7f3f 100644 (file)
@@ -2458,8 +2458,8 @@ sub check_storage_availability {
        return if !$sid;
 
        # check if storage is available on both nodes
-       my $scfg = PVE::Storage::storage_check_node($storecfg, $sid);
-       PVE::Storage::storage_check_node($storecfg, $sid, $node);
+       my $scfg = PVE::Storage::storage_check_enabled($storecfg, $sid);
+       PVE::Storage::storage_check_enabled($storecfg, $sid, $node);
    });
 }