[Kimchi-devel] [PATCH 5/5] Start monitoring iso copy on kimchi start up
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Tue Jun 10 10:06:18 UTC 2014
From: Royce Lv <lvroyce at linux.vnet.ibm.com>
Start monitoring on kimchi start up so that
following ISOs copied to this directory will be fixed with right ownership.
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
src/kimchi/model/model.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/kimchi/model/model.py b/src/kimchi/model/model.py
index 579f2d1..181569f 100644
--- a/src/kimchi/model/model.py
+++ b/src/kimchi/model/model.py
@@ -28,6 +28,7 @@ import lxml.etree as ET
from lxml.builder import E
from kimchi.basemodel import BaseModel
+from kimchi.isomonitor import pathMonitor
from kimchi.model.libvirtconnection import LibvirtConnection
from kimchi.objectstore import ObjectStore
from kimchi.utils import import_module, listPathModules
@@ -46,6 +47,8 @@ class Model(BaseModel):
for pool_name, pool_arg in DEFAULT_POOLS.iteritems():
self._default_pool_check(pool_name, pool_arg)
+ self._start_monitoring()
+
this = os.path.basename(__file__)
this_mod = os.path.splitext(this)[0]
@@ -89,3 +92,8 @@ class Model(BaseModel):
err = "Fatal: Default pool cannot be activated, exit kimchid"
cherrypy.log.error(err, severity=logging.ERROR)
sys.exit(1)
+
+ def _start_monitoring(self):
+ pm = pathMonitor()
+ pm.add_monitor_path(DEFAULT_POOLS['ISO']['path'])
+ cherrypy.engine.subscribe('exit', pm.stop_monitor)
--
1.8.3.2
More information about the Kimchi-devel
mailing list