From 1e7399dd19f06a4f1187776ae2924c38c4cbf179 Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 28 Jun 2011 14:07:48 -0700 Subject: [PATCH] set correct secondary storage host id in snapshot table --- core/src/com/cloud/storage/SnapshotVO.java | 3 +-- .../com/cloud/storage/snapshot/SnapshotManagerImpl.java | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java index 856fb892e91..3648c641aad 100644 --- a/core/src/com/cloud/storage/SnapshotVO.java +++ b/core/src/com/cloud/storage/SnapshotVO.java @@ -110,7 +110,7 @@ public class SnapshotVO implements Snapshot { public SnapshotVO() { } - public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType, Long secHostId) { + public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) { this.dataCenterId = dcId; this.accountId = accountId; this.domainId = domainId; @@ -125,7 +125,6 @@ public class SnapshotVO implements Snapshot { this.prevSnapshotId = 0; this.hypervisorType = hypervisorType; this.version = "2.2"; - this.secHostId = secHostId; } diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 734e5a38cab..6c46e018024 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -581,6 +581,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma snapshot.setSwiftId(1L); snapshot.setSwiftName(backedUpSnapshotUuid); } else { + snapshot.setSecHostId(secHost.getId()); snapshot.setBackupSnapshotId(backedUpSnapshotUuid); } if (answer.isFull()) { @@ -1279,12 +1280,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma // user Type snapshotType = getSnapshotType(policyId); HypervisorType hypervisorType = this._volsDao.getHypervisorType(volumeId); - HostVO ssHost = _hostDao.findSecondaryStorageHost(volume.getDataCenterId()); - if( ssHost == null ) { - throw new CloudRuntimeException("There is no secondary storage in this zone :" + volume.getDataCenterId()); - } SnapshotVO snapshotVO = new SnapshotVO(volume.getDataCenterId(), volume.getAccountId(), volume.getDomainId(), volume.getId(), volume.getDiskOfferingId(), null, snapshotName, - (short) snapshotType.ordinal(), snapshotType.name(), volume.getSize(), hypervisorType, ssHost.getId()); + (short) snapshotType.ordinal(), snapshotType.name(), volume.getSize(), hypervisorType); SnapshotVO snapshot = _snapshotDao.persist(snapshotVO); if (snapshot != null) {