This way we get parameter verification on monitor addresses
as well as the ability to pass multiple `--monhost`
arguments to `pvesm add`.

Since our '-list' schemas default to using commas we now
need to properly support these, so all uses of the monhost
property now replace all of semicolon, space or comma into
the currently required character.
This should fix the issues reported by Alwin Antreich on the
pve-user list.
---
 PVE/Storage/RBDPlugin.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index ced9af0..55c307b 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -29,7 +29,7 @@ my $rbd_cmd = sub {
     my ($scfg, $storeid, $op, @options) = @_;
 
     my $monhost = $scfg->{monhost};
-    $monhost =~ s/;/,/g;
+    $monhost =~ s/[; ]+/,/g;
 
     my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
@@ -56,7 +56,7 @@ my $rados_cmd = sub {
     my ($scfg, $storeid, $op, @options) = @_;
 
     my $monhost = $scfg->{monhost};
-    $monhost =~ s/;/,/g;
+    $monhost =~ s/[; ]+/,/g;
 
     my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
@@ -248,7 +248,7 @@ sub properties {
     return {
        monhost => {
            description => "Monitors daemon ips.",
-           type => 'string',
+           type => 'string', format => 'address-list',
        },
        pool => {
            description => "Pool.",
@@ -303,6 +303,7 @@ sub path {
     return ("/dev/rbd/$pool/$name", $vmid, $vtype) if $scfg->{krbd};
 
     my $monhost = $scfg->{monhost};
+    $monhost =~ s/[, ]+/;/g;
     $monhost =~ s/:/\\:/g;
 
     my $username =  $scfg->{username} ? $scfg->{username} : 'admin';
-- 
2.1.4


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

Reply via email to