rbd: monhost string : escape only ":" character

we need to escape ":" used to defined mon ports

"10.5.0.11:6789; 10.5.0.12:6789; 10.5.0.13:6789"

->

"10.5.0.11\:6789; 10.5.0.12\:6789; 10.5.0.13\:6789"

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier
2015-03-05 10:29:29 +01:00
committed by Dietmar Maurer
parent 74e8c51e58
commit a8176f5458

View File

@ -177,13 +177,6 @@ sub rbd_volume_info {
return ($size, $parent, $format, $protected);
}
sub addslashes {
my $text = shift;
$text =~ s/;/\\;/g;
$text =~ s/:/\\:/g;
return $text;
}
# Configuration
PVE::JSONSchema::register_format('pve-storage-monhost', \&parse_monhost);
@ -258,7 +251,9 @@ sub path {
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
$name .= '@'.$snapname if $snapname;
my $monhost = addslashes($scfg->{monhost});
my $monhost = $scfg->{monhost};
$monhost =~ s/:/\\:/g;
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
my $username = $scfg->{username} ? $scfg->{username} : 'admin';