def config(self, spec):
self.mgr._check_pool_exists(spec.pool, spec.service_name())
-
logger.info('Saving service %s spec with placement %s' % (
spec.service_name(), spec.placement.pretty_str()))
self.mgr.spec_store.save(spec)
def create(self, daemon_id, host, spec):
+ logger.info('Create daemon %s on host %s with spec %s' % (
+ daemon_id, host, spec))
return self.mgr._create_daemon('nfs', daemon_id, host)
True
),
+ # https://tracker.ceph.com/issues/45399
+ (
+ # daemon_id only contains hostname
+ ServiceSpec(
+ service_type='mds',
+ service_id="a",
+ ),
+ DaemonDescription(
+ daemon_type='mds',
+ daemon_id="a.host1.abc123",
+ hostname="host1.site",
+ ),
+ True
+ ),
+ (
+ NFSServiceSpec(
+ service_id="a",
+ ),
+ DaemonDescription(
+ daemon_type='nfs',
+ daemon_id="a.host1",
+ hostname="host1.site",
+ ),
+ True
+ ),
# https://tracker.ceph.com/issues/45293
(
# TODO: can a DaemonDescription exist without a hostname?
raise err
- if self.hostname == self.daemon_id:
- # daemon_id == "hostname"
+ # use the bare hostname, not the FQDN.
+ host = self.hostname.split('.')[0]
+
+ if host == self.daemon_id:
+ # daemon_id == "host"
return self.daemon_id
- elif self.hostname in self.daemon_id:
- # daemon_id == "service_id.hostname"
- # daemon_id == "service_id.hostname.random"
- pre, post = self.daemon_id.rsplit(self.hostname, 1)
+ elif host in self.daemon_id:
+ # daemon_id == "service_id.host"
+ # daemon_id == "service_id.host.random"
+ pre, post = self.daemon_id.rsplit(host, 1)
if not pre.endswith('.'):
- # '.' sep missing at front of hostname
+ # '.' sep missing at front of host
raise err
elif post and not post.startswith('.'):
- # '.' sep missing at end of hostname
+ # '.' sep missing at end of host
raise err
return pre[:-1]