[pve-devel] [PATCH cluster v2 2/8] add new corosync-link format

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jun 11 19:36:27 CEST 2019


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 at proxmox.com>
---

changes v1 (RFC) -> v2:
* drop bindnet property completely

 data/PVE/Cluster.pm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 7f9b88e..82533fa 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1839,6 +1839,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) = @_;
 
-- 
2.20.1





More information about the pve-devel mailing list