[Et-mgmt-commits-list] [SCM] virt-factory branch, master now at v0.0.3-231-ge4145de

Michael DeHaan mdehaan at redhat.com
Fri Aug 24 22:05:58 UTC 2007


Hello,

This is an automated email from the git hooks/update script, it was
generated because a ref change was pushed to the repository.

Updating branch, master,
       via  e4145de60080dfd4aadf6c9d09d67de76f917b08 (commit)
       via  dc0391b318f8c0d27cfdbdbea469c75e6df70531 (commit)
       via  3f2136d62369b22684af611f609f7574da96e69d (commit)
       via  2ea48271ec74e16058bd8bb66da62c6ace9215d9 (commit)
       via  1b3db28408c534375a72eaff40b61874a276156a (commit)
       via  0d519913dfca8fe24098a52b5d0d692ebaf7b966 (commit)
      from  f44fdfd108a81f9e495f9a2211442b4c0a8b12a5 (commit)

- Log -----------------------------------------------------------------
commit e4145de60080dfd4aadf6c9d09d67de76f917b08
Merge: dc0391b... f44fdfd...
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 18:01:02 2007 -0400

    Merge branch 'master' of git+ssh://g-mdehaan@et.redhat.com/git/virt-factory

commit dc0391b318f8c0d27cfdbdbea469c75e6df70531
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 18:00:34 2007 -0400

    Send status only when needed.  Signaling for early wakeup pending.

commit 3f2136d62369b22684af611f609f7574da96e69d
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 17:29:24 2007 -0400

    Pull vm state out of correct field.

commit 2ea48271ec74e16058bd8bb66da62c6ace9215d9
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 17:22:36 2007 -0400

    Lower log levels

commit 1b3db28408c534375a72eaff40b61874a276156a
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 16:55:26 2007 -0400

    Make sqlalchemy happy

commit 0d519913dfca8fe24098a52b5d0d692ebaf7b966
Author: Michael DeHaan <mdehaan at redhat.com>
Date:   Fri Aug 24 16:46:00 2007 -0400

    Send mac addresses up, and be more tolerant of queries for the other form.
-----------------------------------------------------------------------

Diffstat:
 nodes/nodes/server.py           |   31 ++++++++++++++++++++++++-------
 nodes/nodes/virt_utils.py       |    5 +++--
 service/modules/deployment.py   |    8 ++++----
 service/modules/provisioning.py |   10 +++++-----
 4 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/nodes/nodes/server.py b/nodes/nodes/server.py
index d868101..4120c83 100755
--- a/nodes/nodes/server.py
+++ b/nodes/nodes/server.py
@@ -20,7 +20,7 @@ import socket
 
 from rhpl.translate import _, N_, textdomain, utf8
 I18N_DOMAIN = "vf_node_server"
-SLEEP_INTERVAL = 15 
+SLEEP_INTERVAL = 60 # seconds, TBD: signal to wake up early when needed 
 SERVE_ON = (None,None)
 
 # FIXME: this app writes a logfile in /var/log/virt-factory/svclog -- package should use logrotate
@@ -179,6 +179,8 @@ def serve_status():
      logger.info("STATUS FORK: connect")
      amqp_conn.connect()
 
+     all_status = {}
+
      while True:
          try:
              logger.info("STATUS FORK: loop")
@@ -192,13 +194,28 @@ def serve_status():
 
              vms = virt_conn.find_vm(-1)
              for vm in vms:
+                 send_it = True
                  status = virt_conn.get_status2(vm)
-                 args = {
-                     "mac_address" : vm.name(),
-                     "state"       : status
-                 }
-                 logger.info("sending status: %s" % args)
-                 amqp_conn.server.deployment_set_state("UNSET", args)
+                 name = vm.name()
+
+                 # only send status when it changes, conserve network
+                 # and keep the logs (if any) quiet
+
+                 if not all_status.has_key(name):
+                     send_it = True
+                 elif all_status[name] != status:
+                     send_it = True
+
+                 if send_it:
+                     all_status[name] = status
+
+                 if send_it:
+                     args = {
+                         "mac_address" : name.replace("_",":"),
+                         "state"       : status
+                     }
+                     logger.info("sending status: %s" % args)
+                     amqp_conn.server.deployment_set_state("UNSET", args)
          
              time.sleep(SLEEP_INTERVAL)
          except:
