script fix

This commit is contained in:
anthony 2011-03-04 21:26:54 -08:00
parent a9c36d7b79
commit b8e03aca4c
3 changed files with 18 additions and 13 deletions

View File

@ -212,13 +212,8 @@
<fileset dir="${scripts.dir}">
<include name="**/*"/>
<exclude name="**/fsimage.so"/>
<exclude name="**/vhd-util"/>
<exclude name="**/.*" />
<exclude name="**/network/domr/mth/" />
<exclude name="**/network/domr/kvm/" />
<exclude name="**/network/domr/xenserver/" />
<exclude name="**/storage/zfs/" />
<exclude name="**/storage/iscsi/" />
<exclude name="**/hypervisor/xen/" />
</fileset>
<filterset>
<filter token="VERSION" value="${impl.version}"/>
@ -227,6 +222,7 @@
<copy todir="${scripts.target.dir}">
<fileset dir="${scripts.dir}">
<include name="**/fsimage.so"/>
<include name="**/vhd-util"/>
</fileset>
</copy>
</target>

View File

@ -2090,12 +2090,10 @@ public abstract class CitrixResourceBase implements ServerResource {
public PrimaryStorageDownloadAnswer execute(final PrimaryStorageDownloadCommand cmd) {
String tmplturl = cmd.getUrl();
int index = tmplturl.lastIndexOf("/");
String tmplpath = tmplturl.substring(0, index);
String poolName = cmd.getPoolUuid();
try {
URI uri = new URI(tmplpath);
String mountpoint = uri.getHost() + ":" + uri.getPath();
URI uri = new URI(tmplturl);
String tmplpath = uri.getHost() + ":" + uri.getPath();
Connection conn = getConnection();
SR poolsr = null;
Set<SR> srs = SR.getByNameLabel(conn, poolName);
@ -2108,7 +2106,7 @@ public abstract class CitrixResourceBase implements ServerResource {
}
String pUuid = poolsr.getUuid(conn);
boolean isISCSI = IsISCSI(poolsr.getType(conn));
String uuid = copy_vhd_from_secondarystorage(conn, mountpoint, pUuid);
String uuid = copy_vhd_from_secondarystorage(conn, tmplpath, pUuid);
VDI tmpl = getVDIbyUuid(conn, uuid);
VDI snapshotvdi = tmpl.snapshot(conn, new HashMap<String, String>());
String snapshotUuid = snapshotvdi.getUuid(conn);
@ -4814,7 +4812,8 @@ public abstract class CitrixResourceBase implements ServerResource {
}
} else {
try {
String uuid = copy_vhd_from_secondarystorage(conn, mountpoint, srUuid);
String volumePath = mountpoint + volumeUUID + ".vhd";
String uuid = copy_vhd_from_secondarystorage(conn, volumePath, srUuid);
return new CopyVolumeAnswer(cmd, true, null, srUuid, uuid);
} finally {
deleteSecondaryStorageFolder(conn, remoteVolumesMountPath, volumeFolder);

View File

@ -54,6 +54,16 @@ if [ $? -ne 0 ]; then
fi
vhdfile=$localmp/$vhdfilename
if [ ${vhdfile%.vhd} == ${vhdfile} ] ; then
vhdfile=$(ls $vhdfile/*.vhd)
if [ $? -ne 0 ]; then
echo "7#There is no vhd file under $mountpoint"
cleanup
exit 0
fi
fi
VHDUTIL="/opt/xensource/bin/vhd-util"