def disrupt_plugin_provisioner_pods(self, node_list): """ Set leader plugin-provisioner resources for disruption, skip if running on node from the node_list Args: node_list (list): list of node names to check Returns: list: list of Disruption objects """ provisioner_resource = [] for interface in [constants.CEPHBLOCKPOOL, constants.CEPHFILESYSTEM]: provisioner_pod = pod.plugin_provisioner_leader(interface=interface) node_name = pod.get_pod_node(provisioner_pod).name if node_name not in node_list: if interface == constants.CEPHBLOCKPOOL: provisioner_resource.append('rbdplugin_provisioner') else: provisioner_resource.append('cephfsplugin_provisioner') disruptor = [] for resource in provisioner_resource: disruption = disruption_helpers.Disruptions() disruption.set_resource(resource=resource) disruptor.append(disruption) return disruptor
def set_resource(self, resource): self.resource = resource resource_count = 0 if self.resource == 'mgr': self.resource_obj = pod.get_mgr_pods() self.selector = constants.MGR_APP_LABEL if self.resource == 'mon': self.resource_obj = pod.get_mon_pods() self.selector = constants.MON_APP_LABEL if self.resource == 'osd': self.resource_obj = pod.get_osd_pods() self.selector = constants.OSD_APP_LABEL if self.resource == 'mds': self.resource_obj = pod.get_mds_pods() self.selector = constants.MDS_APP_LABEL if self.resource == 'cephfsplugin': self.resource_obj = pod.get_plugin_pods( interface=constants.CEPHFILESYSTEM) self.selector = constants.CSI_CEPHFSPLUGIN_LABEL if self.resource == 'rbdplugin': self.resource_obj = pod.get_plugin_pods( interface=constants.CEPHBLOCKPOOL) self.selector = constants.CSI_RBDPLUGIN_LABEL if self.resource == 'cephfsplugin_provisioner': self.resource_obj = [ pod.plugin_provisioner_leader( interface=constants.CEPHFILESYSTEM) ] self.selector = constants.CSI_CEPHFSPLUGIN_PROVISIONER_LABEL resource_count = len(pod.get_cephfsplugin_provisioner_pods()) if self.resource == 'rbdplugin_provisioner': self.resource_obj = [ pod.plugin_provisioner_leader( interface=constants.CEPHBLOCKPOOL) ] self.selector = constants.CSI_RBDPLUGIN_PROVISIONER_LABEL resource_count = len(pod.get_rbdfsplugin_provisioner_pods()) if self.resource == 'operator': self.resource_obj = pod.get_operator_pods() self.selector = constants.OPERATOR_LABEL self.resource_count = resource_count or len(self.resource_obj)