bug 9541: fix one snapshot DB migrate, one java check and one script typo

status 9541: resolved fixed
This commit is contained in:
anthony 2011-04-22 12:57:16 -07:00
parent 41e5e38fef
commit 8271f034ce
3 changed files with 7 additions and 6 deletions

View File

@ -78,18 +78,19 @@ copyvhd()
{
local desvhd=$1
local srcvhd=$2
local parent=`$VHDUTIL query -p -n $srcvhd`
local parent=
parent=`$VHDUTIL query -p -n $srcvhd`
if [ $? -ne 0 ]; then
echo "30#failed to query $srcvhd"
cleanup
exit 0
fi
if [ "${parent##*vhd has}" = " no parent" ]; then
if [[ "${parent}" =~ " no parent" ]]; then
dd if=$srcvhd of=$desvhd bs=2M
if [ $? -ne 0 ]; then
echo "31#failed to dd $srcvhd to $desvhd"
cleanup
exit 0
exit 0
fi
else
copyvhd $desvhd $parent

View File

@ -590,7 +590,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
String backedUpSnapshotUuid = snapshot.getBackupSnapshotId();
snapshot = _snapshotDao.findById(snapshotId);
if (snapshot.getVersion() == "2.1") {
if (snapshot.getVersion().trim().equals("2.1")) {
VolumeVO volume = _volsDao.findByIdIncludingRemoved(volumeId);
if (volume == null) {
throw new CloudRuntimeException("failed to upgrade snapshot " + snapshotId + " due to unable to find orignal volume:" + volumeId + ", try it later ");

View File

@ -5,8 +5,8 @@ ALTER table snapshots add column `size` bigint unsigned NOT NULL;
ALTER table snapshots add column `version` varchar(32) DEFAULT '2.1';
ALTER table snapshots add column `hypervisor_type` varchar(32) DEFAULT 'XenServer';
DELETE FROM snapshot_policy where id=1;
UPDATE snapshots s, volumes v SET s.data_center_id=v.data_center_id, s.domain_id=v.domain_id, s.disk_offering_id=v.disk_offering_id, s.size=v.size WHERE s.volume_id = v.id;
UPDATE snapshots s, snapshot_policy sp, snapshot_policy_ref spr SET s.hypervisor_type=sp.interval+3 WHERE s.id=spr.snap_id and spr.policy_id=sp.id;
UPDATE snapshots s, snapshot_policy sp, snapshot_policy_ref spr SET s.snapshot_type=sp.interval+3 WHERE s.id=spr.snap_id and spr.policy_id=sp.id;
DROP table snapshot_policy_ref;
DELETE FROM snapshot_policy WHERE id=1;