Skip to content

Commit

Permalink
Support IPv6 in Ceph Driver
Browse files Browse the repository at this point in the history
Signed-off-by: BenjiReis <[email protected]>
  • Loading branch information
benjamreis authored and Wescoeur committed Oct 23, 2023
1 parent 6bb0edc commit d8ceb1c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/CephFSSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import errno
import os
import socket
import syslog as _syslog
import xmlrpc.client
from syslog import syslog
Expand Down Expand Up @@ -141,7 +142,17 @@ def mount(self, mountpoint=None):
options.append(self.dconf['options'])
if options:
options = ['-o', ','.join(options)]
command = ["mount", '-t', 'ceph', self.remoteserver+":"+self.remoteport+":"+self.remotepath, mountpoint] + options
acc = []
for server in self.remoteserver.split(','):
try:
addr_info = socket.getaddrinfo(server, 0)[0]
except Exception:
continue

acc.append('[' + server + ']' if addr_info[0] == socket.AF_INET6 else server)

remoteserver = ','.join(acc)
command = ["mount", '-t', 'ceph', remoteserver + ":" + self.remoteport + ":" + self.remotepath, mountpoint] + options
util.ioretry(lambda: util.pread(command), errlist=[errno.EPIPE, errno.EIO], maxretry=2, nofail=True)
except util.CommandException as inst:
syslog(_syslog.LOG_ERR, 'CephFS mount failed ' + inst.__str__())
Expand Down

0 comments on commit d8ceb1c

Please sign in to comment.