"""
Load hosts into the spec.placement.hosts container.
"""
+ # count == 0
+ if self.spec.placement.count == 0:
+ return []
+
# respect any explicit host list
if self.spec.placement.hosts and not self.spec.placement.count:
logger.debug('Provided hosts: %s' % self.spec.placement.hosts)
logger.debug('All hosts: {}'.format(candidates))
return candidates
+
count = 0
if self.spec.placement.hosts and \
self.spec.placement.count and \
[],
['smithi060']
),
+ # zero count
+ NodeAssignmentTest(
+ 'mon',
+ PlacementSpec(count=0),
+ ['smithi060'],
+ [],
+ []
+ ),
+
# all_hosts
NodeAssignmentTest(
'mon',
],
['host1', 'host2', 'host3']
),
+ # zero count + partial host list
+ NodeAssignmentTest(
+ 'mon',
+ PlacementSpec(count=0, hosts=['host3']),
+ 'host1 host2 host3'.split(),
+ [
+ DaemonDescription('mon', 'a', 'host1'),
+ DaemonDescription('mon', 'b', 'host2'),
+ ],
+ []
+ ),
# count + partial host list + existing
NodeAssignmentTest(
'mon',