def checkpoint(self): LOG.info('%s()' % KenLog.fcn()) path = self._instructions['cloud_input_path'] cloud_name, nickname = CloudNameController.get_cloud_names(path) self.prepare_filesystem(cloud_name, 'persistent_state') return self._checkpoint()
def checkpoint(self): LOG.info('%s()' % KenLog.fcn()) path = self._instructions['cloud_input_path'] cloud_name, nickname = CloudNameController.get_cloud_names(path) self.prepare_filesystem(cloud_name, 'config') return self._checkpoint()
def _get_structure(self): nt_controller = self._controllers['NodeType'] path = self._instructions['cloud_input_path'] name, nickname = CloudNameController.get_cloud_names(path) if nickname and (len(nickname) > 0): message = 'The "%s" cloud was created with a nickname of "%s" ' % ( name, nickname) else: message = 'The "%s" cloud was created with no nickname ' % name num_cp = len(self._models['CloudModel']['control-planes']) message += 'and "%d" defined control %s.\n\n' % \ (num_cp, pluralize(num_cp, 'plane', 'planes')) cp_index = 1 for elem_cp in self._models['CloudModel']['control-planes']: if not ControlPlane.is_active(elem_cp): continue cp_type = ControlPlane.get_name(elem_cp) num_tiers = ControlPlane.get_active_tier_count(elem_cp) str_tiers = pluralize(num_tiers, 'tier', 'tiers') message += 'The %s control plane is a "%s" (%s) and has "%d" ' \ '%s.\n' % (ordinal(cp_index), cp_type, elem_cp['type'], num_tiers, str_tiers) t_index = 1 for elem_t in elem_cp['tiers']: if not Tier.is_active(elem_t): continue mc = Tier.get_active_member_count(elem_t) if mc == 1: message += 'The %s tier in this control plane is not ' \ 'clustered.' % ordinal(t_index) else: message += 'The %s tier in this control plane is ' \ 'clustered, having "%s" %s in the cluster.' % \ (ordinal(t_index), mc, pluralize(mc, 'member', 'members')) message += '\n' t_index += 1 if ('resource-nodes' not in elem_cp or elem_cp['resource-nodes'] == {}): message += 'There are no resource nodes defined in this ' \ 'control plane.\n' else: for rn, elem_rn in six.iteritems(elem_cp['resource-nodes']): count = elem_rn['count'] node_type = nt_controller.get(rn) fn_singular = node_type.friendly_name fn_plural = node_type.friendly_name + 's' message += 'There %s %s %s (%s) ' \ 'defined in this control plane.\n' % ( pluralize(count, 'is', 'are'), count, pluralize(count, fn_singular, fn_plural), rn) message += '\n' cp_index += 1 return message