]> git.proxmox.com Git - pve-cluster.git/commitdiff
move corosync_link schema to Corosync.pm
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Nov 2019 10:27:58 +0000 (11:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Nov 2019 09:39:51 +0000 (10:39 +0100)
since it can be/is already used by all relevant files, and it is not
related at all to pmxcfs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
data/PVE/API2/ClusterConfig.pm
data/PVE/CLI/pvecm.pm
data/PVE/Cluster.pm
data/PVE/Cluster/Setup.pm
data/PVE/Corosync.pm

index e6f47a63c4db36b1e3e6d31a5a63c3781c6494fa..c426a307759f66dcd441ff484d6146026d048715 100644 (file)
@@ -253,8 +253,8 @@ __PACKAGE__->register_method ({
                }
            };
 
-           my $link0 = PVE::Cluster::parse_corosync_link($param->{link0});
-           my $link1 = PVE::Cluster::parse_corosync_link($param->{link1});
+           my $link0 = PVE::Corosync::parse_corosync_link($param->{link0});
+           my $link1 = PVE::Corosync::parse_corosync_link($param->{link1});
 
            $check_duplicate_addr->($link0);
            $check_duplicate_addr->($link1);
index 48c110bef77a03f0fb25d6ded41c31d5978b2092..0fed6cbb06717a31646a06840a1b8b35a4e58975 100755 (executable)
@@ -357,8 +357,8 @@ __PACKAGE__->register_method ({
        my $host = $param->{hostname};
        my $local_ip_address = PVE::Cluster::remote_node_ip($nodename);
 
-       my $link0 = PVE::Cluster::parse_corosync_link($param->{link0});
-       my $link1 = PVE::Cluster::parse_corosync_link($param->{link1});
+       my $link0 = PVE::Corosync::parse_corosync_link($param->{link0});
+       my $link1 = PVE::Corosync::parse_corosync_link($param->{link1});
 
        PVE::Cluster::Setup::assert_joinable($local_ip_address, $link0, $link1, $param->{force});
 
index 28f59eb33035af09b1b54333ed91e169bee9ff74..b5157bac3a27c520658279024dead9c8121e9c7d 100644 (file)
@@ -1184,37 +1184,6 @@ sub ssh_info_to_command {
     return $cmd;
 }
 
-my $corosync_link_format = {
-    address => {
-       default_key => 1,
-       type => 'string', format => 'address',
-       format_description => 'IP',
-       description => "Hostname (or IP) of this corosync link address.",
-    },
-    priority => {
-       optional => 1,
-       type => 'integer',
-       minimum => 0,
-       maximum => 255,
-       default => 0,
-       description => "The priority for the link when knet is used in 'passive' mode. Lower value means higher priority.",
-    },
-};
-my $corosync_link_desc = {
-    type => 'string', format => $corosync_link_format,
-    description => "Address and priority information of a single corosync link.",
-    optional => 1,
-};
-PVE::JSONSchema::register_standard_option("corosync-link", $corosync_link_desc);
-
-sub parse_corosync_link {
-    my ($value) = @_;
-
-    return undef if !defined($value);
-
-    return PVE::JSONSchema::parse_property_string($corosync_link_format, $value);
-}
-
 # NOTE: filesystem must be offline here, no DB changes allowed
 sub cfs_backup_database {
     mkdir $dbbackupdir;
index e81a11088cbbbd11cbc74570e7b8c487b2823d4e..81e3ef839e638f463a5c4d3c00168e648aea5b7b 100644 (file)
@@ -13,6 +13,7 @@ use POSIX qw(EEXIST);
 
 use PVE::APIClient::LWP;
 use PVE::Cluster;
+use PVE::Corosync;
 use PVE::INotify;
 use PVE::JSONSchema;
 use PVE::Network;
@@ -618,8 +619,8 @@ sub join {
     my $nodename = PVE::INotify::nodename();
     my $local_ip_address = PVE::Cluster::remote_node_ip($nodename);
 
-    my $link0 = PVE::Cluster::parse_corosync_link($param->{link0});
-    my $link1 = PVE::Cluster::parse_corosync_link($param->{link1});
+    my $link0 = PVE::Corosync::parse_corosync_link($param->{link0});
+    my $link1 = PVE::Corosync::parse_corosync_link($param->{link1});
 
     # check if we can join with the given parameters and current node state
     assert_joinable($local_ip_address, $link0, $link1, $param->{force});
index c0b9075686baf5fa52a594732109f9697fb671ec..d1b85dc6b72b72a81b45da5a896288aa665e8863 100644 (file)
@@ -9,6 +9,7 @@ use Socket qw(AF_INET AF_INET6 inet_ntop);
 use Net::IP qw(ip_is_ipv6);
 
 use PVE::Cluster;
+use PVE::JSONSchema;
 use PVE::Tools;
 use PVE::Tools qw($IPV4RE $IPV6RE);
 
@@ -19,6 +20,37 @@ my $conf_array_sections = {
     interface => 1,
 };
 
+my $corosync_link_format = {
+    address => {
+       default_key => 1,
+       type => 'string', format => 'address',
+       format_description => 'IP',
+       description => "Hostname (or IP) of this corosync link address.",
+    },
+    priority => {
+       optional => 1,
+       type => 'integer',
+       minimum => 0,
+       maximum => 255,
+       default => 0,
+       description => "The priority for the link when knet is used in 'passive' mode. Lower value means higher priority.",
+    },
+};
+my $corosync_link_desc = {
+    type => 'string', format => $corosync_link_format,
+    description => "Address and priority information of a single corosync link.",
+    optional => 1,
+};
+PVE::JSONSchema::register_standard_option("corosync-link", $corosync_link_desc);
+
+sub parse_corosync_link {
+    my ($value) = @_;
+
+    return undef if !defined($value);
+
+    return PVE::JSONSchema::parse_property_string($corosync_link_format, $value);
+}
+
 # a very simply parser ...
 sub parse_conf {
     my ($filename, $raw) = @_;