You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/01/17 23:40:47 UTC

[45/50] [abbrv] Merge branch 'master' into rbac.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/com/cloud/vm/VMInstanceVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/vm/VMInstanceVO.java
index 8122658,48229b8..9e771c7
--- a/engine/schema/src/com/cloud/vm/VMInstanceVO.java
+++ b/engine/schema/src/com/cloud/vm/VMInstanceVO.java
@@@ -74,140 -72,138 +74,138 @@@ public class VMInstanceVO implements Vi
       * the state machine needs to go through the DAO object because someone
       * else could be updating it as well.
       */
-     @Enumerated(value=EnumType.STRING)
-     @StateMachine(state=State.class, event=Event.class)
-     @Column(name="state", updatable=true, nullable=false, length=32)
+     @Enumerated(value = EnumType.STRING)
+     @StateMachine(state = State.class, event = Event.class)
+     @Column(name = "state", updatable = true, nullable = false, length = 32)
      protected State state = null;
  
-     @Column(name="private_ip_address", updatable=true)
+     @Column(name = "private_ip_address", updatable = true)
      protected String privateIpAddress;
  
-     @Column(name="instance_name", updatable=true, nullable=false)
+     @Column(name = "instance_name", updatable = true, nullable = false)
      protected String instanceName;
  
-     @Column(name="vm_template_id", updatable=true, nullable=true, length=17)
+     @Column(name = "vm_template_id", updatable = true, nullable = true, length = 17)
      protected Long templateId = new Long(-1);
  
-     @Column(name="guest_os_id", nullable=false, length=17)
+     @Column(name = "guest_os_id", nullable = false, length = 17)
      protected long guestOSId;
  
-     @Column(name="host_id", updatable=true, nullable=true)
+     @Column(name = "host_id", updatable = true, nullable = true)
      protected Long hostId;
  
-     @Column(name="last_host_id", updatable=true, nullable=true)
+     @Column(name = "last_host_id", updatable = true, nullable = true)
      protected Long lastHostId;
  
-     @Column(name="pod_id", updatable=true, nullable=false)
+     @Column(name = "pod_id", updatable = true, nullable = false)
      protected Long podIdToDeployIn;
  
-     @Column(name="private_mac_address", updatable=true, nullable=true)
+     @Column(name = "private_mac_address", updatable = true, nullable = true)
      protected String privateMacAddress;
  
-     @Column(name="data_center_id", updatable=true, nullable=false)
+     @Column(name = "data_center_id", updatable = true, nullable = false)
      protected long dataCenterId;
  
-     @Column(name="vm_type", updatable=false, nullable=false, length=32)
-     @Enumerated(value=EnumType.STRING)
+     @Column(name = "vm_type", updatable = false, nullable = false, length = 32)
+     @Enumerated(value = EnumType.STRING)
      protected Type type;
  
-     @Column(name="ha_enabled", updatable=true, nullable=true)
+     @Column(name = "ha_enabled", updatable = true, nullable = true)
      protected boolean haEnabled;
  
-     @Column(name="display_vm", updatable=true, nullable=false)
+     @Column(name = "display_vm", updatable = true, nullable = false)
      protected boolean displayVm = true;
  
-     @Column(name="limit_cpu_use", updatable=true, nullable=true)
+     @Column(name = "limit_cpu_use", updatable = true, nullable = true)
      private boolean limitCpuUse;
  
-     @Column(name="update_count", updatable = true, nullable=false)
-     protected long updated;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
+     @Column(name = "update_count", updatable = true, nullable = false)
 -    protected long updated;    // This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
++    protected long updated; // This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
  
-     @Column(name=GenericDao.CREATED_COLUMN)
+     @Column(name = GenericDao.CREATED_COLUMN)
      protected Date created;
  
-     @Column(name=GenericDao.REMOVED_COLUMN)
+     @Column(name = GenericDao.REMOVED_COLUMN)
      protected Date removed;
  
-     @Column(name="update_time", updatable=true)
-     @Temporal(value=TemporalType.TIMESTAMP)
+     @Column(name = "update_time", updatable = true)
+     @Temporal(value = TemporalType.TIMESTAMP)
      protected Date updateTime;
  
-     @Column(name="domain_id")
+     @Column(name = "domain_id")
      protected long domainId;
  
-     @Column(name="account_id")
+     @Column(name = "account_id")
      protected long accountId;
  
-     @Column(name="service_offering_id")
+     @Column(name = "service_offering_id")
      protected long serviceOfferingId;
  
-     @Column(name="reservation_id")
+     @Column(name = "reservation_id")
      protected String reservationId;
  
-     @Column(name="hypervisor_type")
-     @Enumerated(value=EnumType.STRING)
+     @Column(name = "hypervisor_type")
+     @Enumerated(value = EnumType.STRING)
      protected HypervisorType hypervisorType;
  
      @Column(name = "dynamically_scalable")
      protected boolean dynamicallyScalable;
  
- /*
+     /*
 -        @Column(name="tags")
 -        protected String tags;
 +    @Column(name="tags")
 +    protected String tags;
- */
+     */
  
      @Transient
      Map<String, String> details;
  
-     @Column(name="uuid")
+     @Column(name = "uuid")
      protected String uuid = UUID.randomUUID().toString();
  
-     @Column(name="disk_offering_id")
+     @Column(name = "disk_offering_id")
      protected Long diskOfferingId;
  
-     public VMInstanceVO(long id,
-             long serviceOfferingId,
-             String name,
-             String instanceName,
-             Type type,
-             Long vmTemplateId,
-             HypervisorType hypervisorType,
-             long guestOSId,
-             long domainId,
-             long accountId,
-             boolean haEnabled) {
+     //
+     // Power state for VM state sync
+     //
+     @Enumerated(value = EnumType.STRING)
+     @Column(name = "power_state", updatable = true)
+     protected PowerState powerState;
+ 
+     @Column(name = "power_state_update_time", updatable = true, nullable = false)
+     @Temporal(value = TemporalType.TIMESTAMP)
+     protected Date powerStateUpdateTime;
+ 
+     @Column(name = "power_state_update_count", updatable = true)
+     protected int powerStateUpdateCount;
+ 
+     @Column(name = "power_host", updatable = true)
+     protected Long powerHostId;
+ 
+     public VMInstanceVO(long id, long serviceOfferingId, String name, String instanceName, Type type, Long vmTemplateId, HypervisorType hypervisorType, long guestOSId,
+             long domainId, long accountId, boolean haEnabled) {
          this.id = id;
--        this.hostName = name != null ? name : this.uuid;
++        hostName = name != null ? name : uuid;
          if (vmTemplateId != null) {
--            this.templateId = vmTemplateId;
++            templateId = vmTemplateId;
          }
          this.instanceName = instanceName;
          this.type = type;
          this.guestOSId = guestOSId;
          this.haEnabled = haEnabled;
--        this.vncPassword = Long.toHexString(new Random().nextLong());
--        this.state = State.Stopped;
++        vncPassword = Long.toHexString(new Random().nextLong());
++        state = State.Stopped;
          this.accountId = accountId;
          this.domainId = domainId;
          this.serviceOfferingId = serviceOfferingId;
          this.hypervisorType = hypervisorType;
--        this.limitCpuUse = false;
-     }
- 
-     public VMInstanceVO(long id,
-             long serviceOfferingId,
-             String name,
-             String instanceName,
-             Type type,
-             Long vmTemplateId,
-             HypervisorType hypervisorType,
-             long guestOSId,
-             long domainId,
-             long accountId,
-             boolean haEnabled,
-             boolean limitResourceUse, Long diskOfferingId) {
++        limitCpuUse = false;
+     }
+ 
+     public VMInstanceVO(long id, long serviceOfferingId, String name, String instanceName, Type type, Long vmTemplateId, HypervisorType hypervisorType, long guestOSId,
+             long domainId, long accountId, boolean haEnabled, boolean limitResourceUse, Long diskOfferingId) {
          this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
--        this.limitCpuUse = limitResourceUse;
++        limitCpuUse = limitResourceUse;
          this.diskOfferingId = diskOfferingId;
      }
  
@@@ -323,11 -320,11 +322,11 @@@
      }
  
      public Date getProxyAssignTime() {
--        return this.proxyAssignTime;
++        return proxyAssignTime;
      }
  
      public void setProxyAssignTime(Date time) {
--        this.proxyAssignTime = time;
++        proxyAssignTime = time;
      }
  
      @Override
