cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [2/3] Remove IdentityProxy from Response classes.
Date Wed, 19 Dec 2012 00:33:39 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
index 0683b43..785b647 100644
--- a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
@@ -23,14 +23,13 @@ import java.util.Map;
 import org.apache.cloudstack.api.ApiConstants;
 import com.cloud.serializer.Param;
 import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.utils.IdentityProxy;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
 @SuppressWarnings("unused")
 public class TemplateResponse extends BaseResponse implements ControlledEntityResponse {
     @SerializedName(ApiConstants.ID) @Param(description="the template ID")
-    private IdentityProxy id = new IdentityProxy("vm_template");
+    private String id;
 
     @SerializedName(ApiConstants.NAME) @Param(description="the template name")
     private String name;
@@ -68,19 +67,19 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
     private boolean crossZones;
 
     @SerializedName(ApiConstants.OS_TYPE_ID) @Param(description="the ID of the OS type for this template.")
-    private IdentityProxy osTypeId = new IdentityProxy("guest_os");
+    private String osTypeId;
 
     @SerializedName("ostypename") @Param(description="the name of the OS type for this template.")
     private String osTypeName;
 
     @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the account id to which the template belongs")
-    private IdentityProxy accountId = new IdentityProxy("account");
+    private String accountId;
 
     @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account name to which the template belongs")
     private String account;
 
     @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone for this template")
-    private IdentityProxy zoneId = new IdentityProxy("data_center");
+    private String zoneId;
 
     @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone for this template")
     private String zoneName;
@@ -110,10 +109,10 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
     private String checksum;
 
     @SerializedName("sourcetemplateid") @Param(description="the template ID of the parent template if present")
-    private IdentityProxy sourcetemplateId = new IdentityProxy("vm_template");
+    private String sourcetemplateId;
 
     @SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the secondary storage host for the template")
-    private IdentityProxy hostId = new IdentityProxy("host");
+    private String hostId;
 
     @SerializedName("hostname") @Param(description="the name of the secondary storage host for the template")
     private String hostName;
@@ -134,41 +133,38 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
     private List<ResourceTagResponse> tags;
 
 
-    @Override
-    public Long getObjectId() {
-        return getId();
-    }
 
-    public Long getId() {
-        return id.getValue();
+
+    public String getId() {
+        return id;
     }
 
-    public void setZoneId(Long zoneId) {
-        this.zoneId.setValue(zoneId);
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
     }
 
     public void setZoneName(String zoneName) {
         this.zoneName = zoneName;
     }
 
-    public void setAccountId(Long accountId) {
-        this.accountId.setValue(accountId);
+    public void setAccountId(String accountId) {
+        this.accountId = accountId;
     }
 
     public void setAccountName(String account) {
         this.account = account;
     }
 
-    public void setOsTypeId(Long osTypeId) {
-        this.osTypeId.setValue(osTypeId);
+    public void setOsTypeId(String osTypeId) {
+        this.osTypeId = osTypeId;
     }
 
     public void setOsTypeName(String osTypeName) {
         this.osTypeName = osTypeName;
     }
 
-    public void setId(long id) {
-        this.id.setValue(id);
+    public void setId(String id) {
+        this.id = id;
     }
 
     public void setName(String name) {
@@ -249,12 +245,12 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
         this.checksum = checksum;
     }
 
-    public void setSourceTemplateId(Long sourcetemplateId) {
-        this.sourcetemplateId.setValue(sourcetemplateId);
+    public void setSourceTemplateId(String sourcetemplateId) {
+        this.sourcetemplateId = sourcetemplateId;
     }
 
-    public void setHostId(Long hostId) {
-        this.hostId.setValue(hostId);
+    public void setHostId(String hostId) {
+        this.hostId = hostId;
     }
 
     public void setHostName(String hostName) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/core/src/com/cloud/storage/SnapshotPolicyVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotPolicyVO.java b/core/src/com/cloud/storage/SnapshotPolicyVO.java
index 5ba2c64..e5b0cb5 100644
--- a/core/src/com/cloud/storage/SnapshotPolicyVO.java
+++ b/core/src/com/cloud/storage/SnapshotPolicyVO.java
@@ -31,13 +31,13 @@ import com.cloud.utils.DateUtil.IntervalType;
 
 @Entity
 @Table(name="snapshot_policy")
-public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
-	
+public class SnapshotPolicyVO implements SnapshotPolicy{
+
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     @Column(name="id")
     long id;
-    
+
     @Column(name="volume_id")
     long volumeId;
 
@@ -46,20 +46,20 @@ public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
 
     @Column(name="timezone")
     String timezone;
-    
+
     @Column(name="interval")
     private short interval;
-    
+
     @Column(name="max_snaps")
     private int maxSnaps;
-    
+
     @Column(name="active")
     boolean active = false;
 
     @Column(name="uuid")
     String uuid;
-    
-    public SnapshotPolicyVO() { 
+
+    public SnapshotPolicyVO() {
     	this.uuid = UUID.randomUUID().toString();
     }
 
@@ -76,7 +76,7 @@ public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
     public long getId() {
         return id;
     }
-    
+
     public long getVolumeId() {
 		return volumeId;
 	}
@@ -88,7 +88,7 @@ public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
     public String getSchedule() {
         return schedule;
     }
-    
+
     public void setInterval(short interval) {
         this.interval = interval;
     }
@@ -96,11 +96,11 @@ public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
     public void setTimezone(String timezone) {
         this.timezone = timezone;
     }
-    
+
     public String getTimezone() {
         return timezone;
     }
-    
+
     public short getInterval() {
         return interval;
     }
@@ -120,12 +120,12 @@ public class SnapshotPolicyVO implements SnapshotPolicy, Identity {
     public void setActive(boolean active) {
         this.active = active;
     }
-    
+
     @Override
     public String getUuid() {
     	return this.uuid;
     }
-    
+
     public void setUuid(String uuid) {
     	this.uuid = uuid;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/core/src/com/cloud/storage/SnapshotScheduleVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotScheduleVO.java b/core/src/com/cloud/storage/SnapshotScheduleVO.java
index 1ec3217..4b89c6f 100644
--- a/core/src/com/cloud/storage/SnapshotScheduleVO.java
+++ b/core/src/com/cloud/storage/SnapshotScheduleVO.java
@@ -33,13 +33,13 @@ import com.cloud.storage.snapshot.SnapshotSchedule;
 
 @Entity
 @Table(name="snapshot_schedule")
-public class SnapshotScheduleVO implements SnapshotSchedule, Identity {
+public class SnapshotScheduleVO implements SnapshotSchedule {
 
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
 	@Column(name="id")
 	long id;
-	
+
     // DB constraint: For a given volume and policyId, there will only be one entry in this table.
     @Column(name="volume_id")
     long volumeId;
@@ -50,16 +50,16 @@ public class SnapshotScheduleVO implements SnapshotSchedule, Identity {
     @Column(name="scheduled_timestamp")
     @Temporal(value=TemporalType.TIMESTAMP)
     Date scheduledTimestamp;
-    
+
     @Column(name="async_job_id")
     Long asyncJobId;
-    
+
     @Column(name="snapshot_id")
     Long snapshotId;
 
     @Column(name="uuid")
     String uuid = UUID.randomUUID().toString();
-    
+
     public SnapshotScheduleVO() { }
 
     public SnapshotScheduleVO(long volumeId, long policyId, Date scheduledTimestamp) {
@@ -69,15 +69,15 @@ public class SnapshotScheduleVO implements SnapshotSchedule, Identity {
         this.snapshotId = null;
         this.asyncJobId = null;
     }
-    
+
     public long getId() {
         return id;
     }
-    
+
     public Long getVolumeId() {
         return volumeId;
     }
-    
+
     public Long getPolicyId() {
         return policyId;
     }
@@ -92,7 +92,7 @@ public class SnapshotScheduleVO implements SnapshotSchedule, Identity {
 	public Date getScheduledTimestamp() {
 		return scheduledTimestamp;
 	}
-	
+
 	public void setScheduledTimestamp(Date scheduledTimestamp) {
         this.scheduledTimestamp = scheduledTimestamp;
     }
@@ -100,24 +100,24 @@ public class SnapshotScheduleVO implements SnapshotSchedule, Identity {
     public Long getAsyncJobId() {
 	    return asyncJobId;
 	}
-	
+
 	public void setAsyncJobId(Long asyncJobId) {
 	    this.asyncJobId = asyncJobId;
 	}
-	
+
 	public Long getSnapshotId() {
 	    return snapshotId;
 	}
-	
+
 	public void setSnapshotId(Long snapshotId) {
 	    this.snapshotId = snapshotId;
 	}
-	
+
 	@Override
 	public String getUuid() {
 		return this.uuid;
 	}
-	
+
 	public void setUuid(String uuid) {
 		this.uuid = uuid;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/core/src/com/cloud/storage/SwiftVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SwiftVO.java b/core/src/com/cloud/storage/SwiftVO.java
index 6389002..239bd75 100644
--- a/core/src/com/cloud/storage/SwiftVO.java
+++ b/core/src/com/cloud/storage/SwiftVO.java
@@ -32,19 +32,19 @@ import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name="swift")
-public class SwiftVO implements Swift, Identity {
-	
+public class SwiftVO implements Swift {
+
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     @Column(name="id")
     private long id;
-    
+
     @Column(name="url")
     String url;
 
     @Column(name="account")
     String account;
-    
+
     @Column(name="username")
     String userName;
 
@@ -53,10 +53,10 @@ public class SwiftVO implements Swift, Identity {
 
     @Column(name="uuid")
     String uuid = UUID.randomUUID().toString();
-    
+
     @Column(name = GenericDao.CREATED_COLUMN)
     private Date created;
-        
+
     public SwiftVO() { }
 
     public SwiftVO(String url, String account, String userName, String key) {
@@ -95,12 +95,12 @@ public class SwiftVO implements Swift, Identity {
     public SwiftTO toSwiftTO() {
         return new SwiftTO(getId(), getUrl(), getAccount(), getUserName(), getKey());
     }
-    
+
     @Override
     public String getUuid() {
     	return this.uuid;
     }
-    
+
     public void setUuid(String uuid) {
     	this.uuid = uuid;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/core/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateVO.java b/core/src/com/cloud/storage/VMTemplateVO.java
index 8ad768d..fdfd5a1 100755
--- a/core/src/com/cloud/storage/VMTemplateVO.java
+++ b/core/src/com/cloud/storage/VMTemplateVO.java
@@ -40,7 +40,7 @@ import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name="vm_template")
-public class VMTemplateVO implements VirtualMachineTemplate, Identity {
+public class VMTemplateVO implements VirtualMachineTemplate {
     @Id
     @TableGenerator(name="vm_template_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_template_seq", allocationSize=1)
     @Column(name="id", nullable = false)
@@ -85,7 +85,7 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
     private long accountId;
 
     @Column(name="checksum")
-    private String checksum;    
+    private String checksum;
 
     @Column(name="display_text", length=4096)
     private String displayText;
@@ -117,16 +117,16 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
 
     @Column(name="template_tag")
     private String templateTag;
-    
+
     @Column(name="uuid")
     private String uuid;
-    
+
     @Column(name="sort_key")
     private int sortKey;
-    
+
     @Column(name="enable_sshkey")
     private boolean enableSshKey;
-    
+
     @Transient
     Map details;
 
@@ -156,7 +156,7 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
         this.templateTag = templateTag;
     	this.uuid = UUID.randomUUID().toString();
     	this.enableSshKey = sshKeyEnabled;
-    }    
+    }
 
     public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
         this.id = id;
@@ -391,30 +391,30 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
     @Override
     public String getTemplateTag() {
         return templateTag;
-    }    
+    }
 
     public void setTemplateTag(String templateTag) {
         this.templateTag = templateTag;
-    }   
+    }
 
     @Override
     public long getDomainId() {
         return -1;
     }
-    
+
     @Override
     public String getUuid() {
     	return this.uuid;
     }
-    
+
     public void setUuid(String uuid) {
     	this.uuid = uuid;
     }
-    
+
     public Map getDetails() {
     	return this.details;
     }
-    
+
     public void setDetails(Map details) {
     	this.details = details;
     }
@@ -429,7 +429,7 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
         }
         VMTemplateVO other = (VMTemplateVO)that;
 
-        return ((this.getUniqueName().equals(other.getUniqueName())));		
+        return ((this.getUniqueName().equals(other.getUniqueName())));
     }
 
     @Override
@@ -450,11 +450,11 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
     public void setRemoved(Date removed) {
         this.removed = removed;
     }
-    
+
     public void setSortKey(int key) {
     	sortKey = key;
     }
-    
+
     public int getSortKey() {
     	return sortKey;
     }
@@ -463,7 +463,7 @@ public class VMTemplateVO implements VirtualMachineTemplate, Identity {
 	public boolean getEnableSshKey() {
 		return enableSshKey;
 	}
-	
+
 	public void setEnableSshKey(boolean enable) {
 		enableSshKey = enable;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java b/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
index f5f810a..55a2484 100644
--- a/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
+++ b/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
@@ -20,9 +20,11 @@ import java.util.Date;
 
 public interface SnapshotSchedule {
     long getId();
-    
+
+    String getUuid();
+
     Long getVolumeId();
-    
+
     Long getPolicyId();
 
     void setPolicyId(long policyId);
@@ -31,14 +33,14 @@ public interface SnapshotSchedule {
      * @return the scheduledTimestamp
      */
     Date getScheduledTimestamp();
-    
+
     void setScheduledTimestamp(Date scheduledTimestamp);
 
     Long getAsyncJobId();
-    
+
     void setAsyncJobId(Long asyncJobId);
-    
+
     Long getSnapshotId();
-    
+
     void setSnapshotId(Long snapshotId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index f2b60ff..8deec55 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -177,6 +177,7 @@ import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.GuestOSCategoryDao;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.storage.dao.SnapshotDao;
+import com.cloud.storage.dao.SnapshotPolicyDao;
 import com.cloud.storage.dao.StoragePoolDao;
 import com.cloud.storage.dao.UploadDao;
 import com.cloud.storage.dao.VMTemplateDao;
@@ -185,6 +186,7 @@ import com.cloud.storage.dao.VMTemplateHostDao;
 import com.cloud.storage.dao.VMTemplateSwiftDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.dao.VolumeHostDao;
+import com.cloud.storage.snapshot.SnapshotPolicy;
 import com.cloud.user.Account;
 import com.cloud.user.AccountDetailsDao;
 import com.cloud.user.AccountVO;
@@ -305,6 +307,7 @@ public class ApiDBUtils {
     private static StaticRouteDao _staticRouteDao;
     private static VpcGatewayDao _vpcGatewayDao;
     private static VpcDao _vpcDao;
+    private static SnapshotPolicyDao _snapshotPolicyDao;
 
     static {
         _ms = (ManagementServer) ComponentLocator.getComponent(ManagementServer.Name);
@@ -389,6 +392,7 @@ public class ApiDBUtils {
         _asVmProfileDao = locator.getDao(AutoScaleVmProfileDao.class);
         _asVmGroupDao = locator.getDao(AutoScaleVmGroupDao.class);
         _vpcDao = locator.getDao(VpcDao.class);
+        _snapshotPolicyDao = locator.getDao(SnapshotPolicyDao.class);
 
         // Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
         _statsCollector = StatsCollector.getInstance();
@@ -1028,6 +1032,11 @@ public class ApiDBUtils {
     public static VpcVO findVpcById(long vpcId){
         return _vpcDao.findById(vpcId);
     }
+
+    public static SnapshotPolicy findSnapshotPolicyById(long policyId){
+        return _snapshotPolicyDao.findById(policyId);
+    }
+
     ///////////////////////////////////////////////////////////////////////
     //  Newly Added Utility Methods for List API refactoring             //
     ///////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 4b1b3ea..27fb647 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -107,6 +107,7 @@ import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
 import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
 import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
 import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
 import org.apache.cloudstack.api.response.StaticRouteResponse;
 import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
@@ -125,6 +126,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.bouncycastle.util.IPAddress;
+
 import com.cloud.async.AsyncJob;
 import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityVO;
@@ -228,6 +231,7 @@ import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.snapshot.SnapshotPolicy;
+import com.cloud.storage.snapshot.SnapshotSchedule;
 import com.cloud.template.VirtualMachineTemplate;
 import com.cloud.test.PodZoneConfig;
 import com.cloud.user.Account;
@@ -281,7 +285,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
         accountResponse.setState(account.getState().toString());
         accountResponse.setNetworkDomain(account.getNetworkDomain());
-        DataCenterVO dc = ApiDBUtils.findZoneById(account.getDefaultZoneId());
+        DataCenter dc = ApiDBUtils.findZoneById(account.getDefaultZoneId());
         if (dc != null) {
             accountResponse.setDefaultZone(dc.getUuid());
         }
@@ -555,15 +559,15 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public SnapshotResponse createSnapshotResponse(Snapshot snapshot) {
         SnapshotResponse snapshotResponse = new SnapshotResponse();
-        snapshotResponse.setId(snapshot.getId());
+        snapshotResponse.setId(snapshot.getUuid());
 
         populateOwner(snapshotResponse, snapshot);
 
         VolumeVO volume = findVolumeById(snapshot.getVolumeId());
         String snapshotTypeStr = snapshot.getType().name();
         snapshotResponse.setSnapshotType(snapshotTypeStr);
-        snapshotResponse.setVolumeId(snapshot.getVolumeId());
         if (volume != null) {
+            snapshotResponse.setVolumeId(volume.getUuid());
             snapshotResponse.setVolumeName(volume.getName());
             snapshotResponse.setVolumeType(volume.getVolumeType().name());
         }
@@ -588,8 +592,11 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public SnapshotPolicyResponse createSnapshotPolicyResponse(SnapshotPolicy policy) {
         SnapshotPolicyResponse policyResponse = new SnapshotPolicyResponse();
-        policyResponse.setId(policy.getId());
-        policyResponse.setVolumeId(policy.getVolumeId());
+        policyResponse.setId(policy.getUuid());
+        Volume vol = ApiDBUtils.findVolumeById(policy.getVolumeId());
+        if (vol != null) {
+            policyResponse.setVolumeId(vol.getUuid());
+        }
         policyResponse.setSchedule(policy.getSchedule());
         policyResponse.setIntervalType(policy.getInterval());
         policyResponse.setMaxSnaps(policy.getMaxSnaps());
@@ -617,7 +624,7 @@ public class ApiResponseHelper implements ResponseGenerator {
             }
         }
         hostResponse.setCpuNumber(host.getCpus());
-        DataCenterVO zone = ApiDBUtils.findZoneById(host.getDataCenterId());
+        DataCenter zone = ApiDBUtils.findZoneById(host.getDataCenterId());
         if (zone != null) {
             hostResponse.setZoneId(zone.getUuid());
         }
@@ -741,7 +748,7 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public SwiftResponse createSwiftResponse(Swift swift) {
         SwiftResponse swiftResponse = new SwiftResponse();
-        swiftResponse.setId(swift.getId());
+        swiftResponse.setId(swift.getUuid());
         swiftResponse.setUrl(swift.getUrl());
         swiftResponse.setAccount(swift.getAccount());
         swiftResponse.setUsername(swift.getUserName());
@@ -801,7 +808,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         if (ipAddr.getAllocatedTime() != null) {
             ipResponse.setAllocated(ipAddr.getAllocatedTime());
         }
-        DataCenterVO zone = ApiDBUtils.findZoneById(ipAddr.getDataCenterId());
+        DataCenter zone = ApiDBUtils.findZoneById(ipAddr.getDataCenterId());
         if (zone != null) {
             ipResponse.setZoneId(zone.getUuid());
             ipResponse.setZoneName(zone.getName());
@@ -839,7 +846,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         if (ipAddr.getVpcId() != null) {
-            VpcVO vpc = ApiDBUtils.findVpcById(ipAddr.getVpcId());
+            Vpc vpc = ApiDBUtils.findVpcById(ipAddr.getVpcId());
             if (vpc != null) {
                 ipResponse.setVpcId(vpc.getUuid());
             }
@@ -906,14 +913,14 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public LoadBalancerResponse createLoadBalancerResponse(LoadBalancer loadBalancer) {
         LoadBalancerResponse lbResponse = new LoadBalancerResponse();
-        lbResponse.setId(loadBalancer.getId());
+        lbResponse.setId(loadBalancer.getUuid());
         lbResponse.setName(loadBalancer.getName());
         lbResponse.setDescription(loadBalancer.getDescription());
         List<String> cidrs = ApiDBUtils.findFirewallSourceCidrs(loadBalancer.getId());
         lbResponse.setCidrList(StringUtils.join(cidrs, ","));
 
         IPAddressVO publicIp = ApiDBUtils.findIpAddressById(loadBalancer.getSourceIpAddressId());
-        lbResponse.setPublicIpId(publicIp.getId());
+        lbResponse.setPublicIpId(publicIp.getUuid());
         lbResponse.setPublicIp(publicIp.getAddress().addr());
         lbResponse.setPublicPort(Integer.toString(loadBalancer.getSourcePortStart()));
         lbResponse.setPrivatePort(Integer.toString(loadBalancer.getDefaultPortStart()));
@@ -925,7 +932,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
         lbResponse.setState(stateToSet);
         populateOwner(lbResponse, loadBalancer);
-        lbResponse.setZoneId(publicIp.getDataCenterId());
+        DataCenter zone = ApiDBUtils.findZoneById(publicIp.getDataCenterId());
+        if (zone != null) {
+            lbResponse.setZoneId(zone.getUuid());
+        }
 
         //set tag information
         List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.UserVm, loadBalancer.getId());
@@ -950,10 +960,13 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         PodResponse podResponse = new PodResponse();
-        podResponse.setId(pod.getId());
+        podResponse.setId(pod.getUuid());
         podResponse.setName(pod.getName());
-        podResponse.setZoneId(pod.getDataCenterId());
-        podResponse.setZoneName(PodZoneConfig.getZoneName(pod.getDataCenterId()));
+        DataCenter zone = ApiDBUtils.findZoneById(pod.getDataCenterId());
+        if (zone != null) {
+            podResponse.setZoneId(zone.getUuid());
+            podResponse.setZoneName(zone.getName());
+        }
         podResponse.setNetmask(NetUtils.getCidrNetmask(pod.getCidrSize()));
         podResponse.setStartIp(ipRange[0]);
         podResponse.setEndIp(((ipRange.length > 1) && (ipRange[1] != null)) ? ipRange[1] : "");
@@ -1233,20 +1246,23 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public StoragePoolResponse createStoragePoolResponse(StoragePool pool) {
         StoragePoolResponse poolResponse = new StoragePoolResponse();
-        poolResponse.setId(pool.getId());
+        poolResponse.setId(pool.getUuid());
         poolResponse.setName(pool.getName());
         poolResponse.setState(pool.getStatus());
         poolResponse.setPath(pool.getPath());
         poolResponse.setIpAddress(pool.getHostAddress());
-        poolResponse.setZoneId(pool.getDataCenterId());
-        poolResponse.setZoneName(ApiDBUtils.findZoneById(pool.getDataCenterId()).getName());
+        DataCenter zone = ApiDBUtils.findZoneById(pool.getDataCenterId());
+        if ( zone != null ){
+        poolResponse.setZoneId(zone.getUuid());
+        poolResponse.setZoneName(zone.getName());
+        }
         if (pool.getPoolType() != null) {
             poolResponse.setType(pool.getPoolType().toString());
         }
         if (pool.getPodId() != null) {
-            poolResponse.setPodId(pool.getPodId());
             HostPodVO pod = ApiDBUtils.findPodById(pool.getPodId());
             if (pod != null) {
+                poolResponse.setPodId(pod.getUuid());
                 poolResponse.setPodName(pod.getName());
             }
         }
@@ -1266,7 +1282,7 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         if (pool.getClusterId() != null) {
             ClusterVO cluster = ApiDBUtils.findClusterById(pool.getClusterId());
-            poolResponse.setClusterId(cluster.getId());
+            poolResponse.setClusterId(cluster.getUuid());
             poolResponse.setClusterName(cluster.getName());
         }
         poolResponse.setTags(ApiDBUtils.getStoragePoolTags(pool.getId()));
@@ -1284,7 +1300,7 @@ public class ApiResponseHelper implements ResponseGenerator {
             clusterResponse.setPodId(pod.getUuid());
             clusterResponse.setPodName(pod.getName());
         }
-        DataCenterVO dc = ApiDBUtils.findZoneById(cluster.getDataCenterId());
+        DataCenter dc = ApiDBUtils.findZoneById(cluster.getDataCenterId());
         if (dc != null) {
             clusterResponse.setZoneId(dc.getUuid());
             clusterResponse.setZoneName(dc.getName());
@@ -1381,7 +1397,7 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public IpForwardingRuleResponse createIpForwardingRuleResponse(StaticNatRule fwRule) {
         IpForwardingRuleResponse response = new IpForwardingRuleResponse();
-        response.setId(fwRule.getId());
+        response.setId(fwRule.getUuid());
         response.setProtocol(fwRule.getProtocol());
 
         IpAddress ip = ApiDBUtils.findIpAddressById(fwRule.getSourceIpAddressId());
@@ -1391,7 +1407,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         if (ip != null && fwRule.getDestIpAddress() != null) {
             UserVm vm = ApiDBUtils.findUserVmById(ip.getAssociatedWithVmId());
             if (vm != null) {// vm might be destroyed
-                response.setVirtualMachineId(vm.getId());
+                response.setVirtualMachineId(vm.getUuid());
                 response.setVirtualMachineName(vm.getHostName());
                 if (vm.getDisplayName() != null) {
                     response.setVirtualMachineDisplayName(vm.getDisplayName());
@@ -1443,19 +1459,29 @@ public class ApiResponseHelper implements ResponseGenerator {
         SystemVmResponse vmResponse = new SystemVmResponse();
         if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) {
             // SystemVm vm = (SystemVm) systemVM;
-            vmResponse.setId(vm.getId());
+            vmResponse.setId(vm.getUuid());
             vmResponse.setObjectId(vm.getId());
             vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
-            vmResponse.setZoneId(vm.getDataCenterIdToDeployIn());
 
             vmResponse.setName(vm.getHostName());
-            vmResponse.setPodId(vm.getPodIdToDeployIn());
-            vmResponse.setTemplateId(vm.getTemplateId());
+            if ( vm.getPodIdToDeployIn() != null ){
+                HostPodVO pod = ApiDBUtils.findPodById(vm.getPodIdToDeployIn());
+                if ( pod != null ){
+            vmResponse.setPodId(pod.getUuid());
+                }
+            }
+            VMTemplateVO template = ApiDBUtils.findTemplateById(vm.getTemplateId());
+            if (template != null){
+            vmResponse.setTemplateId(template.getUuid());
+            }
             vmResponse.setCreated(vm.getCreated());
 
             if (vm.getHostId() != null) {
-                vmResponse.setHostId(vm.getHostId());
-                vmResponse.setHostName(ApiDBUtils.findHostById(vm.getHostId()).getName());
+                Host host = ApiDBUtils.findHostById(vm.getHostId());
+                if (host != null) {
+                    vmResponse.setHostId(host.getUuid());
+                    vmResponse.setHostName(host.getName());
+                }
             }
 
             if (vm.getState() != null) {
@@ -1473,6 +1499,7 @@ public class ApiResponseHelper implements ResponseGenerator {
 
             DataCenter zone = ApiDBUtils.findZoneById(vm.getDataCenterIdToDeployIn());
             if (zone != null) {
+                vmResponse.setZoneId(zone.getUuid());
                 vmResponse.setZoneName(zone.getName());
                 vmResponse.setDns1(zone.getDns1());
                 vmResponse.setDns2(zone.getDns2());
@@ -1550,8 +1577,11 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn) {
         RemoteAccessVpnResponse vpnResponse = new RemoteAccessVpnResponse();
-        vpnResponse.setPublicIpId(vpn.getServerAddressId());
-        vpnResponse.setPublicIp(ApiDBUtils.findIpAddressById(vpn.getServerAddressId()).getAddress().addr());
+        IpAddress ip = ApiDBUtils.findIpAddressById(vpn.getServerAddressId());
+        if (ip != null) {
+            vpnResponse.setPublicIpId(ip.getUuid());
+            vpnResponse.setPublicIp(ip.getAddress().addr());
+        }
         vpnResponse.setIpRange(vpn.getIpRange());
         vpnResponse.setPresharedKey(vpn.getIpsecPresharedKey());
 
@@ -1566,14 +1596,17 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public TemplateResponse createIsoResponse(VirtualMachineTemplate result) {
         TemplateResponse response = new TemplateResponse();
-        response.setId(result.getId());
+        response.setId(result.getUuid());
         response.setName(result.getName());
         response.setDisplayText(result.getDisplayText());
         response.setPublic(result.isPublicTemplate());
         response.setCreated(result.getCreated());
         response.setFormat(result.getFormat());
-        response.setOsTypeId(result.getGuestOSId());
-        response.setOsTypeName(ApiDBUtils.findGuestOSById(result.getGuestOSId()).getDisplayName());
+        GuestOS os = ApiDBUtils.findGuestOSById(result.getGuestOSId());
+        if (os != null) {
+            response.setOsTypeId(os.getUuid());
+            response.setOsTypeName(os.getDisplayName());
+        }
         response.setDetails(result.getDetails());
         Account caller = UserContext.current().getCaller();
 
@@ -1635,7 +1668,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         TemplateResponse templateResponse = new TemplateResponse();
-        templateResponse.setId(template.getId());
+        templateResponse.setId(template.getUuid());
         templateResponse.setName(template.getName());
         templateResponse.setDisplayText(template.getDisplayText());
         templateResponse.setPublic(template.isPublicTemplate());
@@ -1656,10 +1689,10 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         GuestOS os = ApiDBUtils.findGuestOSById(template.getGuestOSId());
         if (os != null) {
-            templateResponse.setOsTypeId(os.getId());
+            templateResponse.setOsTypeId(os.getUuid());
             templateResponse.setOsTypeName(os.getDisplayName());
         } else {
-            templateResponse.setOsTypeId(-1L);
+            templateResponse.setOsTypeId("-1");
             templateResponse.setOsTypeName("");
         }
 
@@ -1685,7 +1718,12 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         templateResponse.setChecksum(template.getChecksum());
-        templateResponse.setSourceTemplateId(template.getSourceTemplateId());
+        if (template.getSourceTemplateId() != null) {
+            VirtualMachineTemplate tmpl = ApiDBUtils.findTemplateById(template.getSourceTemplateId());
+            if (tmpl != null) {
+                templateResponse.setSourceTemplateId(tmpl.getUuid());
+            }
+        }
 
         templateResponse.setChecksum(template.getChecksum());
 
@@ -1711,7 +1749,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         TemplateResponse templateResponse = new TemplateResponse();
-        templateResponse.setId(template.getId());
+        templateResponse.setId(template.getUuid());
         templateResponse.setName(template.getName());
         templateResponse.setDisplayText(template.getDisplayText());
         templateResponse.setPublic(template.isPublicTemplate());
@@ -1732,10 +1770,10 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         GuestOS os = ApiDBUtils.findGuestOSById(template.getGuestOSId());
         if (os != null) {
-            templateResponse.setOsTypeId(os.getId());
+            templateResponse.setOsTypeId(os.getUuid());
             templateResponse.setOsTypeName(os.getDisplayName());
         } else {
-            templateResponse.setOsTypeId(-1L);
+            templateResponse.setOsTypeId("-1");
             templateResponse.setOsTypeName("");
         }
 
@@ -1743,11 +1781,13 @@ public class ApiResponseHelper implements ResponseGenerator {
         populateAccount(templateResponse, account.getId());
         populateDomain(templateResponse, account.getDomainId());
 
-        DataCenterVO datacenter = ApiDBUtils.findZoneById(zoneId);
+        DataCenter datacenter = ApiDBUtils.findZoneById(zoneId);
 
-        // Add the zone ID
-        templateResponse.setZoneId(zoneId);
-        templateResponse.setZoneName(datacenter.getName());
+        if (datacenter != null) {
+            // Add the zone ID
+            templateResponse.setZoneId(datacenter.getUuid());
+            templateResponse.setZoneName(datacenter.getName());
+        }
 
         boolean isAdmin = false;
         Account caller = UserContext.current().getCaller();
@@ -1783,7 +1823,12 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         templateResponse.setChecksum(template.getChecksum());
-        templateResponse.setSourceTemplateId(template.getSourceTemplateId());
+        if (template.getSourceTemplateId() != null) {
+            VirtualMachineTemplate tmpl = ApiDBUtils.findTemplateById(template.getSourceTemplateId());
+            if (tmpl != null) {
+                templateResponse.setSourceTemplateId(tmpl.getUuid());
+            }
+        }
 
         templateResponse.setChecksum(template.getChecksum());
 
@@ -1815,7 +1860,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         VirtualMachineTemplate iso = findTemplateById(isoId);
         if (iso.getTemplateType() == TemplateType.PERHOST) {
             TemplateResponse isoResponse = new TemplateResponse();
-            isoResponse.setId(iso.getId());
+            isoResponse.setId(iso.getUuid());
             isoResponse.setName(iso.getName());
             isoResponse.setDisplayText(iso.getDisplayText());
             isoResponse.setPublic(iso.isPublicTemplate());
@@ -1873,7 +1918,7 @@ public class ApiResponseHelper implements ResponseGenerator {
             return isoResponses;
         }
         TemplateResponse isoResponse = new TemplateResponse();
-        isoResponse.setId(iso.getId());
+        isoResponse.setId(iso.getUuid());
         isoResponse.setName(iso.getName());
         isoResponse.setDisplayText(iso.getDisplayText());
         isoResponse.setPublic(iso.isPublicTemplate());
@@ -1890,10 +1935,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         // TODO: implement
         GuestOS os = ApiDBUtils.findGuestOSById(iso.getGuestOSId());
         if (os != null) {
-            isoResponse.setOsTypeId(os.getId());
+            isoResponse.setOsTypeId(os.getUuid());
             isoResponse.setOsTypeName(os.getDisplayName());
         } else {
-            isoResponse.setOsTypeId(-1L);
+            isoResponse.setOsTypeId("-1");
             isoResponse.setOsTypeName("");
         }
         Account account = ApiDBUtils.findAccountByIdIncludingRemoved(iso.getAccountId());
@@ -1927,7 +1972,7 @@ public class ApiResponseHelper implements ResponseGenerator {
             return isoResponses;
         }
         TemplateResponse isoResponse = new TemplateResponse();
-        isoResponse.setId(iso.getId());
+        isoResponse.setId(iso.getUuid());
         isoResponse.setName(iso.getName());
         isoResponse.setDisplayText(iso.getDisplayText());
         isoResponse.setPublic(iso.isPublicTemplate());
@@ -1944,10 +1989,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         // TODO: implement
         GuestOS os = ApiDBUtils.findGuestOSById(iso.getGuestOSId());
         if (os != null) {
-            isoResponse.setOsTypeId(os.getId());
+            isoResponse.setOsTypeId(os.getUuid());
             isoResponse.setOsTypeName(os.getDisplayName());
         } else {
-            isoResponse.setOsTypeId(-1L);
+            isoResponse.setOsTypeId("-1");
             isoResponse.setOsTypeName("");
         }
 
@@ -1961,9 +2006,11 @@ public class ApiResponseHelper implements ResponseGenerator {
             isAdmin = true;
         }
         // Add the zone ID
-        DataCenterVO datacenter = ApiDBUtils.findZoneById(zoneId);
-        isoResponse.setZoneId(zoneId);
-        isoResponse.setZoneName(datacenter.getName());
+        DataCenter datacenter = ApiDBUtils.findZoneById(zoneId);
+        if (datacenter != null) {
+            isoResponse.setZoneId(datacenter.getUuid());
+            isoResponse.setZoneName(datacenter.getName());
+        }
 
         // If the user is an admin, add the template download status
         if (isAdmin || caller.getId() == iso.getAccountId()) {
@@ -2399,7 +2446,7 @@ public class ApiResponseHelper implements ResponseGenerator {
                     }
                 }
             }
-            DataCenterVO zone = ApiDBUtils.findZoneById(summedCapacity.getDataCenterId());
+            DataCenter zone = ApiDBUtils.findZoneById(summedCapacity.getDataCenterId());
             if (zone != null) {
                 capacityResponse.setZoneId(zone.getUuid());
                 capacityResponse.setZoneName(zone.getName());
@@ -2432,10 +2479,13 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         TemplatePermissionsResponse response = new TemplatePermissionsResponse();
-        response.setId(template.getId());
+        response.setId(template.getUuid());
         response.setPublicTemplate(template.isPublicTemplate());
         if (isAdmin && (templateOwnerDomain != null)) {
-            response.setDomainId(templateOwnerDomain);
+            Domain domain = ApiDBUtils.findDomainById(templateOwnerDomain);
+            if (domain != null) {
+                response.setDomainId(domain.getUuid());
+            }
         }
 
         // Set accounts
@@ -2541,7 +2591,7 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering offering) {
         NetworkOfferingResponse response = new NetworkOfferingResponse();
-        response.setId(offering.getId());
+        response.setId(offering.getUuid());
         response.setName(offering.getName());
         response.setDisplayText(offering.getDisplayText());
         response.setTags(offering.getTags());
@@ -2552,11 +2602,18 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setSpecifyIpRanges(offering.getSpecifyIpRanges());
         response.setAvailability(offering.getAvailability().toString());
         response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
+        Long so = null;
         if (offering.getServiceOfferingId() != null) {
-            response.setServiceOfferingId(offering.getServiceOfferingId());
+            so = offering.getServiceOfferingId();
         } else {
-            response.setServiceOfferingId(ApiDBUtils.findDefaultRouterServiceOffering());
+            so = ApiDBUtils.findDefaultRouterServiceOffering();
+        }
+        if (so != null) {
+            ServiceOffering soffering = ApiDBUtils.findServiceOfferingById(so);
+            if (soffering != null)
+                response.setServiceOfferingId(soffering.getUuid());
         }
+
         if (offering.getGuestType() != null) {
             response.setGuestIpType(offering.getGuestType().toString());
         }
@@ -2634,7 +2691,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         // need to get network profile in order to retrieve dns information from there
         NetworkProfile profile = ApiDBUtils.getNetworkProfile(network.getId());
         NetworkResponse response = new NetworkResponse();
-        response.setId(network.getId());
+        response.setId(network.getUuid());
         response.setName(network.getName());
         response.setDisplaytext(network.getDisplayText());
         if (network.getBroadcastDomainType() != null) {
@@ -2671,14 +2728,19 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         DataCenter zone = ApiDBUtils.findZoneById(network.getDataCenterId());
-        response.setZoneId(network.getDataCenterId());
-        response.setZoneName(zone.getName());
-        response.setPhysicalNetworkId(network.getPhysicalNetworkId());
+        if (zone != null) {
+            response.setZoneId(zone.getUuid());
+            response.setZoneName(zone.getName());
+        }
+        if (network.getPhysicalNetworkId() != null) {
+            PhysicalNetworkVO pnet = ApiDBUtils.findPhysicalNetworkById(network.getPhysicalNetworkId());
+            response.setPhysicalNetworkId(pnet.getUuid());
+        }
 
         // populate network offering information
         NetworkOffering networkOffering = ApiDBUtils.findNetworkOfferingById(network.getNetworkOfferingId());
         if (networkOffering != null) {
-            response.setNetworkOfferingId(networkOffering.getId());
+            response.setNetworkOfferingId(networkOffering.getUuid());
             response.setNetworkOfferingName(networkOffering.getName());
             response.setNetworkOfferingDisplayText(networkOffering.getDisplayText());
             response.setIsSystem(networkOffering.isSystemOnly());
@@ -2690,7 +2752,10 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
         response.setState(network.getState().toString());
         response.setRestartRequired(network.isRestartRequired());
-        response.setRelated(network.getRelated());
+        NetworkVO nw = ApiDBUtils.findNetworkById(network.getRelated());
+        if (nw != null) {
+            response.setRelated(nw.getUuid());
+        }
         response.setNetworkDomain(network.getNetworkDomain());
 
         response.setDns1(profile.getDns1());
@@ -2752,7 +2817,12 @@ public class ApiResponseHelper implements ResponseGenerator {
         }
 
         response.setSpecifyIpRanges(network.getSpecifyIpRanges());
-        response.setVpcId(network.getVpcId());
+        if (network.getVpcId() != null) {
+            Vpc vpc = ApiDBUtils.findVpcById(network.getVpcId());
+            if (vpc != null) {
+                response.setVpcId(vpc.getUuid());
+            }
+        }
         response.setCanUseForDeploy(ApiDBUtils.canUseForDeploy(network));
 
         //set tag information
@@ -2837,7 +2907,7 @@ public class ApiResponseHelper implements ResponseGenerator {
     public NetworkACLResponse createNetworkACLResponse(FirewallRule networkACL) {
         NetworkACLResponse response = new NetworkACLResponse();
 
-        response.setId(networkACL.getId());
+        response.setId(networkACL.getUuid());
         response.setProtocol(networkACL.getProtocol());
         if (networkACL.getSourcePortStart() != null) {
             response.setStartPort(Integer.toString(networkACL.getSourcePortStart()));
@@ -2959,11 +3029,14 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public SystemVmInstanceResponse createSystemVmInstanceResponse(VirtualMachine vm) {
         SystemVmInstanceResponse vmResponse = new SystemVmInstanceResponse();
-        vmResponse.setId(vm.getId());
+        vmResponse.setId(vm.getUuid());
         vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
         vmResponse.setName(vm.getHostName());
         if (vm.getHostId() != null) {
-            vmResponse.setHostId(vm.getHostId());
+            Host host = ApiDBUtils.findHostById(vm.getHostId());
+            if (host != null) {
+                vmResponse.setHostId(host.getUuid());
+            }
         }
         if (vm.getState() != null) {
             vmResponse.setState(vm.getState().toString());
@@ -2982,10 +3055,18 @@ public class ApiResponseHelper implements ResponseGenerator {
     public PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result) {
         PhysicalNetworkResponse response = new PhysicalNetworkResponse();
 
-        response.setZoneId(result.getDataCenterId());
+        DataCenter zone = ApiDBUtils.findZoneById(result.getDataCenterId());
+        if (zone != null) {
+            response.setZoneId(zone.getUuid());
+        }
         response.setNetworkSpeed(result.getSpeed());
         response.setVlan(result.getVnet());
-        response.setDomainId(result.getDomainId());
+        if (result.getDomainId() != null) {
+            Domain domain = ApiDBUtils.findDomainById(result.getDomainId());
+            if (domain != null) {
+                response.setDomainId(domain.getUuid());
+            }
+        }
         response.setId(result.getUuid());
         if (result.getBroadcastDomainRange() != null) {
             response.setBroadcastDomainRange(result.getBroadcastDomainRange().toString());
@@ -3057,8 +3138,14 @@ public class ApiResponseHelper implements ResponseGenerator {
         ProviderResponse response = new ProviderResponse();
         response.setId(result.getUuid());
         response.setName(result.getProviderName());
-        response.setPhysicalNetworkId(result.getPhysicalNetworkId());
-        response.setDestinationPhysicalNetworkId(result.getDestinationPhysicalNetworkId());
+        PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(result.getPhysicalNetworkId());
+        if (pnw != null) {
+            response.setPhysicalNetworkId(pnw.getUuid());
+        }
+        PhysicalNetwork dnw = ApiDBUtils.findPhysicalNetworkById(result.getDestinationPhysicalNetworkId());
+        if (dnw != null) {
+            response.setDestinationPhysicalNetworkId(dnw.getUuid());
+        }
         response.setState(result.getState().toString());
 
         // set enabled services
@@ -3102,13 +3189,15 @@ public class ApiResponseHelper implements ResponseGenerator {
             StickinessPolicy stickinessPolicy, LoadBalancer lb) {
         LBStickinessResponse spResponse = new LBStickinessResponse();
 
-        spResponse.setlbRuleId(lb.getId());
+        spResponse.setlbRuleId(lb.getUuid());
         Account accountTemp = ApiDBUtils.findAccountById(lb.getAccountId());
         if (accountTemp != null) {
             spResponse.setAccountName(accountTemp.getAccountName());
-            spResponse.setDomainId(accountTemp.getDomainId());
-            spResponse.setDomainName(ApiDBUtils.findDomainById(
-                    accountTemp.getDomainId()).getName());
+            Domain domain = ApiDBUtils.findDomainById(accountTemp.getDomainId());
+            if (domain != null) {
+                spResponse.setDomainId(domain.getUuid());
+                spResponse.setDomainName(domain.getName());
+            }
         }
 
         List<LBStickinessPolicyResponse> responses = new ArrayList<LBStickinessPolicyResponse>();
@@ -3129,13 +3218,15 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         if (lb == null)
             return spResponse;
-        spResponse.setlbRuleId(lb.getId());
+        spResponse.setlbRuleId(lb.getUuid());
         Account account = ApiDBUtils.findAccountById(lb.getAccountId());
         if (account != null) {
             spResponse.setAccountName(account.getAccountName());
-            spResponse.setDomainId(account.getDomainId());
-            spResponse.setDomainName(ApiDBUtils.findDomainById(
-                    account.getDomainId()).getName());
+            Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
+            if (domain != null) {
+                spResponse.setDomainId(domain.getUuid());
+                spResponse.setDomainName(domain.getName());
+            }
         }
 
         List<LBStickinessPolicyResponse> responses = new ArrayList<LBStickinessPolicyResponse>();
@@ -3293,16 +3384,25 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public PrivateGatewayResponse createPrivateGatewayResponse(PrivateGateway result) {
         PrivateGatewayResponse response = new PrivateGatewayResponse();
-        response.setId(result.getId());
+        response.setId(result.getUuid());
         response.setVlan(result.getVlanTag());
         response.setGateway(result.getGateway());
         response.setNetmask(result.getNetmask());
-        response.setVpcId(result.getVpcId());
-        response.setZoneId(result.getZoneId());
+        if (result.getVpcId() != null) {
+            Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
+            response.setVpcId(vpc.getUuid());
+        }
+
         DataCenter zone = ApiDBUtils.findZoneById(result.getZoneId());
-        response.setZoneName(zone.getName());
+        if (zone != null) {
+            response.setZoneId(zone.getUuid());
+            response.setZoneName(zone.getName());
+        }
         response.setAddress(result.getIp4Address());
-        response.setPhysicalNetworkId(result.getPhysicalNetworkId());
+        PhysicalNetwork pnet = ApiDBUtils.findPhysicalNetworkById(result.getPhysicalNetworkId());
+        if (pnet != null) {
+            response.setPhysicalNetworkId(pnet.getUuid());
+        }
 
         populateAccount(response, result.getAccountId());
         populateDomain(response, result.getDomainId());
@@ -3344,7 +3444,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         AutoScaleVmProfileResponse response = new AutoScaleVmProfileResponse();
         response.setId(profile.getUuid());
         if (profile.getZoneId() != null) {
-            DataCenterVO zone = ApiDBUtils.findZoneById(profile.getZoneId());
+            DataCenter zone = ApiDBUtils.findZoneById(profile.getZoneId());
             if (zone != null) {
                 response.setZoneId(zone.getUuid());
             }
@@ -3437,8 +3537,13 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public StaticRouteResponse createStaticRouteResponse(StaticRoute result) {
         StaticRouteResponse response = new StaticRouteResponse();
-        response.setId(result.getId());
-        response.setVpcId(result.getVpcId());
+        response.setId(result.getUuid());
+        if (result.getVpcId() != null) {
+            Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
+            if (vpc != null) {
+                response.setVpcId(vpc.getUuid());
+            }
+        }
         response.setCidr(result.getCidr());
 
         StaticRoute.State state = result.getState();
@@ -3466,9 +3571,12 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVpnGateway result) {
         Site2SiteVpnGatewayResponse response = new Site2SiteVpnGatewayResponse();
-        response.setId(result.getId());
+        response.setId(result.getUuid());
         response.setIp(ApiDBUtils.findIpAddressById(result.getAddrId()).getAddress().toString());
-        response.setVpcId(result.getVpcId());
+        Vpc vpc = ApiDBUtils.findVpcById(result.getVpcId());
+        if (vpc != null) {
+            response.setVpcId(result.getUuid());
+        }
         response.setRemoved(result.getRemoved());
         response.setObjectName("vpngateway");
 
@@ -3480,7 +3588,7 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public Site2SiteCustomerGatewayResponse createSite2SiteCustomerGatewayResponse(Site2SiteCustomerGateway result) {
         Site2SiteCustomerGatewayResponse response = new Site2SiteCustomerGatewayResponse();
-        response.setId(result.getId());
+        response.setId(result.getUuid());
         response.setName(result.getName());
         response.setGatewayIp(result.getGatewayIp());
         response.setGuestCidrList(result.getGuestCidrList());
@@ -3503,30 +3611,33 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public Site2SiteVpnConnectionResponse createSite2SiteVpnConnectionResponse(Site2SiteVpnConnection result) {
         Site2SiteVpnConnectionResponse response = new Site2SiteVpnConnectionResponse();
-        response.setId(result.getId());
+        response.setId(result.getUuid());
 
-        response.setVpnGatewayId(result.getVpnGatewayId());
         Long vpnGatewayId = result.getVpnGatewayId();
         if(vpnGatewayId != null) {
-            Site2SiteVpnGatewayVO vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);
-
-            long ipId = vpnGateway.getAddrId();
-            IPAddressVO ipObj = ApiDBUtils.findIpAddressById(ipId);
-            response.setIp(ipObj.getAddress().addr());
+            Site2SiteVpnGateway vpnGateway = ApiDBUtils.findVpnGatewayById(vpnGatewayId);
+            if (vpnGateway != null) {
+                response.setVpnGatewayId(vpnGateway.getUuid());
+                long ipId = vpnGateway.getAddrId();
+                IPAddressVO ipObj = ApiDBUtils.findIpAddressById(ipId);
+                response.setIp(ipObj.getAddress().addr());
+            }
         }
 
-        response.setCustomerGatewayId(result.getCustomerGatewayId());
         Long customerGatewayId = result.getCustomerGatewayId();
         if(customerGatewayId != null) {
-            Site2SiteCustomerGatewayVO customerGateway = ApiDBUtils.findCustomerGatewayById(customerGatewayId);
-            response.setGatewayIp(customerGateway.getGatewayIp());
-            response.setGuestCidrList(customerGateway.getGuestCidrList());
-            response.setIpsecPsk(customerGateway.getIpsecPsk());
-            response.setIkePolicy(customerGateway.getIkePolicy());
-            response.setEspPolicy(customerGateway.getEspPolicy());
+            Site2SiteCustomerGateway customerGateway = ApiDBUtils.findCustomerGatewayById(customerGatewayId);
+            if (customerGateway != null) {
+                response.setCustomerGatewayId(customerGateway.getUuid());
+                response.setGatewayIp(customerGateway.getGatewayIp());
+                response.setGuestCidrList(customerGateway.getGuestCidrList());
+                response.setIpsecPsk(customerGateway.getIpsecPsk());
+                response.setIkePolicy(customerGateway.getIkePolicy());
+                response.setEspPolicy(customerGateway.getEspPolicy());
                 response.setIkeLifetime(customerGateway.getIkeLifetime());
                 response.setEspLifetime(customerGateway.getEspLifetime());
                 response.setDpd(customerGateway.getDpd());
+            }
         }
 
         populateAccount(response, result.getAccountId());
@@ -3556,4 +3667,28 @@ public class ApiResponseHelper implements ResponseGenerator {
     }
 
 
+
+    @Override
+    public SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule snapshotSchedule) {
+        SnapshotScheduleResponse response = new SnapshotScheduleResponse();
+        response.setId(snapshotSchedule.getUuid());
+        if (snapshotSchedule.getVolumeId() != null) {
+            Volume vol = ApiDBUtils.findVolumeById(snapshotSchedule.getVolumeId());
+            if (vol != null) {
+                response.setVolumeId(vol.getUuid());
+            }
+        }
+        if (snapshotSchedule.getPolicyId() != null) {
+            SnapshotPolicy policy = ApiDBUtils.findSnapshotPolicyById(snapshotSchedule.getPolicyId());
+            if (policy != null) {
+                response.setSnapshotPolicyId(policy.getUuid());
+            }
+        }
+        response.setScheduled(snapshotSchedule.getScheduledTimestamp());
+
+        response.setObjectName("snapshot");
+        return response;
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/dc/HostPodVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dc/HostPodVO.java b/server/src/com/cloud/dc/HostPodVO.java
index 731b6b5..b9f3712 100644
--- a/server/src/com/cloud/dc/HostPodVO.java
+++ b/server/src/com/cloud/dc/HostPodVO.java
@@ -35,7 +35,7 @@ import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name = "host_pod_ref")
-public class HostPodVO implements Pod, Identity {
+public class HostPodVO implements Pod {
 	@Id
 	@GeneratedValue(strategy = GenerationType.IDENTITY)
 	long id;
@@ -45,7 +45,7 @@ public class HostPodVO implements Pod, Identity {
 
 	@Column(name = "data_center_id")
 	private long dataCenterId;
-	
+
 	@Column(name = "gateway")
 	private String gateway;
 
@@ -57,14 +57,14 @@ public class HostPodVO implements Pod, Identity {
 
 	@Column(name = "description")
 	private String description;
-	
+
     @Column(name="allocation_state")
     @Enumerated(value=EnumType.STRING)
     AllocationState allocationState;
 
 	@Column(name = "external_dhcp")
 	private Boolean externalDhcp;
-	
+
     @Column(name=GenericDao.REMOVED_COLUMN)
     private Date removed;
 
@@ -128,12 +128,12 @@ public class HostPodVO implements Pod, Identity {
 	public void setCidrSize(int cidrSize) {
 		this.cidrSize = cidrSize;
 	}
-	
+
 	@Override
     public String getGateway() {
 		return gateway;
 	}
-	
+
 	public void setGateway(String gateway) {
 		this.gateway = gateway;
 	}
@@ -145,33 +145,33 @@ public class HostPodVO implements Pod, Identity {
 	public void setDescription(String description) {
 		this.description = description;
 	}
-	
+
     public AllocationState getAllocationState() {
     	return allocationState;
     }
-    
+
     public void setAllocationState(AllocationState allocationState) {
 		this.allocationState = allocationState;
     }
-	
+
 	// Use for comparisons only.
 	public HostPodVO(Long id) {
 	    this.id = id;
 	}
-	
+
 	@Override
     public int hashCode() {
 	    return  NumbersUtil.hash(id);
 	}
-	
+
 	public boolean getExternalDhcp() {
 		return externalDhcp;
 	}
-	
+
 	public void setExternalDhcp(boolean use) {
 		externalDhcp = use;
 	}
-	
+
 	@Override
     public boolean equals(Object obj) {
 	    if (obj instanceof HostPodVO) {
@@ -180,16 +180,16 @@ public class HostPodVO implements Pod, Identity {
 	        return false;
 	    }
 	}
-	
+
     public Date getRemoved() {
         return removed;
     }
-    
+
     @Override
     public String getUuid() {
     	return this.uuid;
     }
-    
+
     public void setUuid(String uuid) {
     	this.uuid = uuid;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
index 292255b..553dc50 100644
--- a/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
@@ -5,7 +5,7 @@
 // to you under the Apache License, Version 2.0 (the
 // "License"); you may not use this file except in compliance
 // with the License.  You may obtain a copy of the License at
-// 
+//
 //   http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing,
@@ -162,10 +162,10 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
 
         PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), ntwkDevice.getNetworkServiceProvder());
         if (ntwkSvcProvider == null ) {
-            throw new CloudRuntimeException("Network Service Provider: " + ntwkDevice.getNetworkServiceProvder() + 
+            throw new CloudRuntimeException("Network Service Provider: " + ntwkDevice.getNetworkServiceProvder() +
                     " is not enabled in the physical network: " + physicalNetworkId + "to add this device" );
         } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
-            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + 
+            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() +
                     " is not added or in shutdown state in the physical network: " + physicalNetworkId + "to add this device" );
         }
 
@@ -210,7 +210,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
                 capacity = _defaultFwCapacity;
             }
 
-            ExternalFirewallDeviceVO fwDevice = new ExternalFirewallDeviceVO(externalFirewall.getId(), pNetwork.getId(), ntwkSvcProvider.getProviderName(), 
+            ExternalFirewallDeviceVO fwDevice = new ExternalFirewallDeviceVO(externalFirewall.getId(), pNetwork.getId(), ntwkSvcProvider.getProviderName(),
                     deviceName, capacity, dedicatedUse);
 
             _externalFirewallDeviceDao.persist(fwDevice);
@@ -261,7 +261,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
 
         PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), fwNetworkDevice.getNetworkServiceProvder());
         if (ntwkSvcProvider == null) {
-            return null; 
+            return null;
         }
 
         List<ExternalFirewallDeviceVO> fwDevices = _externalFirewallDeviceDao.listByPhysicalNetworkAndProvider(physicalNetworkId, ntwkSvcProvider.getProviderName());
@@ -270,7 +270,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         }
         return firewallHosts;
     }
- 
+
     public ExternalFirewallDeviceVO getExternalFirewallForNetwork(Network network) {
         NetworkExternalFirewallVO fwDeviceForNetwork = _networkExternalFirewallDao.findByNetworkId(network.getId());
         if (fwDeviceForNetwork != null) {
@@ -292,7 +292,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         long physicalNetworkId = network.getPhysicalNetworkId();
         List<ExternalFirewallDeviceVO> fwDevices = _externalFirewallDeviceDao.listByPhysicalNetwork(physicalNetworkId);
 
-        // loop through the firewall device in the physical network and pick the first-fit 
+        // loop through the firewall device in the physical network and pick the first-fit
         for (ExternalFirewallDeviceVO fwDevice: fwDevices) {
             // max number of guest networks that can be mapped to this device
             long fullCapacity = fwDevice.getCapacity();
@@ -301,7 +301,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
             }
 
             // get the list of guest networks that are mapped to this load balancer
-            List<NetworkExternalFirewallVO> mappedNetworks = _networkExternalFirewallDao.listByFirewallDeviceId(fwDevice.getId()); 
+            List<NetworkExternalFirewallVO> mappedNetworks = _networkExternalFirewallDao.listByFirewallDeviceId(fwDevice.getId());
 
             long usedCapacity = (mappedNetworks == null) ? 0 : mappedNetworks.size();
             if ((fullCapacity - usedCapacity) > 0) {
@@ -319,7 +319,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
     public ExternalFirewallResponse createExternalFirewallResponse(Host externalFirewall) {
         Map<String, String> fwDetails = _hostDetailDao.findDetails(externalFirewall.getId());
         ExternalFirewallResponse response = new ExternalFirewallResponse();
-        response.setId(externalFirewall.getId());
+        response.setId(externalFirewall.getUuid());
         response.setIpAddress(externalFirewall.getPrivateIpAddress());
         response.setUsername(fwDetails.get("username"));
         response.setPublicInterface(fwDetails.get("publicInterface"));
@@ -348,7 +348,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
             try {
                 if (deviceMapLock.lock(120)) {
                     try {
-                        ExternalFirewallDeviceVO device  = findSuitableFirewallForNetwork(network); 
+                        ExternalFirewallDeviceVO device  = findSuitableFirewallForNetwork(network);
                         long externalFirewallId = device.getId();
 
                         NetworkExternalFirewallVO networkFW = new NetworkExternalFirewallVO(network.getId(), externalFirewallId);
@@ -373,18 +373,18 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         }
 
         Account account = _accountDao.findByIdIncludingRemoved(network.getAccountId());
-        
-        NetworkOffering offering = _networkOfferingDao.findById(network.getNetworkOfferingId());      
+
+        NetworkOffering offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
         boolean sharedSourceNat = offering.getSharedSourceNat();
-        
+
         IPAddressVO sourceNatIp = null;
         if (!sharedSourceNat) {
-            // Get the source NAT IP address for this account          
-            List<IPAddressVO> sourceNatIps = _networkMgr.listPublicIpsAssignedToAccount(network.getAccountId(), 
+            // Get the source NAT IP address for this account
+            List<IPAddressVO> sourceNatIps = _networkMgr.listPublicIpsAssignedToAccount(network.getAccountId(),
                     zoneId, true);
 
             if (sourceNatIps.size() != 1) {
-                String errorMsg = "External firewall was unable to find the source NAT IP address for account " 
+                String errorMsg = "External firewall was unable to find the source NAT IP address for account "
             + account.getAccountName();
                 s_logger.error(errorMsg);
                 return true;
@@ -431,18 +431,18 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
             // Insert a new NIC for this guest network to reserve the gateway address
             savePlaceholderNic(network,  network.getGateway());
         }
-        
+
         // Delete any mappings used for inline external load balancers in this network
         List<NicVO> nicsInNetwork = _nicDao.listByNetworkId(network.getId());
         for (NicVO nic : nicsInNetwork) {
             InlineLoadBalancerNicMapVO mapping = _inlineLoadBalancerNicMapDao.findByNicId(nic.getId());
-            
+
             if (mapping != null) {
                 _nicDao.expunge(mapping.getNicId());
                 _inlineLoadBalancerNicMapDao.expunge(mapping.getId());
             }
         }
-        
+
         String action = add ? "implemented" : "shut down";
         s_logger.debug("External firewall has " + action + " the guest network for account " + account.getAccountName() + "(id = " + account.getAccountId() + ") with VLAN tag " + guestVlanTag);
 
@@ -527,26 +527,26 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         if (externalFirewall == null) {
             return false;
         }
-        
+
         // Create/delete VPN
         IpAddress ip = _networkMgr.getIp(vpn.getServerAddressId());
-        
+
         // Mask the IP range with the network's VLAN tag
         String[] ipRange = vpn.getIpRange().split("-");
         DataCenterVO zone = _dcDao.findById(network.getDataCenterId());
         int vlanTag = Integer.parseInt(network.getBroadcastUri().getHost());
         int offset = getVlanOffset(network.getPhysicalNetworkId(), vlanTag);
         int cidrSize = getGloballyConfiguredCidrSize();
-        
+
         for (int i = 0; i < 2; i++) {
             ipRange[i] = NetUtils.long2Ip((NetUtils.ip2Long(ipRange[i]) & 0xff000000) | (offset << (32 - cidrSize)));
         }
-        
+
         String maskedIpRange = ipRange[0] + "-" + ipRange[1];
-        
+
         RemoteAccessVpnCfgCommand createVpnCmd = new RemoteAccessVpnCfgCommand(create, ip.getAddress().addr(), vpn.getLocalIp(), maskedIpRange, vpn.getIpsecPresharedKey());
         createVpnCmd.setAccessDetail(NetworkElementCommand.ACCOUNT_ID, String.valueOf(network.getAccountId()));
-        createVpnCmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR, network.getCidr()); 
+        createVpnCmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR, network.getCidr());
         Answer answer = _agentMgr.easySend(externalFirewall.getId(), createVpnCmd);
         if (answer == null || !answer.getResult()) {
              String details = (answer != null) ? answer.getDetails() : "details unavailable";
@@ -554,12 +554,12 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
              s_logger.error(msg);
              throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId());
         }
-        
+
         // Add/delete users
         List<VpnUserVO> vpnUsers = _vpnUsersDao.listByAccount(vpn.getAccountId());
         return manageRemoteAccessVpnUsers(network, vpn, vpnUsers);
-    }  
-    
+    }
+
     public boolean manageRemoteAccessVpnUsers(Network network, RemoteAccessVpn vpn, List<? extends VpnUser> vpnUsers) throws ResourceUnavailableException {
         ExternalFirewallDeviceVO fwDeviceVO = getExternalFirewallForNetwork(network);
         HostVO externalFirewall = _hostDao.findById(fwDeviceVO.getHostId());
@@ -567,7 +567,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         if (externalFirewall == null) {
             return false;
         }
-        
+
         List<VpnUser> addUsers = new ArrayList<VpnUser>();
         List<VpnUser> removeUsers = new ArrayList<VpnUser>();
         for (VpnUser user : vpnUsers) {
@@ -578,11 +578,11 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
                 removeUsers.add(user);
             }
         }
-        
+
         VpnUsersCfgCommand addUsersCmd = new VpnUsersCfgCommand(addUsers, removeUsers);
         addUsersCmd.setAccessDetail(NetworkElementCommand.ACCOUNT_ID, String.valueOf(network.getAccountId()));
-        addUsersCmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR, network.getCidr());        
-        
+        addUsersCmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR, network.getCidr());
+
         Answer answer = _agentMgr.easySend(externalFirewall.getId(), addUsersCmd);
         if (answer == null || !answer.getResult()) {
              String details = (answer != null) ? answer.getDetails() : "details unavailable";
@@ -591,7 +591,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
              s_logger.error(msg);
              throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId());
         }
-        
+
         return true;
     }
 
@@ -608,7 +608,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         int lowestVlanTag = Integer.valueOf(vlanRange[0]);
         return vlanTag - lowestVlanTag;
     }
-    
+
     private NicVO savePlaceholderNic(Network network, String ipAddress) {
         NicVO nic = new NicVO(null, null, network.getId(), null);
         nic.setIp4Address(ipAddress);
@@ -616,7 +616,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
         nic.setState(State.Reserved);
         return _nicDao.persist(nic);
     }
-    
+
     public int getGloballyConfiguredCidrSize() {
         try {
             String globalVlanBits = _configDao.getValue(Config.GuestVlanBits.key());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
index dc4e42a..42cd694 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
@@ -5,7 +5,7 @@
 // to you under the Apache License, Version 2.0 (the
 // "License"); you may not use this file except in compliance
 // with the License.  You may obtain a copy of the License at
-// 
+//
 //   http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing,
@@ -339,7 +339,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
     public ExternalLoadBalancerResponse createExternalLoadBalancerResponse(Host externalLoadBalancer) {
         Map<String, String> lbDetails = _hostDetailDao.findDetails(externalLoadBalancer.getId());
         ExternalLoadBalancerResponse response = new ExternalLoadBalancerResponse();
-        response.setId(externalLoadBalancer.getId());
+        response.setId(externalLoadBalancer.getUuid());
         response.setIpAddress(externalLoadBalancer.getPrivateIpAddress());
         response.setUsername(lbDetails.get("username"));
         response.setPublicInterface(lbDetails.get("publicInterface"));

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
index 39f2cc8..38fc6f5 100755
--- a/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
@@ -103,17 +103,17 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
 
     ScheduledExecutorService _executor;
     int _externalNetworkStatsInterval;
-    private final static IdentityService _identityService = (IdentityService)ComponentLocator.getLocator(ManagementServer.Name).getManager(IdentityService.class); 
-    
+    private final static IdentityService _identityService = (IdentityService)ComponentLocator.getLocator(ManagementServer.Name).getManager(IdentityService.class);
+
     private static final org.apache.log4j.Logger s_logger = Logger.getLogger(ExternalNetworkDeviceManagerImpl.class);
     protected String _name;
-    
+
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         _name = name;
         return true;
     }
-    
+
     @Override
     public boolean start() {
         return true;
@@ -128,14 +128,14 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
     public String getName() {
         return _name;
     }
-    
+
     @Override
     public Host addNetworkDevice(AddNetworkDeviceCmd cmd) {
         Map paramList = cmd.getParamList();
         if (paramList == null) {
             throw new CloudRuntimeException("Parameter list is null");
         }
-    
+
         Collection paramsCollection = paramList.values();
         HashMap params = (HashMap) (paramsCollection.toArray())[0];
         if (cmd.getDeviceType().equalsIgnoreCase(NetworkDevice.ExternalDhcp.getName())) {
@@ -201,8 +201,8 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
         } else {
             throw new CloudRuntimeException("Unsupported network device type:" + host.getType());
         }
-        
-        response.setId(device.getId());
+
+        response.setId(device.getUuid());
         return response;
     }
 
@@ -219,18 +219,18 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
 //            List<HostVO> devs = _hostDao.listBy(type, zoneId);
 //            res.addAll(devs);
  //       }
-        
+
  //       return res;
         return null;
     }
-    
+
     @Override
     public List<Host> listNetworkDevice(ListNetworkDeviceCmd cmd) {
         Map paramList = cmd.getParamList();
         if (paramList == null) {
             throw new CloudRuntimeException("Parameter list is null");
         }
-        
+
         List<Host> res;
         Collection paramsCollection = paramList.values();
         HashMap params = (HashMap) (paramsCollection.toArray())[0];
@@ -245,7 +245,7 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
         } else if (cmd.getDeviceType() == null){
             Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
             Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
-            Long physicalNetworkId = (params.get(ApiConstants.PHYSICAL_NETWORK_ID)==null)?Long.parseLong((String)params.get(ApiConstants.PHYSICAL_NETWORK_ID)):null;            
+            Long physicalNetworkId = (params.get(ApiConstants.PHYSICAL_NETWORK_ID)==null)?Long.parseLong((String)params.get(ApiConstants.PHYSICAL_NETWORK_ID)):null;
             List<Host> res1 = listNetworkDevice(zoneId, physicalNetworkId, podId, Host.Type.PxeServer);
             List<Host> res2 = listNetworkDevice(zoneId, physicalNetworkId, podId, Host.Type.ExternalDhcp);
             List<Host> res3 = listNetworkDevice(zoneId, physicalNetworkId, podId, Host.Type.ExternalLoadBalancer);
@@ -259,7 +259,7 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
         } else {
             throw new CloudRuntimeException("Unknown network device type:" + cmd.getDeviceType());
         }
-        
+
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/network/vpc/StaticRouteVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/StaticRouteVO.java b/server/src/com/cloud/network/vpc/StaticRouteVO.java
index 099fb47..41c3570 100644
--- a/server/src/com/cloud/network/vpc/StaticRouteVO.java
+++ b/server/src/com/cloud/network/vpc/StaticRouteVO.java
@@ -34,41 +34,41 @@ import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name="static_routes")
-public class StaticRouteVO implements Identity, StaticRoute{
+public class StaticRouteVO implements StaticRoute{
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     @Column(name="id")
     long id;
-    
+
     @Column(name="uuid")
     String uuid;
-    
+
     @Column(name="vpc_gateway_id", updatable=false)
     long vpcGatewayId;
-    
+
     @Column(name="cidr")
     private String cidr;
-    
+
     @Enumerated(value=EnumType.STRING)
     @Column(name="state")
     State state;
-    
+
     @Column(name="vpc_id")
     private Long vpcId;
-    
+
     @Column(name = "account_id")
     long accountId;
 
     @Column(name = "domain_id")
     long domainId;
-    
+
     @Column(name=GenericDao.CREATED_COLUMN)
     Date created;
-    
+
     protected StaticRouteVO(){
         this.uuid = UUID.randomUUID().toString();
     }
-    
+
     /**
      * @param vpcGatewayId
      * @param cidr
@@ -86,7 +86,7 @@ public class StaticRouteVO implements Identity, StaticRoute{
         this.domainId = domainId;
         this.uuid = UUID.randomUUID().toString();
     }
-    
+
     @Override
     public long getVpcGatewayId() {
         return vpcGatewayId;
@@ -130,7 +130,7 @@ public class StaticRouteVO implements Identity, StaticRoute{
     public void setState(State state) {
         this.state = state;
     }
-    
+
     @Override
     public String toString() {
         StringBuilder buf = new StringBuilder("StaticRoute[");

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b75132a/server/src/com/cloud/offerings/NetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java
index f73c372..6cb1d2a 100755
--- a/server/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -5,7 +5,7 @@
 // to you under the Apache License, Version 2.0 (the
 // "License"); you may not use this file except in compliance
 // with the License.  You may obtain a copy of the License at
-// 
+//
 //   http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing,
@@ -36,7 +36,7 @@ import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name = "network_offerings")
-public class NetworkOfferingVO implements NetworkOffering, Identity {
+public class NetworkOfferingVO implements NetworkOffering {
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -301,7 +301,7 @@ public class NetworkOfferingVO implements NetworkOffering, Identity {
 
     /**
      * Network Offering for all system vms.
-     * 
+     *
      * @param name
      * @param trafficType
      * @param specifyIpRanges
@@ -311,9 +311,9 @@ public class NetworkOfferingVO implements NetworkOffering, Identity {
         this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges);
         this.state = State.Enabled;
     }
-    
+
     public NetworkOfferingVO(String name, Network.GuestType guestType) {
-        this(name, "System Offering for " + name, TrafficType.Guest, true, true, 0, 0, true, Availability.Optional, 
+        this(name, "System Offering for " + name, TrafficType.Guest, true, true, 0, 0, true, Availability.Optional,
                 null, Network.GuestType.Isolated, true, false);
         this.state = State.Enabled;
     }


Mime
View raw message