]> git.proxmox.com Git - pve-cluster.git/commitdiff
add new corosync-link format
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 28 May 2019 16:04:04 +0000 (18:04 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 13 Jun 2019 08:20:02 +0000 (10:20 +0200)
use a format string this time, so we can drop the parameter count a
bit. With address as default_key we can still use it conveniently
from CLI.

There will be the link priority flag added in a future patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/PVE/Cluster.pm

index d02a86772dcf156531836ea31b470b66a9c00906..15c19bea833f0998877860786ec95f70ef49ff5a 100644 (file)
@@ -1854,6 +1854,29 @@ 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.",
+    },
+};
+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);
+}
+
 sub assert_joinable {
     my ($local_addr, $ring0_addr, $ring1_addr, $force) = @_;