@@@ -411,7 -408,7 +410,7 @@@
      }
  
      public void setPodId(long podId) {
--        this.podIdToDeployIn = podId;
++        podIdToDeployIn = podId;
      }
  
      public void setPrivateMacAddress(String privateMacAddress) {
@@@ -435,7 -432,7 +434,7 @@@
      }
  
      public String getReservationId() {
--        return this.reservationId;
++        return reservationId;
      }
  
      @Override
@@@ -500,12 -496,39 +498,44 @@@
      }
  
      public Boolean isDynamicallyScalable() {
--        return this.dynamicallyScalable;
++        return dynamicallyScalable;
 +    }
 +
 +    @Override
 +    public AclEntityType getEntityType() {
 +        return AclEntityType.VirtualMachine;
      }
  
+     public VirtualMachine.PowerState getPowerState() {
+         return powerState;
+     }
+ 
+     public void setPowerState(PowerState powerState) {
+         this.powerState = powerState;
+     }
+ 
+     public Date getPowerStateUpdateTime() {
+         return powerStateUpdateTime;
+     }
+ 
+     public void setPowerStateUpdateTime(Date updateTime) {
+         powerStateUpdateTime = updateTime;
+     }
+ 
+     public int getPowerStateUpdateCount() {
+         return powerStateUpdateCount;
+     }
+ 
+     public void setPowerStateUpdateCount(int count) {
+         powerStateUpdateCount = count;
+     }
+ 
+     public Long getPowerHostId() {
+         return powerHostId;
+     }
+ 
+     public void setPowerHostId(Long hostId) {
+         powerHostId = hostId;
+     }
+ 
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java
index b3efd17,37aa0e3..91cd5a8
--- a/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java
@@@ -29,31 -28,29 +28,31 @@@ import javax.persistence.GenerationType
  import javax.persistence.Id;
  import javax.persistence.Table;
  
 +import org.apache.cloudstack.acl.AclEntityType;
 +
