You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/02/16 17:47:50 UTC
[09/50] [abbrv] git commit: updated
refs/heads/feature/systemvm-persistent-config to 8620642
Fixing the timout )ssh hanging) on the CsApp.py file
Adding kill_all() method on the CsProcess.py file (not being used yet)
Changing a bit the logic in the merge.py
The changes in the logic might be reverted, but they are causing no harm now.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f4f25907
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f4f25907
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f4f25907
Branch: refs/heads/feature/systemvm-persistent-config
Commit: f4f2590761f9016bfcb5f99c3d5fa77452242086
Parents: 1a4ba09
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Wed Jan 21 17:09:42 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Feb 16 16:08:36 2015 +0100
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/configure.py | 1 -
.../debian/config/opt/cloud/bin/cs/CsAddress.py | 4 +--
.../debian/config/opt/cloud/bin/cs/CsApp.py | 2 +-
.../debian/config/opt/cloud/bin/cs/CsProcess.py | 13 +++++++--
.../config/opt/cloud/bin/cs_guestnetwork.py | 30 +++++++++++++-------
.../debian/config/opt/cloud/bin/merge.py | 3 --
.../config/opt/cloud/bin/update_config.py | 23 ++++++++++++---
7 files changed, 51 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index 4031c55..b04da82 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -574,6 +574,5 @@ def main(argv):
mon = CsMonitor("monitorservice", config)
mon.process()
-
if __name__ == "__main__":
main(sys.argv)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 2e2a117..e8d751d 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -299,9 +299,7 @@ class CsIP:
if " DOWN " in i:
cmd2 = "ip link set %s up" % self.getDevice()
# Do not change the state of ips on a redundant router that are managed by vrrp or CsRedundant
- if self.config.cmdline().is_redundant() and self.is_public():
- pass
- else:
+ if not self.config.cmdline().is_redundant() and not self.is_public():
CsHelper.execute(cmd2)
def set_mark(self):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
index 4aa988a..d680bde 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
@@ -71,7 +71,7 @@ class CsPasswdSvc(CsApp):
proc = CsProcess(['/opt/cloud/bin/vpc_passwd_server', self.ip])
if not proc.find():
- proc.start("/usr/bin/nohup", "2>&1 &")
+ proc.start("/usr/bin/nohup", ">/dev/null 2>&1 &")
class CsDnsmasq(CsApp):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
index 75ebd6f..e768852 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
@@ -33,7 +33,12 @@ class CsProcess(object):
logging.info("Started %s", " ".join(self.search))
os.system("%s %s %s" % (thru, " ".join(self.search), background))
- def find(self):
+ def kill_all(self):
+ pids = self.find_pid()
+ for p in pids:
+ CsHelper.execute("kill -9 %s" % p)
+
+ def find_pid(self):
self.pid = []
for i in CsHelper.execute("ps aux"):
items = len(self.search)
@@ -41,4 +46,8 @@ class CsProcess(object):
matches = len([m for m in proc if m in self.search])
if matches == items:
self.pid.append(re.split("\s+", i)[1])
- return len(self.pid) > 0
+ return self.pid
+
+ def find(self):
+ has_pid = len(self.find_pid()) > 0
+ return has_pid
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
index 4f9f3a0..6cb29a1 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
@@ -17,16 +17,24 @@
from pprint import pprint
+keys = ['eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8', 'eth9']
def merge(dbag, gn):
- added = False
- for dev in dbag:
- if dev == "id":
- continue
- if len(dbag[dev]) == 0:
- continue
- if dbag[dev][0]['device'] == gn['device']:
- dbag[dev].remove(dbag[dev][0])
- if gn['add']:
- dbag.setdefault(gn['device'], []).append(gn)
- return dbag
+ device = gn['device']
+
+ if not gn['add'] and device in dbag:
+
+ if dbag[device]:
+ device_to_die = dbag[device][0]
+ try:
+ dbag[device].remove(device_to_die)
+ except ValueError, e:
+ print "[WARN] cs_guestnetwork.py :: Error occurred removing item from databag. => %s" % device_to_die
+ del(dbag[device])
+ else:
+ del(dbag[device])
+
+ else:
+ dbag.setdefault(device, []).append(gn)
+
+ return dbag
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/merge.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/merge.py b/systemvm/patches/debian/config/opt/cloud/bin/merge.py
index 6028415..7229254 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/merge.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/merge.py
@@ -127,9 +127,6 @@ class updateDataBag:
def processGuestNetwork(self, dbag):
d = self.qFile.data
- if not set(['device']).issubset(d):
- return dbag
-
dp = {}
dp['public_ip'] = d['router_guest_ip']
dp['netmask'] = d['router_guest_netmask']
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f25907/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/update_config.py b/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
index ea21455..e84fd09 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
@@ -60,9 +60,23 @@ def is_guestnet_configured(guestnet_dict, keys):
if k1 in keys and len(v1) > 0:
existing_keys.append(k1)
+ if not existing_keys:
+ '''
+ It seems all the interfaces have been removed. Let's allow a new configuration to come in.
+ '''
+ print "[WARN] update_config.py :: Reconfiguring guest network..."
+ return False
+
file = open(jsonCmdConfigPath)
new_guestnet_dict = json.load(file)
+ if not new_guestnet_dict['add']:
+ '''
+ Guest network has to be removed.
+ '''
+ print "[INFO] update_config.py :: Removing guest network..."
+ return False
+
'''
Check if we have a new guest network ready to be setup
'''
@@ -93,7 +107,7 @@ def is_guestnet_configured(guestnet_dict, keys):
return exists
if not (os.path.isfile(jsonCmdConfigPath) and os.access(jsonCmdConfigPath, os.R_OK)):
- print "[ERROR]: You are telling me to process %s, but i can't access it" % jsonCmdConfigPath
+ print "[ERROR] update_config.py :: You are telling me to process %s, but i can't access it" % jsonCmdConfigPath
sys.exit(1)
# If the command line json file is unprocessed process it
@@ -110,13 +124,14 @@ if sys.argv[1] == "guest_network.json":
guestnet_dict = json.load(file)
if not is_guestnet_configured(guestnet_dict, ['eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8', 'eth9']):
- print "[INFO] Processing Guest Network."
+ print "[INFO] update_config.py :: Processing Guest Network."
process_file()
else:
- print "[INFO] No need to process Guest Network."
+ print "[INFO] update_config.py :: No need to process Guest Network."
finish_config()
else:
- print "[INFO] No GuestNetwork configured yet. Configuring first one now."
+ print "[INFO] update_config.py :: No GuestNetwork configured yet. Configuring first one now."
process_file()
else:
+ print "[INFO] update_config.py :: Processing incoming file => %s" % sys.argv[1]
process_file()
\ No newline at end of file