storage: escape ipv6 for ceph mon hosts to librados

Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
so they are often referenced by IP rather than hostname for
convenience, or to avoid relying on DNS. Using IPv4 addresses as the
host name works already, but IPv6 addresses require rbd-specific
escaping because the colon is used as an option separator in the
string passed to librados.

Escape these colons, and enclose the IPv6 address in square brackets
so it is distinguished from the port, which is currently mandatory.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Yi Li
2019-04-28 10:29:53 +08:00
committed by Ján Tomko
parent 53f3c43ac7
commit cdd362e0e7
5 changed files with 44 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
<pool type='rbd'>
<name>ceph</name>
<uuid>47c1faee-0207-e741-f5ae-d9b019b98fe2</uuid>
<capacity unit='bytes'>0</capacity>
<allocation unit='bytes'>0</allocation>
<available unit='bytes'>0</available>
<source>
<host name='localhost' port='6789'/>
<host name='localhost' port='6790'/>
<host name='2205::192:168:205:141' port='6789'/>
<name>rbd</name>
<auth type='ceph' username='admin'>
<secret uuid='2ec115d7-3a88-3ceb-bc12-0ac909a6fd87'/>
</auth>
</source>
</pool>