diff --git a/nodes/nodes/virt_utils.py b/nodes/nodes/virt_utils.py
index d6d8df8..894af0f 100644
--- a/nodes/nodes/virt_utils.py
+++ b/nodes/nodes/virt_utils.py
@@ -111,10 +111,11 @@ class VirtFactoryLibvirtConnection():
         return self.find_vm(mac_address).undefine()
 
     def get_status2(self, vm):
-        state = vm.info()[1]
+        state = vm.info()[0]
+        # print "DEBUG: state: %s" % state
         return VIRT_STATE_NAME_MAP.get(state,"unknown")  
  
     def get_status(self, mac_address):
-        state = self.find_vm(mac_address).info()[1]
+        state = self.find_vm(mac_address).info()[0]
         return VIRT_STATE_NAME_MAP.get(state,"unknown")
 
diff --git a/service/modules/deployment.py b/service/modules/deployment.py
index 8e0f8d0..ea8587a 100755
--- a/service/modules/deployment.py
+++ b/service/modules/deployment.py
@@ -366,7 +366,7 @@ class Deployment(web_svc.AuthWebSvc):
         FieldValidator(args).verify_required(required)
         
         which = self.get_by_mac_address(token,args)
-        self.logger.info("set_state on %s to %s" % (args["mac_address"],args["state"]))
+        self.logger.debug("set_state on %s to %s" % (args["mac_address"],args["state"]))
         if which.error_code != 0:
            raise InvalidArgumentsException(comment="missing item")
         if len(which.data) == 0:
@@ -375,11 +375,11 @@ class Deployment(web_svc.AuthWebSvc):
 
         session = db.open_session()
         # BOOKMARK 
-        deployment = db.Deployment.get(session, { "id" : id })
+        deployment = db.Deployment.get(session, id)
         results = self.expand(deployment)
 
         results["state"] = args["state"]
-        self.logger.info("setting deployment status: %s" % results)
+        self.logger.debug("setting deployment status: %s" % results)
         self.edit(token, results)
 
         return success(results)
@@ -397,7 +397,7 @@ class Deployment(web_svc.AuthWebSvc):
             # creation gives uppercase MAC addresses, so be sure
             # we search on the same criteria until the DB search
             # can be made case insensitive.  (FIXME)
-            mac_address = args['mac_address'].upper()
+            mac_address = args['mac_address'].replace("_",":").upper()
             offset, limit = self.offset_and_limit(args)
             query = session.query(db.Deployment).limit(limit).offset(offset)
             for machine in query.select_by(mac_address = mac_address):
diff --git a/service/modules/provisioning.py b/service/modules/provisioning.py
index ceded30..1b2962f 100755
--- a/service/modules/provisioning.py
+++ b/service/modules/provisioning.py
@@ -385,15 +385,15 @@ class CobblerTranslatedSystem:
        cobbler_api.deserialize() # load from file! # UNFIXMED
 
        new_item = cobbler_api.new_system()
-       self.logger.info("debugging cobbler profiles")
+       self.logger.debug("debugging cobbler profiles")
        for x in cobbler_api.profiles():
-           self.logger.info("cobbler has a profile: ") 
-           self.logger.info(x)
-           self.logger.info(x.printable())
+           self.logger.debug("cobbler has a profile: ") 
+           self.logger.debug(x)
+           self.logger.debug(x.printable())
       
        new_item.set_name(from_db["mac_address"])
        # FIXME: change back to DEBUG:
-       self.logger.error("cobbler profile name is %s" % profile_name)
+       self.logger.debug("cobbler profile name is %s" % profile_name)
        new_item.set_profile(profile_name)
        # FIXME: do we need to make sure these are stored as spaces and not "None" ?
        

hooks/update
---
Git Source Code Management System
hooks/update refs/heads/master \
  f44fdfd108a81f9e495f9a2211442b4c0a8b12a5 \
  e4145de60080dfd4aadf6c9d09d67de76f917b08




More information about the Et-mgmt-commits-list mailing list