Exemplo n.º 1
0
 def remove_asd(asd):
     """
     Remove an ASD
     :param asd: ASD to remove
     :type asd: source.dal.objects.asd.ASD
     :return: None
     :rtype: NoneType
     """
     if ASDController._service_manager.has_service(
             asd.service_name, ASDController._local_client):
         ASDController._service_manager.stop_service(
             asd.service_name, ASDController._local_client)
         ASDController._service_manager.remove_service(
             asd.service_name, ASDController._local_client)
     try:
         ASDController._local_client.dir_delete('{0}/{1}'.format(
             asd.disk.mountpoint, asd.asd_id))
     except Exception:
         ASDController._logger.exception('Could not clean ASD data')
     Configuration.delete(asd.config_key)
     asd.delete()
Exemplo n.º 2
0
    def remove_maintenance_service(name, alba_backend_guid=None):
        """
        Remove a maintenance service with a specific name
        :param name: Name of the service to remove
        :type name: str
        :param alba_backend_guid: ALBA Backend GUID for which the maintenance service needs to be removed
                                  Defaults to None for backwards compatibility
        :type alba_backend_guid: str
        :return: None
        :rtype: NoneType
        """
        if MaintenanceController._service_manager.has_service(
                name, MaintenanceController._local_client):
            MaintenanceController._service_manager.stop_service(
                name, MaintenanceController._local_client)
            MaintenanceController._service_manager.remove_service(
                name, MaintenanceController._local_client)

        if alba_backend_guid is not None:
            key = MaintenanceController.MAINTENANCE_KEY.format(
                alba_backend_guid, name)
            if Configuration.dir_exists(key=key):
                Configuration.delete(key=key)