cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 23663c9
Date Wed, 29 Apr 2015 12:00:06 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 229f23874 -> 23663c940


Using the SSHCmdHelper instead of a SSH Session.


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

Branch: refs/heads/master
Commit: 3b0c031b9f5cd7d0d26973ee3f59f0b5407cbe33
Parents: 1a719af
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Wed Apr 29 13:05:21 2015 +0200
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Wed Apr 29 13:05:21 2015 +0200

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  | 66 +++++++++-----------
 1 file changed, 31 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b0c031b/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 bc812e8..ff9f61d 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
@@ -46,6 +46,9 @@ import javax.naming.ConfigurationException;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
 import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 import org.w3c.dom.Document;
@@ -54,35 +57,6 @@ import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import com.trilead.ssh2.SCPClient;
-import com.xensource.xenapi.Bond;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Console;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.HostCpu;
-import com.xensource.xenapi.HostMetrics;
-import com.xensource.xenapi.Network;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Session;
-import com.xensource.xenapi.Task;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VmPowerState;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VIF;
-import com.xensource.xenapi.VLAN;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.XenAPIObject;
-
-import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
-
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -149,6 +123,30 @@ import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.ssh.SSHCmdHelper;
 import com.cloud.utils.ssh.SshHelper;
 import com.cloud.vm.VirtualMachine.PowerState;
+import com.trilead.ssh2.SCPClient;
+import com.xensource.xenapi.Bond;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Console;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.HostCpu;
+import com.xensource.xenapi.HostMetrics;
+import com.xensource.xenapi.Network;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.PIF;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Session;
+import com.xensource.xenapi.Task;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VIF;
+import com.xensource.xenapi.VLAN;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.XenAPIObject;
 
 /**
  * CitrixResourceBase encapsulates the calls to the XenServer Xapi process to
@@ -4570,8 +4568,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                     throw new CloudRuntimeException("Unable to authenticate");
                 }
 
-                final com.trilead.ssh2.Session session = sshConnection.openSession();
-
                 final String cmd = "mkdir -p /opt/cloud/bin /var/log/cloud";
                 if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) {
                     throw new CloudRuntimeException("Cannot create directory /opt/cloud/bin
on XenServer hosts");
@@ -4625,11 +4621,11 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("Copying " + f + " to " + directoryPath + " on
" + hr.address + " with permission " + permissions);
                         }
-                        try {
-                            session.execCommand("mkdir -m 700 -p " + directoryPath);
-                        } catch (final IOException e) {
-                            s_logger.debug("Unable to create destination path: " + directoryPath
+ " on " + hr.address + " but trying anyway");
+
+                        if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "mkdir -m 700 -p "
+ directoryPath)) {
+                            s_logger.debug("Unable to create destination path: " + directoryPath
+ " on " + hr.address + ".");
                         }
+
                         try {
                             scp.put(f, directoryPath, permissions);
                         } catch (final IOException e) {


Mime
View raw message