From de0081629e3298aa528998bf12e690aadbfc6568 Mon Sep 17 00:00:00 2001
From: Adit Sarfaty <asarfaty@vmware.com>
Date: Thu, 15 Feb 2018 13:28:35 +0200
Subject: [PATCH] AdminUtils: Skip housekeeping on admin utils calls

The NSX-V housekeeping jobs should not run via the admin utilities.

Change-Id: Id8564d7514b2ca2d59804d95ad3912ecb833f54b
---
 vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py b/vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py
index b8f2152f1f..5ec14e04a8 100644
--- a/vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py
+++ b/vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py
@@ -14,6 +14,8 @@
 
 import time
 
+import mock
+
 from oslo_config import cfg
 from oslo_log import log as logging
 
@@ -59,8 +61,11 @@ class NsxVPluginWrapper(plugin.NsxVPlugin):
         super(NsxVPluginWrapper, self).__init__()
         # Make this the core plugin
         directory.add_plugin('CORE', self)
-        # finish the plugin initialization (md-proxy)
-        self.init_complete(0, 0, 0)
+        # finish the plugin initialization
+        # (with md-proxy config, but without housekeeping)
+        with mock.patch("vmware_nsx.plugins.common.housekeeper."
+                        "housekeeper.NsxvHousekeeper"):
+            self.init_complete(0, 0, 0)
 
     def _start_rpc_listeners(self):
         pass