|
46 | 46 | import javax.xml.parsers.DocumentBuilderFactory; |
47 | 47 | import javax.xml.parsers.ParserConfigurationException; |
48 | 48 |
|
| 49 | +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; |
| 50 | +import org.apache.cloudstack.storage.to.TemplateObjectTO; |
| 51 | +import org.apache.cloudstack.storage.to.VolumeObjectTO; |
49 | 52 | import org.apache.log4j.Logger; |
50 | 53 | import org.apache.xmlrpc.XmlRpcException; |
51 | 54 | import org.w3c.dom.Document; |
|
54 | 57 | import org.xml.sax.InputSource; |
55 | 58 | import org.xml.sax.SAXException; |
56 | 59 |
|
57 | | -import com.trilead.ssh2.SCPClient; |
58 | | -import com.xensource.xenapi.Bond; |
59 | | -import com.xensource.xenapi.Connection; |
60 | | -import com.xensource.xenapi.Console; |
61 | | -import com.xensource.xenapi.Host; |
62 | | -import com.xensource.xenapi.HostCpu; |
63 | | -import com.xensource.xenapi.HostMetrics; |
64 | | -import com.xensource.xenapi.Network; |
65 | | -import com.xensource.xenapi.PBD; |
66 | | -import com.xensource.xenapi.PIF; |
67 | | -import com.xensource.xenapi.Pool; |
68 | | -import com.xensource.xenapi.SR; |
69 | | -import com.xensource.xenapi.Session; |
70 | | -import com.xensource.xenapi.Task; |
71 | | -import com.xensource.xenapi.Types; |
72 | | -import com.xensource.xenapi.Types.BadServerResponse; |
73 | | -import com.xensource.xenapi.Types.VmPowerState; |
74 | | -import com.xensource.xenapi.Types.XenAPIException; |
75 | | -import com.xensource.xenapi.VBD; |
76 | | -import com.xensource.xenapi.VDI; |
77 | | -import com.xensource.xenapi.VIF; |
78 | | -import com.xensource.xenapi.VLAN; |
79 | | -import com.xensource.xenapi.VM; |
80 | | -import com.xensource.xenapi.XenAPIObject; |
81 | | - |
82 | | -import org.apache.cloudstack.storage.command.StorageSubSystemCommand; |
83 | | -import org.apache.cloudstack.storage.to.TemplateObjectTO; |
84 | | -import org.apache.cloudstack.storage.to.VolumeObjectTO; |
85 | | - |
86 | 60 | import com.cloud.agent.IAgentControl; |
87 | 61 | import com.cloud.agent.api.Answer; |
88 | 62 | import com.cloud.agent.api.Command; |
|
149 | 123 | import com.cloud.utils.ssh.SSHCmdHelper; |
150 | 124 | import com.cloud.utils.ssh.SshHelper; |
151 | 125 | import com.cloud.vm.VirtualMachine.PowerState; |
| 126 | +import com.trilead.ssh2.SCPClient; |
| 127 | +import com.xensource.xenapi.Bond; |
| 128 | +import com.xensource.xenapi.Connection; |
| 129 | +import com.xensource.xenapi.Console; |
| 130 | +import com.xensource.xenapi.Host; |
| 131 | +import com.xensource.xenapi.HostCpu; |
| 132 | +import com.xensource.xenapi.HostMetrics; |
| 133 | +import com.xensource.xenapi.Network; |
| 134 | +import com.xensource.xenapi.PBD; |
| 135 | +import com.xensource.xenapi.PIF; |
| 136 | +import com.xensource.xenapi.Pool; |
| 137 | +import com.xensource.xenapi.SR; |
| 138 | +import com.xensource.xenapi.Session; |
| 139 | +import com.xensource.xenapi.Task; |
| 140 | +import com.xensource.xenapi.Types; |
| 141 | +import com.xensource.xenapi.Types.BadServerResponse; |
| 142 | +import com.xensource.xenapi.Types.VmPowerState; |
| 143 | +import com.xensource.xenapi.Types.XenAPIException; |
| 144 | +import com.xensource.xenapi.VBD; |
| 145 | +import com.xensource.xenapi.VDI; |
| 146 | +import com.xensource.xenapi.VIF; |
| 147 | +import com.xensource.xenapi.VLAN; |
| 148 | +import com.xensource.xenapi.VM; |
| 149 | +import com.xensource.xenapi.XenAPIObject; |
152 | 150 |
|
153 | 151 | /** |
154 | 152 | * CitrixResourceBase encapsulates the calls to the XenServer Xapi process to |
@@ -4570,8 +4568,6 @@ public boolean setupServer(final Connection conn, final Host host) { |
4570 | 4568 | throw new CloudRuntimeException("Unable to authenticate"); |
4571 | 4569 | } |
4572 | 4570 |
|
4573 | | - final com.trilead.ssh2.Session session = sshConnection.openSession(); |
4574 | | - |
4575 | 4571 | final String cmd = "mkdir -p /opt/cloud/bin /var/log/cloud"; |
4576 | 4572 | if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) { |
4577 | 4573 | throw new CloudRuntimeException("Cannot create directory /opt/cloud/bin on XenServer hosts"); |
@@ -4625,11 +4621,11 @@ public boolean setupServer(final Connection conn, final Host host) { |
4625 | 4621 | if (s_logger.isDebugEnabled()) { |
4626 | 4622 | s_logger.debug("Copying " + f + " to " + directoryPath + " on " + hr.address + " with permission " + permissions); |
4627 | 4623 | } |
4628 | | - try { |
4629 | | - session.execCommand("mkdir -m 700 -p " + directoryPath); |
4630 | | - } catch (final IOException e) { |
4631 | | - s_logger.debug("Unable to create destination path: " + directoryPath + " on " + hr.address + " but trying anyway"); |
| 4624 | + |
| 4625 | + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "mkdir -m 700 -p " + directoryPath)) { |
| 4626 | + s_logger.debug("Unable to create destination path: " + directoryPath + " on " + hr.address + "."); |
4632 | 4627 | } |
| 4628 | + |
4633 | 4629 | try { |
4634 | 4630 | scp.put(f, directoryPath, permissions); |
4635 | 4631 | } catch (final IOException e) { |
|
0 commit comments