- import java.util.Date;
- import java.util.UUID;
+ import com.cloud.utils.db.GenericDao;
+ import com.cloud.utils.net.NetUtils;
+ import com.cloud.vm.NicIpAlias;
  
  @Entity
  @Table(name = "nic_ip_alias")
 -public class NicIpAliasVO implements NicIpAlias {
 +public class NicIpAliasVO implements NicIpAlias  {
  
-     public NicIpAliasVO(Long nicId, String ipaddr, Long vmId,
-                         Long accountId, Long domainId, Long networkId, String gateway, String netmask) {
+     public NicIpAliasVO(Long nicId, String ipaddr, Long vmId, Long accountId, Long domainId, Long networkId, String gateway, String netmask) {
          this.nicId = nicId;
          this.vmId = vmId;
--        this.ip4Address = ipaddr;
++        ip4Address = ipaddr;
          this.accountId = accountId;
          this.domainId = domainId;
          this.networkId = networkId;
-         this.netmask =netmask;
+         this.netmask = netmask;
          this.gateway = gateway;
--        this.state = NicIpAlias.state.active;
++        state = NicIpAlias.state.active;
          String cidr = NetUtils.getCidrFromGatewayAndNetmask(gateway, netmask);
          String[] cidrPair = cidr.split("\\/");
          String cidrAddress = cidrPair[0];
          long cidrSize = Long.parseLong(cidrPair[1]);
--        this.startIpOfSubnet = NetUtils.getIpRangeStartIpFromCidr(cidrAddress, cidrSize);
++        startIpOfSubnet = NetUtils.getIpRangeStartIpFromCidr(cidrAddress, cidrSize);
      }
  
      protected NicIpAliasVO() {
@@@ -195,19 -199,21 +201,21 @@@
      }
  
      public void setAliasCount(long count) {
--        this.aliasCount = count;
++        aliasCount = count;
      }
  
-     public void setNetmask(String netmask){
+     public void setNetmask(String netmask) {
          this.netmask = netmask;
      }
  
+     @Override
 -    public String getNetmask() {
 +    public  String getNetmask() {
          return netmask;
      }
  
+     @Override
 -    public String getGateway() {
 -        return gateway;
 +    public  String getGateway() {
 +        return  gateway;
      }
  
      public void setGateway(String gateway) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java
index b3ce95a,142de8a..3510642
--- a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java
@@@ -35,11 -33,10 +35,10 @@@ import com.cloud.vm.NicSecondaryIp
  @Table(name = "nic_secondary_ips")
  public class NicSecondaryIpVO implements NicSecondaryIp {
  
-     public NicSecondaryIpVO(Long nicId, String ipaddr, Long vmId,
-             Long accountId, Long domainId, Long networkId) {
+     public NicSecondaryIpVO(long nicId, String ipaddr, long vmId, long accountId, long domainId, long networkId) {
          this.nicId = nicId;
          this.vmId = vmId;
--        this.ip4Address = ipaddr;
++        ip4Address = ipaddr;
          this.accountId = accountId;
          this.domainId = domainId;
          this.networkId = networkId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/vm/snapshot/VMSnapshotVO.java
index 056355a,79fd274..5254e38
--- a/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotVO.java
+++ b/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotVO.java
@@@ -128,10 -133,10 +134,10 @@@ public class VMSnapshotVO implements VM
          this.accountId = accountId;
          this.domainId = domainId;
          this.vmId = vmId;
--        this.state = State.Allocated;
++        state = State.Allocated;
          this.description = description;
--        this.name = vmSnapshotName;
--        this.displayName = vsDisplayName;
++        name = vmSnapshotName;
++        displayName = vsDisplayName;
          this.type = type;
          this.current = current;
      }
@@@ -220,7 -227,7 +228,7 @@@
  
      @Override
      public void incrUpdatedCount() {
--        this.updatedCount++;
++        updatedCount++;
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java
index 879d98a,86a2e6a..7630a01
--- a/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java
+++ b/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java
@@@ -27,8 -27,7 +27,8 @@@ import javax.persistence.GenerationType
  import javax.persistence.Id;
  import javax.persistence.Table;
  
- import org.apache.cloudstack.acl.ControlledEntity;
 +import org.apache.cloudstack.acl.AclEntityType;
+ import org.apache.cloudstack.acl.ControlledEntity;
  
  @Entity
  @Table(name = ("affinity_group"))
@@@ -61,7 -60,7 +61,7 @@@ public class AffinityGroupVO implement
      ControlledEntity.ACLType aclType;
  
      public AffinityGroupVO() {
-     	this.uuid = UUID.randomUUID().toString();
 -        this.uuid = UUID.randomUUID().toString();
++        uuid = UUID.randomUUID().toString();
      }
  
      public AffinityGroupVO(String name, String type, String description, long domainId, long accountId, ACLType aclType) {
@@@ -69,7 -68,7 +69,7 @@@
          this.description = description;
          this.domainId = domainId;
          this.accountId = accountId;
-     	this.uuid = UUID.randomUUID().toString();
 -        this.uuid = UUID.randomUUID().toString();
++        uuid = UUID.randomUUID().toString();
          this.type = type;
          this.aclType = aclType;
      }
@@@ -101,7 -100,7 +101,7 @@@
  
      @Override
      public String getUuid() {
-     	return this.uuid;
 -        return this.uuid;
++        return uuid;
      }
  
      public void setUuid(String uuid) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
index e9b455b,19d608b..16d98d5
--- a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
@@@ -187,55 -176,33 +178,33 @@@ public class VMEntityVO implements Virt
      @Transient
      private VMReservationVO vmReservation;
  
- 
-     public VMEntityVO(long id,
-             long serviceOfferingId,
-             String name,
-             String instanceName,
-             Type type,
-             Long vmTemplateId,
-             HypervisorType hypervisorType,
-             long guestOSId,
-             long domainId,
-             long accountId,
-             boolean haEnabled, Long diskOfferingId) {
+     public VMEntityVO(long id, long serviceOfferingId, String name, String instanceName, Type type, Long vmTemplateId, HypervisorType hypervisorType, long guestOSId,
+             long domainId, long accountId, boolean haEnabled, Long diskOfferingId) {
          this.id = id;
--        this.hostName = name != null ? name : this.uuid;
++        hostName = name != null ? name : uuid;
          if (vmTemplateId != null) {
--            this.templateId = vmTemplateId;
++            templateId = vmTemplateId;
          }
          this.instanceName = instanceName;
          this.type = type;
          this.guestOSId = guestOSId;
          this.haEnabled = haEnabled;
--        this.vncPassword = Long.toHexString(new Random().nextLong());
--        this.state = State.Stopped;
++        vncPassword = Long.toHexString(new Random().nextLong());
++        state = State.Stopped;
          this.accountId = accountId;
          this.domainId = domainId;
          this.serviceOfferingId = serviceOfferingId;
          this.hypervisorType = hypervisorType;
--        this.limitCpuUse = false;
++        limitCpuUse = false;
          this.diskOfferingId = diskOfferingId;
      }
  
-     public VMEntityVO(long id,
-             long serviceOfferingId,
-             String name,
-             String instanceName,
-             Type type,
-             Long vmTemplateId,
-             HypervisorType hypervisorType,
-             long guestOSId,
-             long domainId,
-             long accountId,
-             boolean haEnabled,
-             boolean limitResourceUse) {
+     public VMEntityVO(long id, long serviceOfferingId, String name, String instanceName, Type type, Long vmTemplateId, HypervisorType hypervisorType, long guestOSId,
+             long domainId, long accountId, boolean haEnabled, boolean limitResourceUse) {
          this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled, null);
--        this.limitCpuUse = limitResourceUse;
++        limitCpuUse = limitResourceUse;
      }
  
- 
- 
      protected VMEntityVO() {
      }
  
@@@ -348,11 -316,11 +318,11 @@@
      }
  
      public Date getProxyAssignTime() {
--        return this.proxyAssignTime;
++        return proxyAssignTime;
      }
  
      public void setProxyAssignTime(Date time) {
--        this.proxyAssignTime = time;
++        proxyAssignTime = time;
      }
  
      @Override
@@@ -428,7 -396,7 +398,7 @@@
      }
  
      public void setPodId(long podId) {
--        this.podIdToDeployIn = podId;
++        podIdToDeployIn = podId;
      }
  
      public void setPrivateMacAddress(String privateMacAddress) {
@@@ -436,7 -404,7 +406,7 @@@
      }
  
      public void setDataCenterId(long dataCenterId) {
--        this.dataCenterIdToDeployIn = dataCenterId;
++        dataCenterIdToDeployIn = dataCenterId;
      }
  
      public boolean isRemoved() {
@@@ -452,7 -420,7 +422,7 @@@
      }
  
      public String getReservationId() {
--        return this.reservationId;
++        return reservationId;
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/schema/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancerRuleVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancerRuleVO.java
index b583192,b7b720d..326fb31
--- a/engine/schema/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancerRuleVO.java
+++ b/engine/schema/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancerRuleVO.java
@@@ -17,16 -17,21 +17,23 @@@
  
  package org.apache.cloudstack.region.gslb;
  
- import com.cloud.region.ha.GlobalLoadBalancerRule;
+ import java.util.UUID;
  
- import javax.persistence.*;
+ import javax.persistence.Column;
+ import javax.persistence.Entity;
+ import javax.persistence.EnumType;
+ import javax.persistence.Enumerated;
+ import javax.persistence.GeneratedValue;
+ import javax.persistence.GenerationType;
+ import javax.persistence.Id;
+ import javax.persistence.Table;
  
 +import org.apache.cloudstack.acl.AclEntityType;
 +
- import java.util.UUID;
+ import com.cloud.region.ha.GlobalLoadBalancerRule;
  
  @Entity
- @Table(name=("global_load_balancing_rules"))
+ @Table(name = ("global_load_balancing_rules"))
  public class GlobalLoadBalancerRuleVO implements GlobalLoadBalancerRule {
  
      @Id
@@@ -69,22 -74,21 +76,21 @@@
      GlobalLoadBalancerRule.State state;
  
      public GlobalLoadBalancerRuleVO() {
--        this.uuid = UUID.randomUUID().toString();
++        uuid = UUID.randomUUID().toString();
      }
  
-     public GlobalLoadBalancerRuleVO(String name, String description, String gslbDomain, String algorithm,
-                                     String persistence, String serviceType, int regionId, long accountId,
-                                     long domainId, State state) {
-         this.name =name;
+     public GlobalLoadBalancerRuleVO(String name, String description, String gslbDomain, String algorithm, String persistence, String serviceType, int regionId,
+             long accountId, long domainId, State state) {
+         this.name = name;
          this.description = description;
--        this.region = regionId;
++        region = regionId;
          this.algorithm = algorithm;
          this.gslbDomain = gslbDomain;
          this.persistence = persistence;
          this.accountId = accountId;
          this.domainId = domainId;
          this.serviceType = serviceType;
--        this.uuid = UUID.randomUUID().toString();
++        uuid = UUID.randomUUID().toString();
          this.state = state;
      }
  
@@@ -159,7 -163,7 +165,7 @@@
  
      @Override
      public String getUuid() {
--        return this.uuid;
++        return uuid;
      }
  
      public void setUuid(String uuid) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --cc engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index 00206a9,9cac20d..87bb44d
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@@ -22,8 -22,8 +22,9 @@@ import java.util.Date
  
  import javax.inject.Inject;
  
+ import org.apache.log4j.Logger;
+ 
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
  import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
  import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --cc engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index d4d170e,fd0f2c1..eb08b3d
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@@ -20,10 -20,11 +20,9 @@@ import java.util.Date
  
  import javax.inject.Inject;
  
- import com.cloud.storage.DiskOfferingVO;
- import com.cloud.storage.dao.DiskOfferingDao;
+ import org.apache.log4j.Logger;
  
 -import com.cloud.storage.DiskOfferingVO;
 -import com.cloud.storage.dao.DiskOfferingDao;
 -import com.cloud.vm.VirtualMachine;
 +import org.apache.cloudstack.acl.AclEntityType;
  import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
  import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
  import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
@@@ -41,10 -41,11 +39,13 @@@ import com.cloud.agent.api.storage.Down
  import com.cloud.agent.api.to.DataObjectType;
  import com.cloud.agent.api.to.DataTO;
  import com.cloud.hypervisor.Hypervisor.HypervisorType;
+ import com.cloud.offering.DiskOffering.DiskCacheMode;
  import com.cloud.storage.DataStoreRole;
++import com.cloud.storage.DiskOfferingVO;
  import com.cloud.storage.Storage.ImageFormat;
  import com.cloud.storage.Volume;
  import com.cloud.storage.VolumeVO;
++import com.cloud.storage.dao.DiskOfferingDao;
  import com.cloud.storage.dao.VolumeDao;
  import com.cloud.utils.component.ComponentContext;
  import com.cloud.utils.exception.CloudRuntimeException;
@@@ -52,6 -53,6 +53,7 @@@ import com.cloud.utils.fsm.NoTransition
  import com.cloud.utils.fsm.StateMachine2;
  import com.cloud.utils.storage.encoding.EncodingType;
  import com.cloud.vm.VMInstanceVO;
++import com.cloud.vm.VirtualMachine;
  import com.cloud.vm.dao.VMInstanceDao;
  
  public class VolumeObject implements VolumeInfo {
@@@ -88,7 -89,7 +90,7 @@@
  
      @Override
      public String getAttachedVmName() {
--        Long vmId = this.volumeVO.getInstanceId();
++        Long vmId = volumeVO.getInstanceId();
          if (vmId != null) {
              VMInstanceVO vm = vmInstanceDao.findById(vmId);
  
@@@ -101,6 -102,15 +103,15 @@@
      }
  
      @Override
+     public VirtualMachine getAttachedVM() {
 -        Long vmId = this.volumeVO.getInstanceId();
++        Long vmId = volumeVO.getInstanceId();
+         if (vmId != null) {
+             VMInstanceVO vm = vmInstanceDao.findById(vmId);
+             return vm;
+         }
+         return null;
+     }
+     @Override
      public String getUuid() {
          return volumeVO.getUuid();
      }
@@@ -155,7 -174,7 +175,7 @@@
              result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao);
              volumeVO = volumeDao.findById(volumeVO.getId());
          } catch (NoTransitionException e) {
--            String errorMessage = "Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString();
++            String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString();
              s_logger.debug(errorMessage);
              throw new CloudRuntimeException(errorMessage);
          }
@@@ -213,28 -241,25 +242,25 @@@
  
      @Override
      public long getId() {
--        return this.volumeVO.getId();
++        return volumeVO.getId();
      }
  
      @Override
      public boolean isAttachedVM() {
--        return (this.volumeVO.getInstanceId() == null) ? false : true;
++        return (volumeVO.getInstanceId() == null) ? false : true;
      }
  
      @Override
      public String getUri() {
--        if (this.dataStore == null) {
++        if (dataStore == null) {
              throw new CloudRuntimeException("datastore must be set before using this object");
          }
-         DataObjectInStore obj = objectInStoreMgr.findObject(this.volumeVO.getId(), DataObjectType.VOLUME,
-                 this.dataStore.getId(), this.dataStore.getRole());
 -        DataObjectInStore obj = objectInStoreMgr.findObject(this.volumeVO.getId(), DataObjectType.VOLUME, this.dataStore.getId(), this.dataStore.getRole());
++        DataObjectInStore obj = objectInStoreMgr.findObject(volumeVO.getId(), DataObjectType.VOLUME, dataStore.getId(), dataStore.getRole());
          if (obj.getState() != ObjectInDataStoreStateMachine.State.Ready) {
-             return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
-                     + EncodingType.SIZE + "=" + this.volumeVO.getSize() + "&" + EncodingType.NAME + "="
-                     + this.volumeVO.getName();
 -            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&" + EncodingType.SIZE + "=" + this.volumeVO.getSize() + "&" +
 -                EncodingType.NAME + "=" + this.volumeVO.getName();
++            return dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&" + EncodingType.SIZE + "=" + volumeVO.getSize() + "&" +
++                EncodingType.NAME + "=" + volumeVO.getName();
          } else {
-             return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
-                     + EncodingType.PATH + "=" + obj.getInstallPath();
 -            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&" + EncodingType.PATH + "=" + obj.getInstallPath();
++            return dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&" + EncodingType.PATH + "=" + obj.getInstallPath();
          }
      }
  
@@@ -245,19 -270,19 +271,19 @@@
  
      @Override
      public void processEvent(ObjectInDataStoreStateMachine.Event event) {
--        if (this.dataStore == null) {
++        if (dataStore == null) {
              return;
          }
          try {
              Volume.Event volEvent = null;
--            if (this.dataStore.getRole() == DataStoreRole.ImageCache) {
++            if (dataStore.getRole() == DataStoreRole.ImageCache) {
                  objectInStoreMgr.update(this, event);
                  return;
              }
--            if (this.dataStore.getRole() == DataStoreRole.Image) {
++            if (dataStore.getRole() == DataStoreRole.Image) {
                  objectInStoreMgr.update(this, event);
-                 if (this.volumeVO.getState() == Volume.State.Migrating || this.volumeVO.getState() == Volume.State.Copying || this.volumeVO.getState() == Volume.State.Uploaded
-                         || this.volumeVO.getState() == Volume.State.Expunged) {
 -                if (this.volumeVO.getState() == Volume.State.Migrating || this.volumeVO.getState() == Volume.State.Copying ||
 -                    this.volumeVO.getState() == Volume.State.Uploaded || this.volumeVO.getState() == Volume.State.Expunged) {
++                if (volumeVO.getState() == Volume.State.Migrating || volumeVO.getState() == Volume.State.Copying ||
++                    volumeVO.getState() == Volume.State.Uploaded || volumeVO.getState() == Volume.State.Expunged) {
                      return;
                  }
                  if (event == ObjectInDataStoreStateMachine.Event.CreateOnlyRequested) {
@@@ -287,14 -311,14 +312,14 @@@
              } else if (event == ObjectInDataStoreStateMachine.Event.ResizeRequested) {
                  volEvent = Volume.Event.ResizeRequested;
              }
--            this.stateTransit(volEvent);
++            stateTransit(volEvent);
          } catch (Exception e) {
              s_logger.debug("Failed to update state", e);
              throw new CloudRuntimeException("Failed to update state:" + e.toString());
          } finally {
              // in case of OperationFailed, expunge the entry
-             if (event == ObjectInDataStoreStateMachine.Event.OperationFailed
-                     && (this.volumeVO.getState() != Volume.State.Copying && this.volumeVO.getState() != Volume.State.Uploaded)) {
+             if (event == ObjectInDataStoreStateMachine.Event.OperationFailed &&
 -                (this.volumeVO.getState() != Volume.State.Copying && this.volumeVO.getState() != Volume.State.Uploaded)) {
++                (volumeVO.getState() != Volume.State.Copying && volumeVO.getState() != Volume.State.Uploaded)) {
                  objectInStoreMgr.deleteIfNotReady(this);
              }
          }
@@@ -318,25 -342,25 +343,25 @@@
  
      @Override
      public String getName() {
--        return this.volumeVO.getName();
++        return volumeVO.getName();
      }
  
      @Override
      public Long getInstanceId() {
--        return this.volumeVO.getInstanceId();
++        return volumeVO.getInstanceId();
      }
  
      @Override
      public String getFolder() {
--        return this.volumeVO.getFolder();
++        return volumeVO.getFolder();
      }
  
      @Override
      public String getPath() {
--        if (this.dataStore.getRole() == DataStoreRole.Primary) {
--            return this.volumeVO.getPath();
++        if (dataStore.getRole() == DataStoreRole.Primary) {
++            return volumeVO.getPath();
          } else {
--            DataObjectInStore objInStore = this.objectInStoreMgr.findObject(this, dataStore);
++            DataObjectInStore objInStore = objectInStoreMgr.findObject(this, dataStore);
              if (objInStore != null) {
                  return objInStore.getInstallPath();
              } else {
@@@ -347,121 -371,121 +372,121 @@@
  
      @Override
      public Long getPodId() {
--        return this.volumeVO.getPodId();
++        return volumeVO.getPodId();
      }
  
      @Override
      public long getDataCenterId() {
--        return this.volumeVO.getDataCenterId();
++        return volumeVO.getDataCenterId();
      }
  
      @Override
      public Type getVolumeType() {
--        return this.volumeVO.getVolumeType();
++        return volumeVO.getVolumeType();
      }
  
      @Override
      public Long getPoolId() {
--        return this.volumeVO.getPoolId();
++        return volumeVO.getPoolId();
      }
  
      @Override
      public Date getAttached() {
--        return this.volumeVO.getAttached();
++        return volumeVO.getAttached();
      }
  
      @Override
      public Long getDeviceId() {
--        return this.volumeVO.getDeviceId();
++        return volumeVO.getDeviceId();
      }
  
      @Override
      public Date getCreated() {
--        return this.volumeVO.getCreated();
++        return volumeVO.getCreated();
      }
  
      @Override
      public Long getDiskOfferingId() {
--        return this.volumeVO.getDiskOfferingId();
++        return volumeVO.getDiskOfferingId();
      }
  
      @Override
      public String getChainInfo() {
--        return this.volumeVO.getChainInfo();
++        return volumeVO.getChainInfo();
      }
  
      @Override
      public boolean isRecreatable() {
--        return this.volumeVO.isRecreatable();
++        return volumeVO.isRecreatable();
      }
  
      @Override
      public long getUpdatedCount() {
--        return this.volumeVO.getUpdatedCount();
++        return volumeVO.getUpdatedCount();
      }
  
      @Override
      public void incrUpdatedCount() {
--        this.volumeVO.incrUpdatedCount();
++        volumeVO.incrUpdatedCount();
      }
  
      @Override
      public Date getUpdated() {
--        return this.volumeVO.getUpdated();
++        return volumeVO.getUpdated();
      }
  
      @Override
      public String getReservationId() {
--        return this.volumeVO.getReservationId();
++        return volumeVO.getReservationId();
      }
  
      @Override
      public void setReservationId(String reserv) {
--        this.volumeVO.setReservationId(reserv);
++        volumeVO.setReservationId(reserv);
      }
  
      @Override
      public long getAccountId() {
--        return this.volumeVO.getAccountId();
++        return volumeVO.getAccountId();
      }
  
      @Override
      public long getDomainId() {
--        return this.volumeVO.getDomainId();
++        return volumeVO.getDomainId();
      }
  
      @Override
      public Long getTemplateId() {
--        return this.volumeVO.getTemplateId();
++        return volumeVO.getTemplateId();
      }
  
      @Override
      public void addPayload(Object data) {
--        this.payload = data;
++        payload = data;
      }
  
      @Override
      public Object getpayload() {
--        return this.payload;
++        return payload;
      }
  
      public VolumeVO getVolume() {
--        return this.volumeVO;
++        return volumeVO;
      }
  
      @Override
      public HypervisorType getHypervisorType() {
--        return this.volumeDao.getHypervisorType(this.volumeVO.getId());
++        return volumeDao.getHypervisorType(volumeVO.getId());
      }
  
      @Override
      public Long getLastPoolId() {
--        return this.volumeVO.getLastPoolId();
++        return volumeVO.getLastPoolId();
      }
  
      @Override
      public DataTO getTO() {
--        DataTO to = this.getDataStore().getDriver().getTO(this);
++        DataTO to = getDataStore().getDriver().getTO(this);
          if (to == null) {
              to = new VolumeObjectTO(this);
          }
@@@ -471,11 -495,11 +496,11 @@@
      @Override
      public void processEvent(ObjectInDataStoreStateMachine.Event event, Answer answer) {
          try {
--            if (this.dataStore.getRole() == DataStoreRole.Primary) {
++            if (dataStore.getRole() == DataStoreRole.Primary) {
                  if (answer instanceof CopyCmdAnswer) {
-                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer) answer;
-                     VolumeVO vol = this.volumeDao.findById(this.getId());
-                     VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
+                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer)answer;
 -                    VolumeVO vol = this.volumeDao.findById(this.getId());
++                    VolumeVO vol = volumeDao.findById(getId());
+                     VolumeObjectTO newVol = (VolumeObjectTO)cpyAnswer.getNewData();
                      vol.setPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          vol.setSize(newVol.getSize());
@@@ -483,17 -507,17 +508,17 @@@
                      if (newVol.getFormat() != null) {
                          vol.setFormat(newVol.getFormat());
                      }
--                    vol.setPoolId(this.getDataStore().getId());
++                    vol.setPoolId(getDataStore().getId());
                      volumeDao.update(vol.getId(), vol);
                  } else if (answer instanceof CreateObjectAnswer) {
-                     CreateObjectAnswer createAnswer = (CreateObjectAnswer) answer;
-                     VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
-                     VolumeVO vol = this.volumeDao.findById(this.getId());
+                     CreateObjectAnswer createAnswer = (CreateObjectAnswer)answer;
+                     VolumeObjectTO newVol = (VolumeObjectTO)createAnswer.getData();
 -                    VolumeVO vol = this.volumeDao.findById(this.getId());
++                    VolumeVO vol = volumeDao.findById(getId());
                      vol.setPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          vol.setSize(newVol.getSize());
                      }
--                    vol.setPoolId(this.getDataStore().getId());
++                    vol.setPoolId(getDataStore().getId());
                      if (newVol.getFormat() != null) {
                          vol.setFormat(newVol.getFormat());
                      }
@@@ -502,22 -526,20 +527,20 @@@
              } else {
                  // image store or imageCache store
                  if (answer instanceof DownloadAnswer) {
-                     DownloadAnswer dwdAnswer = (DownloadAnswer) answer;
-                     VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(),
-                             this.getId());
+                     DownloadAnswer dwdAnswer = (DownloadAnswer)answer;
 -                    VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++                    VolumeDataStoreVO volStore = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
                      volStore.setInstallPath(dwdAnswer.getInstallPath());
                      volStore.setChecksum(dwdAnswer.getCheckSum());
--                    this.volumeStoreDao.update(volStore.getId(), volStore);
++                    volumeStoreDao.update(volStore.getId(), volStore);
                  } else if (answer instanceof CopyCmdAnswer) {
-                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer) answer;
-                     VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(),
-                             this.getId());
-                     VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
+                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer)answer;
 -                    VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++                    VolumeDataStoreVO volStore = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
+                     VolumeObjectTO newVol = (VolumeObjectTO)cpyAnswer.getNewData();
                      volStore.setInstallPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          volStore.setSize(newVol.getSize());
                      }
--                    this.volumeStoreDao.update(volStore.getId(), volStore);
++                    volumeStoreDao.update(volStore.getId(), volStore);
                  }
              }
          } catch (RuntimeException ex) {
@@@ -532,12 -554,12 +555,12 @@@
  
      @Override
      public void incRefCount() {
--        if (this.dataStore == null) {
++        if (dataStore == null) {
              return;
          }
  
--        if (this.dataStore.getRole() == DataStoreRole.Image || this.dataStore.getRole() == DataStoreRole.ImageCache) {
--            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++        if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) {
++            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
              store.incrRefCnt();
              store.setLastUpdated(new Date());
              volumeStoreDao.update(store.getId(), store);
@@@ -546,11 -568,11 +569,11 @@@
  
      @Override
      public void decRefCount() {
--        if (this.dataStore == null) {
++        if (dataStore == null) {
              return;
          }
--        if (this.dataStore.getRole() == DataStoreRole.Image || this.dataStore.getRole() == DataStoreRole.ImageCache) {
--            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++        if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) {
++            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
              store.decrRefCnt();
              store.setLastUpdated(new Date());
              volumeStoreDao.update(store.getId(), store);
@@@ -559,11 -581,11 +582,11 @@@
  
      @Override
      public Long getRefCount() {
--        if (this.dataStore == null) {
++        if (dataStore == null) {
              return null;
          }
--        if (this.dataStore.getRole() == DataStoreRole.Image || this.dataStore.getRole() == DataStoreRole.ImageCache) {
--            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++        if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) {
++            VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
              return store.getRefCnt();
          }
          return null;
@@@ -572,47 -594,45 +595,45 @@@
      @Override
      public void processEventOnly(ObjectInDataStoreStateMachine.Event event, Answer answer) {
          try {
--            if (this.dataStore.getRole() == DataStoreRole.Primary) {
++            if (dataStore.getRole() == DataStoreRole.Primary) {
                  if (answer instanceof CopyCmdAnswer) {
-                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer) answer;
-                     VolumeVO vol = this.volumeDao.findById(this.getId());
-                     VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
+                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer)answer;
 -                    VolumeVO vol = this.volumeDao.findById(this.getId());
++                    VolumeVO vol = volumeDao.findById(getId());
+                     VolumeObjectTO newVol = (VolumeObjectTO)cpyAnswer.getNewData();
                      vol.setPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          vol.setSize(newVol.getSize());
                      }
--                    vol.setPoolId(this.getDataStore().getId());
++                    vol.setPoolId(getDataStore().getId());
                      volumeDao.update(vol.getId(), vol);
                  } else if (answer instanceof CreateObjectAnswer) {
-                     CreateObjectAnswer createAnswer = (CreateObjectAnswer) answer;
-                     VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
-                     VolumeVO vol = this.volumeDao.findById(this.getId());
+                     CreateObjectAnswer createAnswer = (CreateObjectAnswer)answer;
+                     VolumeObjectTO newVol = (VolumeObjectTO)createAnswer.getData();
 -                    VolumeVO vol = this.volumeDao.findById(this.getId());
++                    VolumeVO vol = volumeDao.findById(getId());
                      vol.setPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          vol.setSize(newVol.getSize());
                      }
--                    vol.setPoolId(this.getDataStore().getId());
++                    vol.setPoolId(getDataStore().getId());
                      volumeDao.update(vol.getId(), vol);
                  }
              } else {
                  // image store or imageCache store
                  if (answer instanceof DownloadAnswer) {
-                     DownloadAnswer dwdAnswer = (DownloadAnswer) answer;
-                     VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(),
-                             this.getId());
+                     DownloadAnswer dwdAnswer = (DownloadAnswer)answer;
 -                    VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++                    VolumeDataStoreVO volStore = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
                      volStore.setInstallPath(dwdAnswer.getInstallPath());
                      volStore.setChecksum(dwdAnswer.getCheckSum());
--                    this.volumeStoreDao.update(volStore.getId(), volStore);
++                    volumeStoreDao.update(volStore.getId(), volStore);
                  } else if (answer instanceof CopyCmdAnswer) {
-                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer) answer;
-                     VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(),
-                             this.getId());
-                     VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
+                     CopyCmdAnswer cpyAnswer = (CopyCmdAnswer)answer;
 -                    VolumeDataStoreVO volStore = this.volumeStoreDao.findByStoreVolume(this.dataStore.getId(), this.getId());
++                    VolumeDataStoreVO volStore = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId());
+                     VolumeObjectTO newVol = (VolumeObjectTO)cpyAnswer.getNewData();
                      volStore.setInstallPath(newVol.getPath());
                      if (newVol.getSize() != null) {
                          volStore.setSize(newVol.getSize());
                      }
--                    this.volumeStoreDao.update(volStore.getId(), volStore);
++                    volumeStoreDao.update(volStore.getId(), volStore);
                  }
              }
          } catch (RuntimeException ex) {
@@@ -627,7 -647,7 +648,7 @@@
  
      @Override
      public ImageFormat getFormat() {
--        return this.volumeVO.getFormat();
++        return volumeVO.getFormat();
      }
  
      @Override
@@@ -640,11 -660,6 +661,11 @@@
  
      @Override
      public Long getVmSnapshotChainSize() {
--        return this.volumeVO.getVmSnapshotChainSize();
++        return volumeVO.getVmSnapshotChainSize();
 +    }
 +
 +    @Override
 +    public AclEntityType getEntityType() {
 +        return AclEntityType.Volume;
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/framework/db/src/com/cloud/utils/db/SearchBase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
----------------------------------------------------------------------
diff --cc plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
index 1540ef4,d7c6a55..b46dc15
--- a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
+++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
@@@ -198,11 -189,9 +189,9 @@@ public class ApiRateLimitServiceImpl ex
          this.timeToLive = timeToLive;
      }
  
- 
- 
      @Override
      public void setMaxAllowed(int max) {
--        this.maxAllowed = max;
++        maxAllowed = max;
  
      }
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
----------------------------------------------------------------------
diff --cc plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
index 03c9bdb,0091b15..a16179e
--- a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
+++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
@@@ -39,39 -44,36 +44,36 @@@ import com.cloud.user.AccountVO
  import com.cloud.user.User;
  import com.cloud.user.UserVO;
  
- import static org.junit.Assert.*;
- import static org.mockito.Mockito.*;
- 
  public class ApiRateLimitTest {
  
- 	static ApiRateLimitServiceImpl _limitService = new ApiRateLimitServiceImpl();
- 	static AccountService _accountService = mock(AccountService.class);
- 	static ConfigurationDao _configDao = mock(ConfigurationDao.class);
- 	private static long acctIdSeq = 5L;
- 	private static Account testAccount;
+     static ApiRateLimitServiceImpl s_limitService = new ApiRateLimitServiceImpl();
+     static AccountService s_accountService = mock(AccountService.class);
+     static ConfigurationDao s_configDao = mock(ConfigurationDao.class);
+     private static long s_acctIdSeq = 5L;
+     private static Account s_testAccount;
  
- 	@BeforeClass
- 	public static void setUp() throws ConfigurationException {
+     @BeforeClass
 -    public static void setUp() throws ConfigurationException {
++public static void setUp() throws ConfigurationException {
  
- 	    when(_configDao.getValue(Config.ApiLimitInterval.key())).thenReturn(null);
- 	    when(_configDao.getValue(Config.ApiLimitMax.key())).thenReturn(null);
- 	    when(_configDao.getValue(Config.ApiLimitCacheSize.key())).thenReturn(null);
- 	    when(_configDao.getValue(Config.ApiLimitEnabled.key())).thenReturn("true"); // enable api rate limiting
- 	    _limitService._configDao = _configDao;
+         when(s_configDao.getValue(Config.ApiLimitInterval.key())).thenReturn(null);
+         when(s_configDao.getValue(Config.ApiLimitMax.key())).thenReturn(null);
+         when(s_configDao.getValue(Config.ApiLimitCacheSize.key())).thenReturn(null);
+         when(s_configDao.getValue(Config.ApiLimitEnabled.key())).thenReturn("true"); // enable api rate limiting
+         s_limitService._configDao = s_configDao;
  
- 		_limitService.configure("ApiRateLimitTest", Collections.<String, Object> emptyMap());
+         s_limitService.configure("ApiRateLimitTest", Collections.<String, Object> emptyMap());
  
- 	    _limitService._accountService = _accountService;
+         s_limitService._accountService = s_accountService;
  
- 	    // Standard responses
- 	    AccountVO acct = new AccountVO(acctIdSeq);
- 	    acct.setType(Account.ACCOUNT_TYPE_NORMAL);
- 	    acct.setAccountName("demo");
- 	    testAccount = acct;
+         // Standard responses
+         AccountVO acct = new AccountVO(s_acctIdSeq);
+         acct.setType(Account.ACCOUNT_TYPE_NORMAL);
+         acct.setAccountName("demo");
+         s_testAccount = acct;
  
- 	    when(_accountService.getAccount(5L)).thenReturn(testAccount);
-         when(_accountService.isRootAdmin(5L)).thenReturn(false);
- 	}
+         when(s_accountService.getAccount(5L)).thenReturn(s_testAccount);
 -        when(s_accountService.isRootAdmin(Account.ACCOUNT_TYPE_NORMAL)).thenReturn(false);
++        when(s_accountService.isRootAdmin(5L)).thenReturn(false);
+     }
  
      @Before
      public void testSetUp() {
@@@ -185,10 -180,10 +180,10 @@@
      @Test
      public void expiryOfCounterIsSupported() throws Exception {
          int allowedRequests = 1;
-         _limitService.setMaxAllowed(allowedRequests);
-         _limitService.setTimeToLive(1);
+         s_limitService.setMaxAllowed(allowedRequests);
+         s_limitService.setTimeToLive(1);
  
--        User key = this.createFakeUser();
++        User key = createFakeUser();
  
          assertTrue("The first request should be allowed", isUnderLimit(key));
  
@@@ -201,10 -196,10 +196,10 @@@
      @Test
      public void verifyResetCounters() throws Exception {
          int allowedRequests = 1;
-         _limitService.setMaxAllowed(allowedRequests);
-         _limitService.setTimeToLive(1);
+         s_limitService.setMaxAllowed(allowedRequests);
+         s_limitService.setTimeToLive(1);
  
--        User key = this.createFakeUser();
++        User key = createFakeUser();
  
          assertTrue("The first request should be allowed", isUnderLimit(key));
  
@@@ -218,13 -213,12 +213,12 @@@
      @Test
      public void verifySearchCounter() throws Exception {
          int allowedRequests = 10;
-         _limitService.setMaxAllowed(allowedRequests);
-         _limitService.setTimeToLive(1);
+         s_limitService.setMaxAllowed(allowedRequests);
+         s_limitService.setTimeToLive(1);
  
--        User key = this.createFakeUser();
++        User key = createFakeUser();
  
-         for ( int i = 0; i < 5; i++ ){
+         for (int i = 0; i < 5; i++) {
              assertTrue("Issued 5 requests", isUnderLimit(key));
          }
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java
index 001a0e1,d671a6b..b3f3725
--- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java
+++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java
@@@ -72,9 -75,10 +76,10 @@@ public class ListF5LoadBalancerNetworks
      /////////////////////////////////////////////////////
  
      @Override
-     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+         ResourceAllocationException {
          try {
 -            List<? extends Network> networks = _f5DeviceManagerService.listNetworks(this);
 +            List<? extends Network> networks  = _f5DeviceManagerService.listNetworks(this);
              ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
              List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
index 44d705a,2f81688..04cdc7c
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
@@@ -182,32 -180,63 +180,85 @@@ public class MockAccountManager extend
      }
  
      @Override
-     public boolean isRootAdmin(long arg0) {
 -    public boolean isRootAdmin(short arg0) {
++    public boolean isRootAdmin(long accountId) {
          // TODO Auto-generated method stub
--        return true;
++        return false;
+     }
+ 
+     @Override
 -    public UserAccount lockUser(long arg0) {
++    public boolean isDomainAdmin(long accountId) {
+         // TODO Auto-generated method stub
 -        return null;
++        return false;
+     }
+ 
+     @Override
 -    public void markUserRegistered(long arg0) {
++    public boolean isNormalUser(long accountId) {
++        // TODO Auto-generated method stub
++        return false;
++    }
++
++    @Override
++    public void checkAccess(Account account, AccessType accessType, boolean sameOwner, PartOf... entities) throws PermissionDeniedException {
+         // TODO Auto-generated method stub
+ 
+     }
+ 
++
+     @Override
 -    public UserAccount authenticateUser(String arg0, String arg1, Long arg2, String arg3, Map<String, Object[]> arg4) {
++    public void buildACLSearchParameters(Account caller, Long id, String accountName, Long projectId, List<Long> permittedDomains, List<Long> permittedAccounts,
++            List<Long> permittedResources, Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject, boolean listAll, boolean forProjectInvitation,
++            String action) {
+         // TODO Auto-generated method stub
 -        return null;
++
+     }
+ 
+     @Override
 -    public void buildACLSearchBuilder(SearchBuilder<? extends ControlledEntity> arg0, Long arg1, boolean arg2, List<Long> arg3, ListProjectResourcesCriteria arg4) {
++    public void buildACLSearchBuilder(SearchBuilder<? extends ControlledEntity> sb, boolean isRecursive, List<Long> permittedDomains, List<Long> permittedAccounts,
++            List<Long> permittedResources, ListProjectResourcesCriteria listProjectResourcesCriteria) {
+         // TODO Auto-generated method stub
+ 
+     }
+ 
+     @Override
 -    public void buildACLSearchCriteria(SearchCriteria<? extends ControlledEntity> arg0, Long arg1, boolean arg2, List<Long> arg3, ListProjectResourcesCriteria arg4) {
++    public void buildACLSearchCriteria(SearchCriteria<? extends ControlledEntity> sc, boolean isRecursive, List<Long> permittedDomains, List<Long> permittedAccounts,
++            List<Long> permittedResources, ListProjectResourcesCriteria listProjectResourcesCriteria) {
+         // TODO Auto-generated method stub
+ 
+     }
+ 
+     @Override
 -    public void buildACLSearchParameters(Account arg0, Long arg1, String arg2, Long arg3, List<Long> arg4, Ternary<Long, Boolean, ListProjectResourcesCriteria> arg5,
 -        boolean arg6, boolean arg7) {
++    public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledEntity> sc, SearchCriteria<? extends ControlledEntity> aclSc, boolean isRecursive,
++            List<Long> permittedDomains, List<Long> permittedAccounts, List<Long> permittedResources, ListProjectResourcesCriteria listProjectResourcesCriteria) {
+         // TODO Auto-generated method stub
+ 
+     }
+ 
+     @Override
 -    public void
 -        buildACLViewSearchBuilder(SearchBuilder<? extends ControlledViewEntity> arg0, Long arg1, boolean arg2, List<Long> arg3, ListProjectResourcesCriteria arg4) {
++    public List<String> listAclGroupsByAccount(Long accountId) {
+         // TODO Auto-generated method stub
++        return null;
 +    }
  
 +    @Override
 +    public UserAccount lockUser(long arg0) {
 +        // TODO Auto-generated method stub
 +        return null;
      }
  
      @Override
 -    public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEntity> arg0, Long arg1, boolean arg2, List<Long> arg3,
 -        ListProjectResourcesCriteria arg4) {
 +    public void markUserRegistered(long arg0) {
          // TODO Auto-generated method stub
-         
+ 
      }
  
      @Override
-     public UserAccount authenticateUser(String arg0, String arg1, Long arg2,
-             String arg3, Map<String, Object[]> arg4) {
++    public UserAccount authenticateUser(String arg0, String arg1, Long arg2, String arg3, Map<String, Object[]> arg4) {
 +        // TODO Auto-generated method stub
 +        return null;
 +    }
 +
 +
 +    @Override
      public Long checkAccessAndSpecifyAuthority(Account arg0, Long arg1) {
          // TODO Auto-generated method stub
          return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java
index 6a853b2,a2d99a5..017ca6c
--- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java
@@@ -71,9 -74,10 +75,10 @@@ public class ListSrxFirewallNetworksCm
      /////////////////////////////////////////////////////
  
      @Override
-     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+         ResourceAllocationException {
          try {
 -            List<? extends Network> networks = _srxFwService.listNetworks(this);
 +            List<? extends Network> networks  = _srxFwService.listNetworks(this);
              ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
              List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
index a93e311,25d1487..44bdb74
--- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
@@@ -69,9 -74,10 +75,10 @@@ public class ListNetscalerLoadBalancerN
      /////////////////////////////////////////////////////
  
      @Override
-     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+         ResourceAllocationException {
          try {
 -            List<? extends Network> networks = _netsclarLbService.listNetworks(this);
 +            List<? extends Network> networks  = _netsclarLbService.listNetworks(this);
              ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
              List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java
index 0000000,d1b7425..a7e71d3
mode 000000,100644..100644
--- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java
+++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java
@@@ -1,0 -1,105 +1,106 @@@
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements.  See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership.  The ASF licenses this file
+ // 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,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied.  See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ package com.cloud.api.commands;
+ 
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+ import javax.inject.Inject;
+ 
+ import org.apache.log4j.Logger;
+ 
+ import org.apache.cloudstack.api.APICommand;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.ApiErrorCode;
+ import org.apache.cloudstack.api.BaseListCmd;
+ import org.apache.cloudstack.api.Parameter;
++import org.apache.cloudstack.api.ResponseObject.ResponseView;
+ import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.ListResponse;
+ import org.apache.cloudstack.api.response.NetworkResponse;
+ 
+ import com.cloud.api.response.PaloAltoFirewallResponse;
+ import com.cloud.exception.ConcurrentOperationException;
+ import com.cloud.exception.InsufficientCapacityException;
+ import com.cloud.exception.InvalidParameterValueException;
+ import com.cloud.exception.ResourceAllocationException;
+ import com.cloud.exception.ResourceUnavailableException;
+ import com.cloud.network.Network;
+ import com.cloud.network.element.PaloAltoFirewallElementService;
+ import com.cloud.utils.exception.CloudRuntimeException;
+ 
+ @APICommand(name = "listPaloAltoFirewallNetworks", responseObject = NetworkResponse.class, description = "lists network that are using Palo Alto firewall device")
+ public class ListPaloAltoFirewallNetworksCmd extends BaseListCmd {
+ 
+     public static final Logger s_logger = Logger.getLogger(ListPaloAltoFirewallNetworksCmd.class.getName());
+     private static final String s_name = "listpaloaltofirewallnetworksresponse";
+     @Inject
+     PaloAltoFirewallElementService _paFwService;
+ 
+     /////////////////////////////////////////////////////
+     //////////////// API parameters /////////////////////
+     /////////////////////////////////////////////////////
+ 
+     @Parameter(name = ApiConstants.LOAD_BALANCER_DEVICE_ID,
+                type = CommandType.UUID,
+                entityType = PaloAltoFirewallResponse.class,
+                required = true,
+                description = "palo alto balancer device ID")
+     private Long fwDeviceId;
+ 
+     /////////////////////////////////////////////////////
+     /////////////////// Accessors ///////////////////////
+     /////////////////////////////////////////////////////
+ 
+     public Long getFirewallDeviceId() {
+         return fwDeviceId;
+     }
+ 
+     /////////////////////////////////////////////////////
+     /////////////// API Implementation///////////////////
+     /////////////////////////////////////////////////////
+ 
+     @Override
+     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+         ResourceAllocationException {
+         try {
+             List<? extends Network> networks = _paFwService.listNetworks(this);
+             ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
+             List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
+ 
+             if (networks != null && !networks.isEmpty()) {
+                 for (Network network : networks) {
 -                    NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
++                    NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Full, network);
+                     networkResponses.add(networkResponse);
+                 }
+             }
+ 
+             response.setResponses(networkResponses);
+             response.setResponseName(getCommandName());
 -            this.setResponseObject(response);
++            setResponseObject(response);
+         } catch (InvalidParameterValueException invalidParamExcp) {
+             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
+         } catch (CloudRuntimeException runtimeExcp) {
+             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
+         }
+     }
+ 
+     @Override
+     public String getCommandName() {
+         return s_name;
+     }
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
----------------------------------------------------------------------
diff --cc plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
index fbb652e,100ffe6..abe61d1
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
@@@ -45,125 -44,116 +45,117 @@@ import com.cloud.user.UserAccount
  
  @APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0")
  public class LdapCreateAccountCmd extends BaseCmd {
- 	public static final Logger s_logger = Logger
- 			.getLogger(LdapCreateAccountCmd.class.getName());
- 	private static final String s_name = "createaccountresponse";
- 
- 	@Inject
- 	private LdapManager _ldapManager;
- 
- 	@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
- 	private String accountName;
- 
- 	@Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.SHORT, required = true, description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
- 	private Short accountType;
- 
- 	@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
- 	private Long domainId;
- 
- 	@Parameter(name = ApiConstants.TIMEZONE, type = CommandType.STRING, description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
- 	private String timezone;
- 
- 	@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Unique username.")
- 	private String username;
- 
- 	@Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the account's networks")
- 	private String networkDomain;
- 
- 	@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
- 	private Map<String, String> details;
- 
- 	@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding account from external provisioning system")
- 	private String accountUUID;
- 
- 	@Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system")
- 	private String userUUID;
- 
- 	public LdapCreateAccountCmd() {
- 		super();
- 	}
- 
- 	public LdapCreateAccountCmd(final LdapManager ldapManager,
- 			final AccountService accountService) {
- 		super();
- 		_ldapManager = ldapManager;
- 		_accountService = accountService;
- 	}
- 
- 	UserAccount createCloudstackUserAccount(final LdapUser user) {
- 		return _accountService.createUserAccount(username, generatePassword(),
- 				user.getFirstname(), user.getLastname(), user.getEmail(),
- 				timezone, accountName, accountType, domainId, networkDomain,
- 				details, accountUUID, userUUID);
- 	}
- 
- 	@Override
- 	public void execute() throws ServerApiException {
- 		final CallContext callContext = getCurrentContext();
- 		callContext.setEventDetails("Account Name: " + accountName
- 				+ ", Domain Id:" + domainId);
- 		try {
- 			final LdapUser user = _ldapManager.getUser(username);
- 			validateUser(user);
- 			final UserAccount userAccount = createCloudstackUserAccount(user);
- 			if (userAccount != null) {
- 				final AccountResponse response = _responseGenerator
+     public static final Logger s_logger = Logger.getLogger(LdapCreateAccountCmd.class.getName());
+     private static final String s_name = "createaccountresponse";
+ 
+     @Inject
+     private LdapManager _ldapManager;
+ 
+     @Parameter(name = ApiConstants.ACCOUNT,
 -               type = CommandType.STRING,
 -               description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
++            type = CommandType.STRING,
++            description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
+     private String accountName;
+ 
+     @Parameter(name = ApiConstants.ACCOUNT_TYPE,
 -               type = CommandType.SHORT,
 -               required = true,
 -               description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
++            type = CommandType.SHORT,
++            required = true,
++            description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
+     private Short accountType;
+ 
+     @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
+     private Long domainId;
+ 
+     @Parameter(name = ApiConstants.TIMEZONE,
 -               type = CommandType.STRING,
 -               description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
++            type = CommandType.STRING,
++            description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
+     private String timezone;
+ 
+     @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Unique username.")
+     private String username;
+ 
+     @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the account's networks")
+     private String networkDomain;
+ 
+     @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
+     private Map<String, String> details;
+ 
+     @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding account from external provisioning system")
+     private String accountUUID;
+ 
+     @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system")
+     private String userUUID;
+ 
+     public LdapCreateAccountCmd() {
+         super();
+     }
+ 
+     public LdapCreateAccountCmd(final LdapManager ldapManager, final AccountService accountService) {
+         super();
+         _ldapManager = ldapManager;
+         _accountService = accountService;
+     }
+ 
+     UserAccount createCloudstackUserAccount(final LdapUser user) {
+         return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName,
 -            accountType, domainId, networkDomain, details, accountUUID, userUUID);
++                accountType, domainId, networkDomain, details, accountUUID, userUUID);
+     }
+ 
+     @Override
+     public void execute() throws ServerApiException {
+         final CallContext callContext = getCurrentContext();
+         callContext.setEventDetails("Account Name: " + accountName + ", Domain Id:" + domainId);
+         try {
+             final LdapUser user = _ldapManager.getUser(username);
+             validateUser(user);
+             final UserAccount userAccount = createCloudstackUserAccount(user);
+             if (userAccount != null) {
 -                final AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
++                final AccountResponse response = _responseGenerator
 +                        .createUserAccountResponse(ResponseView.Full, userAccount);
- 				response.setResponseName(getCommandName());
- 				setResponseObject(response);
- 			} else {
- 				throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
- 						"Failed to create a user account");
- 			}
- 		} catch (final NamingException e) {
- 			throw new ServerApiException(
- 					ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR,
- 					"No LDAP user exists with the username of " + username);
- 		}
- 	}
- 
- 	private String generatePassword() throws ServerApiException {
- 		try {
- 			final SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG");
- 			final byte bytes[] = new byte[20];
- 			randomGen.nextBytes(bytes);
- 			return Base64.encode(bytes).toString();
- 		} catch (final NoSuchAlgorithmException e) {
- 			throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
- 					"Failed to generate random password");
- 		}
- 	}
- 
- 	@Override
- 	public String getCommandName() {
- 		return s_name;
- 	}
- 
- 	CallContext getCurrentContext() {
- 		return CallContext.current();
- 	}
- 
- 	@Override
- 	public long getEntityOwnerId() {
- 		return Account.ACCOUNT_ID_SYSTEM;
- 	}
- 
- 	private boolean validateUser(final LdapUser user) throws ServerApiException {
- 		if (user.getEmail() == null) {
- 			throw new ServerApiException(
- 					ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username
- 							+ " has no email address set within LDAP");
- 		}
- 		if (user.getFirstname() == null) {
- 			throw new ServerApiException(
- 					ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username
- 							+ " has no firstname set within LDAP");
- 		}
- 		if (user.getLastname() == null) {
- 			throw new ServerApiException(
- 					ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username
- 							+ " has no lastname set within LDAP");
- 		}
- 		return true;
- 	}
+                 response.setResponseName(getCommandName());
+                 setResponseObject(response);
+             } else {
+                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
+             }
+         } catch (final NamingException e) {
+             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, "No LDAP user exists with the username of " + username);
+         }
+     }
+ 
+     private String generatePassword() throws ServerApiException {
+         try {
+             final SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG");
+             final byte bytes[] = new byte[20];
+             randomGen.nextBytes(bytes);
+             return Base64.encode(bytes).toString();
+         } catch (final NoSuchAlgorithmException e) {
+             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate random password");
+         }
+     }
+ 
+     @Override
+     public String getCommandName() {
+         return s_name;
+     }
+ 
+     CallContext getCurrentContext() {
+         return CallContext.current();
+     }
+ 
+     @Override
+     public long getEntityOwnerId() {
+         return Account.ACCOUNT_ID_SYSTEM;
+     }
+ 
+     private boolean validateUser(final LdapUser user) throws ServerApiException {
+         if (user.getEmail() == null) {
+             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username + " has no email address set within LDAP");
+         }
+         if (user.getFirstname() == null) {
+             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username + " has no firstname set within LDAP");
+         }
+         if (user.getLastname() == null) {
+             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, username + " has no lastname set within LDAP");
+         }
+         return true;
+     }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
----------------------------------------------------------------------
diff --cc server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
index e762ad1,53a294e..e520873
--- a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
+++ b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
@@@ -223,5 -230,6 +231,6 @@@
  
      <bean id="GlobalLoadBalancingRulesServiceImpl"
          class="org.apache.cloudstack.region.gslb.GlobalLoadBalancingRulesServiceImpl" />
 -
 +        
-  </beans>
+     <bean id="certServiceImpl" class="org.apache.cloudstack.network.lb.CertServiceImpl" />
+ </beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929fbaba/server/src/com/cloud/acl/AffinityGroupAccessChecker.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/acl/AffinityGroupAccessChecker.java
index 9df52ae,7db2668..1c8ea64
--- a/server/src/com/cloud/acl/AffinityGroupAccessChecker.java
+++ b/server/src/com/cloud/acl/AffinityGroupAccessChecker.java
@@@ -44,16 -44,13 +44,15 @@@ public class AffinityGroupAccessChecke
      AffinityGroupDomainMapDao _affinityGroupDomainMapDao;
  
      @Override
-     public boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType)
-             throws PermissionDeniedException {
+     public boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType) throws PermissionDeniedException {
          if (entity instanceof AffinityGroup) {
-             AffinityGroup group = (AffinityGroup) entity;
+             AffinityGroup group = (AffinityGroup)entity;
  
              if (_affinityGroupService.isAdminControlledGroup(group)) {
 -                if (accessType != null && accessType == AccessType.ModifyEntry && !_accountMgr.isRootAdmin(caller.getType())) {
 -                    throw new PermissionDeniedException(caller + " does not have permission to operate with resource " + entity);
 +                if (accessType != null && accessType == AccessType.ModifyEntry
 +                        && !_accountMgr.isRootAdmin(caller.getId())) {
 +                    throw new PermissionDeniedException(caller + " does not have permission to operate with resource "
 +                            + entity);
                  }
              }