]> git.proxmox.com Git - pmg-api.git/blobdiff - PMG/ClusterConfig.pm
integrate custom_check
[pmg-api.git] / PMG / ClusterConfig.pm
index 3440118c512e77f065c3ed66ce9f4de588f53865..af58d76573f41357d98ec3d204df4fa8411906c4 100644 (file)
@@ -155,10 +155,11 @@ my $lockfile = "/var/lock/pmgcluster.lck";
 sub lock_config {
     my ($code, $errmsg) = @_;
 
-    my $p = PVE::Tools::lock_file($lockfile, undef, $code);
+    my $res = PVE::Tools::lock_file($lockfile, undef, $code);
     if (my $err = $@) {
        $errmsg ? die "$errmsg: $err" : die $err;
     }
+    return $res;
 }
 
 sub read_cluster_conf {
@@ -174,8 +175,6 @@ sub read_cluster_conf {
     my $localip = PMG::Utils::lookup_node_ip($localname);
 
     $cinfo->{remnodes} = [];
-    $cinfo->{configport}->{0} = 83;
-    $cinfo->{dbport}->{0} = 5432;
 
     $cinfo->{local} = {
        cid => 0,
@@ -207,15 +206,9 @@ sub read_cluster_conf {
        $cinfo->{master}->{maxcid} = $maxcid;
     }
 
-    my $ind = 0;
+    my $local_cid = $cinfo->{local}->{cid};
     foreach my $cid (sort keys %{$cinfo->{ids}}) {
-       if ($cinfo->{'local'}->{cid} == $cid) { # local CID
-           $cinfo->{configport}->{$cid} = 83;
-           $cinfo->{dbport}->{$cid} = 5432;
-       } else {
-           my $portid = $ind++;
-           $cinfo->{configport}->{$cid} = 50000 + $portid;
-           $cinfo->{dbport}->{$cid} = 50100 + $portid;
+       if ($local_cid != $cid) {
            push @{$cinfo->{remnodes}}, $cid;
        }
     }