CLOUDSTACK-710: mkdir -p destination before scp-ing file in CitrixResourceBase

- Assumption is that mkdir is available on xen host
- We don't know what kind of file we're copying, dirs would have 0777 permission
  by default

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-02-11 16:38:18 +05:30
parent 3e613788e9
commit 770860aee4

View File

@ -4713,6 +4713,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
throw new CloudRuntimeException("Unable to authenticate");
}
com.trilead.ssh2.Session session = sshConnection.openSession();
SCPClient scp = new SCPClient(sshConnection);
List<File> files = getPatchFiles();
@ -4761,6 +4762,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (s_logger.isDebugEnabled()) {
s_logger.debug("Copying " + f + " to " + d + " on " + hr.address + " with permission " + p);
}
try {
session.execCommand("mkdir -p " + d);
} catch (IOException e) {
s_logger.debug("Unable to create destination path: " + d + " on " + hr.address + " but trying anyway");
}
scp.put(f, d, p);
}