incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject [3/13] git commit: CLOUDSTACK-184: add createFileInDomr plugin
Date Tue, 25 Sep 2012 00:38:40 GMT
CLOUDSTACK-184: add createFileInDomr plugin


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/acaa2200
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/acaa2200
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/acaa2200

Branch: refs/heads/junit-tests
Commit: acaa22003df7b60abdf48d53b09147a660d15dfd
Parents: a3c80eb
Author: Anthony Xu <anthony@cloud.com>
Authored: Mon Sep 24 16:11:04 2012 -0700
Committer: Anthony Xu <anthony@cloud.com>
Committed: Mon Sep 24 16:11:04 2012 -0700

----------------------------------------------------------------------
 scripts/vm/hypervisor/xenserver/vmops |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/acaa2200/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index e3f3e33..21c73ac 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -361,6 +361,26 @@ def createFile(session, args):
     return txt
 
 @echo
+def createFileInDomr(session, args):
+    file_path = args['filepath']
+    file_contents = args['filecontents']
+    domrip = args['domrip']
+    try:
+        tmpfile = util.pread2(['mktemp']).strip()
+        f = open(tmpfile, "w")
+        f.write(file_contents)
+        f.close()
+        target = "root@" + domrip + ":" + file_path
+        util.pread2(['scp','-P','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',tmpfile,
target])
+        util.pread2(['rm',tmpfile])
+        txt = 'success'
+    except:
+        util.SMlog(" failed to create HA proxy cfg file ")
+        txt = ''
+
+    return txt
+
+@echo
 def deleteFile(session, args):
     file_path = args["filepath"]
 
@@ -1452,4 +1472,5 @@ if __name__ == "__main__":
                             "setLinkLocalIP":setLinkLocalIP,
                             "cleanup_rules":cleanup_rules,
                             "bumpUpPriority":bumpUpPriority,
+                            "createFileInDomr":createFileInDomr,
                             "kill_copy_process":kill_copy_process})


Mime
View raw message