since we are going to reuse the same mechanism/code for network bridge
mapping.

Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---
 PVE/QemuMigrate.pm | 8 ++++----
 PVE/QemuServer.pm  | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 5c019fc..eb95762 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -336,7 +336,7 @@ sub prepare {
        my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
 
        # check if storage is available on both nodes
-       my $targetsid = 
PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
+       my $targetsid = PVE::QemuServer::map_id($self->{opts}->{storagemap}, 
$sid);
 
        my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid);
        PVE::Storage::storage_check_node($self->{storecfg}, $targetsid, 
$self->{node});
@@ -398,7 +398,7 @@ sub sync_disks {
 
            next if @{$dl->{$storeid}} == 0;
 
-           my $targetsid = 
PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $storeid);
+           my $targetsid = 
PVE::QemuServer::map_id($self->{opts}->{storagemap}, $storeid);
            # check if storage is available on target node
            PVE::Storage::storage_check_node($storecfg, $targetsid, 
$self->{node});
 
@@ -451,7 +451,7 @@ sub sync_disks {
 
            my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
 
-           my $targetsid = 
PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
+           my $targetsid = 
PVE::QemuServer::map_id($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});
@@ -612,7 +612,7 @@ sub sync_disks {
 
        foreach my $volid (sort keys %$local_volumes) {
            my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
-           my $targetsid = 
PVE::QemuServer::map_storage($self->{opts}->{storagemap}, $sid);
+           my $targetsid = 
PVE::QemuServer::map_id($self->{opts}->{storagemap}, $sid);
            my $ref = $local_volumes->{$volid}->{ref};
            if ($self->{running} && $ref eq 'config') {
                push @{$self->{online_local_volumes}}, $volid;
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fdb2ac9..685a191 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -102,7 +102,9 @@ 
PVE::JSONSchema::register_standard_option('pve-qemu-machine', {
 });
 
 
-sub map_storage {
+# maps source to target ID
+# currently used for targetstorage and targetbridge when migrating
+sub map_id {
     my ($map, $source) = @_;
 
     return $source if !defined($map);
@@ -4976,7 +4978,7 @@ sub vm_migrate_alloc_nbd_disks {
        # volume is not available there, fall back to the default format.
        # Otherwise use the same format as the original.
        if (!$storagemap->{identity}) {
-           $storeid = map_storage($storagemap, $storeid);
+           $storeid = map_id($storagemap, $storeid);
            my ($defFormat, $validFormats) = 
PVE::Storage::storage_default_format($storecfg, $storeid);
            my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
            my $fileFormat = qemu_img_format($scfg, $volname);
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to