You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2012/09/25 02:38:40 UTC

[3/13] git commit: CLOUDSTACK-184: add createFileInDomr plugin

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 <an...@cloud.com>
Authored: Mon Sep 24 16:11:04 2012 -0700
Committer: Anthony Xu <an...@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})