diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index da31be99d7..4fb959994f 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -709,6 +709,10 @@ nsxv_opts = [ cfg.ListOpt('housekeeping_jobs', default=['error_dhcp_edge', 'error_backup_edge'], help=_("List of the enabled housekeeping jobs")), + cfg.ListOpt('housekeeping_readonly_jobs', + default=[], + help=_("List of housekeeping jobs which are enabled in read " + "only mode")), cfg.BoolOpt('housekeeping_readonly', default=True, help=_("Housekeeping will only warn about breakage.")), diff --git a/vmware_nsx/plugins/common/housekeeper/base_job.py b/vmware_nsx/plugins/common/housekeeper/base_job.py index 3973357cf5..b2a519f1f2 100644 --- a/vmware_nsx/plugins/common/housekeeper/base_job.py +++ b/vmware_nsx/plugins/common/housekeeper/base_job.py @@ -16,6 +16,7 @@ import abc from neutron_lib.plugins import directory +from oslo_config import cfg from oslo_log import log import six @@ -25,7 +26,10 @@ LOG = log.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class BaseJob(object): def __init__(self, readonly): - self.readonly = readonly + self.readonly = readonly or (self.get_name() in + cfg.CONF.nsxv.housekeeping_readonly_jobs) + LOG.info('Housekeeping: %s job initialized in %s mode', + self.get_name(), 'RO' if self.readonly else 'RW') self.plugin = directory.get_plugin() @abc.abstractmethod