Author: justi9
Date: 2009-07-22 11:49:01 -0400 (Wed, 22 Jul 2009)
New Revision: 3515
Added:
mgmt/trunk/cumin/instance/etc/mint.conf
Modified:
mgmt/trunk/cumin/bin/cumin
mgmt/trunk/cumin/instance/etc/cumin.conf
mgmt/trunk/cumin/python/cumin/config.py
mgmt/trunk/cumin/python/cumin/main.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/tools.py
mgmt/trunk/mint/python/mint/model.py
mgmt/trunk/mint/python/mint/tools.py
Log:
* Use a configuration parameter instead of a database table to
indicate qmf servers; disable the no longer necessary database
polling as a result
* Make CuminConfig serve to configure the mint instance used
internally by cumin
* Adapt the cumin command to use mint config out of CUMIN_HOME
* Fix up some logging
Modified: mgmt/trunk/cumin/bin/cumin
===================================================================
--- mgmt/trunk/cumin/bin/cumin 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/bin/cumin 2009-07-22 15:49:01 UTC (rev 3515)
@@ -1,5 +1,11 @@
#!/bin/bash
+if [[ "$CUMIN_HOME" ]]; then
+ export MINT_HOME="$CUMIN_HOME"
+else
+ export MINT_HOME="/var/lib/cumin"
+fi
+
function die {
kill "$mpid"
kill "$cpid"
Modified: mgmt/trunk/cumin/instance/etc/cumin.conf
===================================================================
--- mgmt/trunk/cumin/instance/etc/cumin.conf 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/instance/etc/cumin.conf 2009-07-22 15:49:01 UTC (rev 3515)
@@ -1,3 +1,4 @@
[main]
+data: postgresql://cumin@localhost/cumin
debug: True
user: guest
Added: mgmt/trunk/cumin/instance/etc/mint.conf
===================================================================
--- mgmt/trunk/cumin/instance/etc/mint.conf (rev 0)
+++ mgmt/trunk/cumin/instance/etc/mint.conf 2009-07-22 15:49:01 UTC (rev 3515)
@@ -0,0 +1 @@
+link cumin.conf
\ No newline at end of file
Property changes on: mgmt/trunk/cumin/instance/etc/mint.conf
___________________________________________________________________
Name: svn:special
+ *
Modified: mgmt/trunk/cumin/python/cumin/config.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/config.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/python/cumin/config.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -14,15 +14,18 @@
hdef = os.path.normpath("/var/lib/cumin")
self.home = os.environ.get("CUMIN_HOME", hdef)
+ if not os.path.isdir(self.home):
+ raise Exception("Home path '%s' is not a directory")
+
sdef = os.path.normpath("/usr/share/amqp/amqp.0-10-qpid-errata.xml")
self.spec = os.environ.get("AMQP_SPEC", sdef)
- if not os.path.isdir(self.home):
- raise Exception("Home path '%s' is not a directory")
-
param = ConfigParameter(self, "data", str)
param.default = "postgresql://cumin@localhost/cumin"
+ param = ConfigParameter(self, "qmf", str)
+ param.default = "amqp://localhost"
+
param = ConfigParameter(self, "log-file", str)
param.default = os.path.join(self.home, "log", "cumin.log")
@@ -36,13 +39,21 @@
param = ConfigParameter(self, "operator-email", str)
- def init(self):
+ self.expire_frequency = 600
+ self.expire_threshold = 24 * 3600
+
+ def init(self, opts=None):
super(CuminConfig, self).init()
self.load_file(os.path.join(self.home, "etc", "cumin.conf"))
self.load_file(os.path.join(os.path.expanduser("~"),
".cumin.conf"))
+ if opts:
+ self.load_dict(opts)
+
enable_logging("cumin", self.log_level, self.log_file)
+ enable_logging("mint", self.log_level, self.log_file)
if self.debug:
enable_logging("cumin", "debug", sys.stderr)
+ enable_logging("mint", "debug", sys.stderr)
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/python/cumin/main.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -175,9 +175,6 @@
self.view = OverviewView(app, "view")
self.add_mode(self.view)
- self.mservers_add = ManagementServerSetAdd(app, "mserversadd")
- self.add_mode(self.mservers_add)
-
def render_title(self, session):
return "Overview"
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -22,14 +22,11 @@
def __init__(self, app, data_uri):
self.app = app
- opts = {"data": data_uri, "qmf": None}
+ config = app.config
- config = MintConfig()
- config.init(opts)
-
self.mint = Mint(config)
self.mint.updateEnabled = False
- self.mint.pollEnabled = True
+ self.mint.pollEnabled = False
self.mint.expireEnabled = False
self.classes = list()
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -40,6 +40,10 @@
opt.argument = "URI"
opt.description = "Connect to database at URI"
+ opt = CommandOption(self, "qmf")
+ opt.argument = "URI"
+ opt.description = "Connect to QMF server at URI"
+
opt = CommandOption(self, "log-file")
opt.argument = "PATH"
opt.description = "Log to file at PATH"
Modified: mgmt/trunk/mint/python/mint/model.py
===================================================================
--- mgmt/trunk/mint/python/mint/model.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/mint/python/mint/model.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -203,14 +203,19 @@
self.qmfSession = qmf.console.Session \
(self, manageConnections=True, rcvObjects=self.app.updateEnabled)
- # clean up any transient objects that a previous instance may have left behind in the
DB
- # it's basically an unconstrained agent disconnect update, for any agent
+ # clean up any transient objects that a previous instance may have
+ # left behind in the DB it's basically an unconstrained agent
+ # disconnect update, for any agent
+
up = update.AgentDisconnectUpdate(self, 0)
self.app.updateThread.enqueue(up)
def start(self):
- pass
+ uris = [x.strip() for x in self.app.config.qmf.split(",")]
+ for uri in uris:
+ self.addBroker(uri)
+
def stop(self):
for mbroker in self.mintBrokersById.values():
self.delBroker(mbroker)
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2009-07-21 19:11:17 UTC (rev 3514)
+++ mgmt/trunk/mint/python/mint/tools.py 2009-07-22 15:49:01 UTC (rev 3515)
@@ -19,6 +19,10 @@
opt.argument = "URI"
opt.description = "Connect to database at URI"
+ opt = CommandOption(self, "qmf")
+ opt.argument = "URI"
+ opt.description = "Connect to QMF server at URI"
+
opt = CommandOption(self, "log-file")
opt.argument = "PATH"
opt.description = "Log to file at PATH"
@@ -90,8 +94,6 @@
def do_run(self, opts, args):
app = Mint(self.config)
- app.pollEnabled = True
-
app.check()
app.init()
app.start()