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}"> <fileset dir="${scripts.dir}">
<include name="**/*"/> <include name="**/*"/>
<exclude name="**/fsimage.so"/> <exclude name="**/fsimage.so"/>
<exclude name="**/vhd-util"/>
<exclude name="**/.*" /> <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> </fileset>
<filterset> <filterset>
<filter token="VERSION" value="${impl.version}"/> <filter token="VERSION" value="${impl.version}"/>
@ -227,6 +222,7 @@
<copy todir="${scripts.target.dir}"> <copy todir="${scripts.target.dir}">
<fileset dir="${scripts.dir}"> <fileset dir="${scripts.dir}">
<include name="**/fsimage.so"/> <include name="**/fsimage.so"/>
<include name="**/vhd-util"/>
</fileset> </fileset>
</copy> </copy>
</target> </target>

View File

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

View File

@ -54,6 +54,16 @@ if [ $? -ne 0 ]; then
fi fi
vhdfile=$localmp/$vhdfilename 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" VHDUTIL="/opt/xensource/bin/vhd-util"