You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/03/04 11:06:31 UTC

[47/50] [abbrv] git commit: updated refs/heads/reporter to 178a938

CLOUDSTACK-8298: Update copying large size VR config file in xenserver

 When there is large size VR configuration (aggregate commands) copying data to VR using vmops plugin was failed
 because of the ARG_MAX size limitation. The configuration data size is around 300KB.

 Updated this to create file in host by scp with file contents. This will create file in host.
 Then copy the file from the host to VR using hte vmops createFileInDomr method.

  In host file get created in /tmp/ with name VR-<UUID>.cfg, once it copied to VR this file will be removed.


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

Branch: refs/heads/reporter
Commit: 619f0142555d2245e3fa90036f825525191b31bd
Parents: 1f72548
Author: Jayapal <ja...@apache.org>
Authored: Mon Feb 23 13:51:20 2015 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Wed Mar 4 11:52:10 2015 +0530

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  | 14 ++++++++++---
 scripts/vm/hypervisor/xenserver/vmops           | 21 +++++++++-----------
 2 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/619f0142/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 6d777e4..a4aa4b6 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -571,9 +571,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     @Override
     public ExecutionResult createFileInVR(String routerIp, String path, String filename, String content) {
         Connection conn = getConnection();
-        String rc = callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "filepath", path + filename, "filecontents", content);
-        s_logger.debug ("VR Config file " + filename + " got created in VR with ip " + routerIp + " with content \n" + content);
-        // Fail case would be start with "fail#"
+        String hostPath = "/tmp/";
+
+        s_logger.debug("Copying VR with ip " + routerIp +" config file into host "+ _host.ip );
+        try {
+            SshHelper.scpTo(_host.ip, 22, _username, null, _password.peek(), hostPath, content.getBytes(), filename, null);
+        } catch (Exception e) {
+            s_logger.warn("scp VR config file into host " + _host.ip + " failed with exception " + e.getMessage().toString());
+        }
+
+        String rc = callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "srcfilepath", hostPath + filename, "dstfilepath", path);
+        s_logger.debug ("VR Config file " + filename + " got created in VR, ip " + routerIp + " with content \n" + content);
         return new ExecutionResult(rc.startsWith("succ#"), rc.substring(5));
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/619f0142/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 62a60bb..a73084a 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -204,20 +204,17 @@ def createFile(session, args):
 
 @echo
 def createFileInDomr(session, args):
-    file_path = args['filepath']
-    file_contents = args['filecontents']
+    src_filepath = args['srcfilepath']
+    dst_path = args['dstfilepath']
     domrip = args['domrip']
+    txt=""
     try:
-        tmpfile = util.pread2(['mktemp']).strip()
-        f = open(tmpfile, "w")
-        f.write(file_contents)
-        f.close()
-        target = "root@" + domrip + ":" + file_path
-        txt = util.pread2(['scp','-P','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',tmpfile, target])
-        util.pread2(['rm',tmpfile])
+        target = "root@" + domrip + ":" + dst_path
+        txt = util.pread2(['scp','-P','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',src_filepath, target])
+        util.pread2(['rm',src_filepath])
         txt = 'succ#' + txt
     except:
-        logging.debug("failed to create file " + file_path + " in VR, contain: " + file_contents)
+        logging.debug("failed to copy file " + src_filepath + " from host to VR with ip " + domrip)
         txt = 'fail#' + txt
     return txt
 
@@ -1486,8 +1483,8 @@ if __name__ == "__main__":
                             "destroy_network_rules_for_vm":destroy_network_rules_for_vm, 
                             "default_network_rules_systemvm":default_network_rules_systemvm, 
                             "network_rules_vmSecondaryIp":network_rules_vmSecondaryIp,
-                            "get_rule_logs_for_vms":get_rule_logs_for_vms, 
-			    "add_to_VCPUs_params_live":add_to_VCPUs_params_live,
+                            "get_rule_logs_for_vms":get_rule_logs_for_vms,
+                            "add_to_VCPUs_params_live":add_to_VCPUs_params_live,
                             "setLinkLocalIP":setLinkLocalIP,
                             "cleanup_rules":cleanup_rules,
                             "createFileInDomr":createFileInDomr,