mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
ff02e07a33
@ -28,8 +28,8 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.resource.DiskPreparer;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.storage.Volume.VolumeType;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
|
||||
@ -17,12 +17,13 @@
|
||||
*/
|
||||
package com.cloud.deploy;
|
||||
|
||||
public class DataCenterDeployment implements DeploymentStrategy {
|
||||
public class DataCenterDeployment implements DeploymentPlan {
|
||||
long _dcId;
|
||||
public DataCenterDeployment(long dataCenterId) {
|
||||
_dcId = dataCenterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDataCenterId() {
|
||||
return _dcId;
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ package com.cloud.deploy;
|
||||
* Describes how a VM should be deployed.
|
||||
*
|
||||
*/
|
||||
public interface DeploymentStrategy {
|
||||
public interface DeploymentPlan {
|
||||
public long getDataCenterId();
|
||||
|
||||
}
|
||||
37
api/src/com/cloud/domain/Domain.java
Normal file
37
api/src/com/cloud/domain/Domain.java
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
/**
|
||||
* Domain defines the Domain object.
|
||||
*/
|
||||
public interface Domain extends OwnedBy {
|
||||
public static final long ROOT_DOMAIN = 1L;
|
||||
|
||||
long getId();
|
||||
|
||||
Long getParent();
|
||||
|
||||
void setParent(Long parent);
|
||||
|
||||
String getName();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
String getPath();
|
||||
|
||||
void setPath(String path);
|
||||
|
||||
int getLevel();
|
||||
|
||||
int getChildCount();
|
||||
|
||||
long getNextChildSeq();
|
||||
}
|
||||
15
api/src/com/cloud/domain/PartOf.java
Normal file
15
api/src/com/cloud/domain/PartOf.java
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.domain;
|
||||
|
||||
/**
|
||||
* PartOf must be implemented by all objects that belongs
|
||||
* in a domain.
|
||||
*/
|
||||
public interface PartOf {
|
||||
/**
|
||||
* @return domain id that the object belongs to.
|
||||
*/
|
||||
long getDomainId();
|
||||
}
|
||||
@ -17,8 +17,12 @@
|
||||
*/
|
||||
package com.cloud.storage;
|
||||
|
||||
import com.cloud.domain.PartOf;
|
||||
import com.cloud.template.BasedOn;
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
public interface Volume {
|
||||
|
||||
public interface Volume extends PartOf, OwnedBy, BasedOn {
|
||||
enum VolumeType {UNKNOWN, ROOT, SWAP, DATADISK};
|
||||
|
||||
enum MirrorState {NOT_MIRRORED, ACTIVE, DEFUNCT};
|
||||
@ -38,16 +42,6 @@ public interface Volume {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return owner's account id
|
||||
*/
|
||||
long getAccountId();
|
||||
|
||||
/**
|
||||
* @return id of the owning account's domain
|
||||
*/
|
||||
long getDomainId();
|
||||
|
||||
/**
|
||||
* @return total size of the partition
|
||||
*/
|
||||
|
||||
16
api/src/com/cloud/template/BasedOn.java
Normal file
16
api/src/com/cloud/template/BasedOn.java
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.template;
|
||||
|
||||
/**
|
||||
* BasedOn is implemented by all objects that are based on a certain template.
|
||||
*/
|
||||
public interface BasedOn {
|
||||
|
||||
/**
|
||||
* @return the template id that the volume is based on.
|
||||
*/
|
||||
Long getTemplateId();
|
||||
|
||||
}
|
||||
@ -15,12 +15,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.storage;
|
||||
package com.cloud.template;
|
||||
|
||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||
import com.cloud.storage.Storage.FileSystem;
|
||||
|
||||
public interface VirtualMachineTemplate {
|
||||
public interface VirtualMachineTemplate {
|
||||
|
||||
public static enum BootloaderType { PyGrub, HVM, External };
|
||||
|
||||
@ -20,7 +20,22 @@ package com.cloud.user;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Account {
|
||||
import com.cloud.domain.PartOf;
|
||||
|
||||
public interface Account extends PartOf {
|
||||
public enum Type {
|
||||
Normal,
|
||||
Admin,
|
||||
DomainAdmin,
|
||||
CustomerCare
|
||||
}
|
||||
|
||||
public enum State {
|
||||
Disabled,
|
||||
Enabled,
|
||||
Locked
|
||||
}
|
||||
|
||||
public static final short ACCOUNT_TYPE_NORMAL = 0;
|
||||
public static final short ACCOUNT_TYPE_ADMIN = 1;
|
||||
public static final short ACCOUNT_TYPE_DOMAIN_ADMIN = 2;
|
||||
@ -32,14 +47,12 @@ public interface Account {
|
||||
|
||||
public static final long ACCOUNT_ID_SYSTEM = 1;
|
||||
|
||||
public Long getId();
|
||||
public long getId();
|
||||
public String getAccountName();
|
||||
public void setAccountName(String accountId);
|
||||
public short getType();
|
||||
public void setType(short type);
|
||||
public String getState();
|
||||
public void setState(String state);
|
||||
public Long getDomainId();
|
||||
public void setDomainId(Long domainId);
|
||||
public long getDomainId();
|
||||
public Date getRemoved();
|
||||
}
|
||||
14
api/src/com/cloud/user/OwnedBy.java
Normal file
14
api/src/com/cloud/user/OwnedBy.java
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.user;
|
||||
|
||||
/**
|
||||
* OwnedBy must be inheritted by all objects that can be owned by an account.
|
||||
*/
|
||||
public interface OwnedBy {
|
||||
/**
|
||||
* @return account id that owns this object.
|
||||
*/
|
||||
long getAccountId();
|
||||
}
|
||||
@ -17,12 +17,14 @@
|
||||
*/
|
||||
package com.cloud.uservm;
|
||||
|
||||
import com.cloud.domain.PartOf;
|
||||
import com.cloud.user.OwnedBy;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
* This represents one running virtual machine instance.
|
||||
*/
|
||||
public interface UserVm extends VirtualMachine {
|
||||
public interface UserVm extends VirtualMachine, OwnedBy, PartOf {
|
||||
|
||||
/**
|
||||
* @return service offering id
|
||||
@ -39,11 +41,6 @@ public interface UserVm extends VirtualMachine {
|
||||
*/
|
||||
String getVnet();
|
||||
|
||||
/**
|
||||
* @return the account this vm instance belongs to.
|
||||
*/
|
||||
long getAccountId();
|
||||
|
||||
/**
|
||||
* @return the domain this vm instance belongs to.
|
||||
*/
|
||||
|
||||
@ -9,32 +9,14 @@ import com.cloud.network.Network.Mode;
|
||||
public class NetworkCharacteristics {
|
||||
long id;
|
||||
BroadcastDomainType type;
|
||||
String ip4Address;
|
||||
String netmask;
|
||||
String gateway;
|
||||
String cidr;
|
||||
Mode mode;
|
||||
String[] dns;
|
||||
long vmId;
|
||||
|
||||
public BroadcastDomainType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String[] getDns() {
|
||||
return dns;
|
||||
}
|
||||
|
||||
public String getIp4Address() {
|
||||
return ip4Address;
|
||||
}
|
||||
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
@ -42,17 +24,19 @@ public class NetworkCharacteristics {
|
||||
public long getNetworkId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVirtualMachineId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public NetworkCharacteristics() {
|
||||
}
|
||||
|
||||
public NetworkCharacteristics(long id, BroadcastDomainType type, String ip4Address, String netmask, String gateway, Mode mode, String[] dns) {
|
||||
public NetworkCharacteristics(long id, BroadcastDomainType type, String cidr, Mode mode, long vmId) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.ip4Address = ip4Address;
|
||||
this.netmask = netmask;
|
||||
this.gateway = gateway;
|
||||
this.cidr = cidr;
|
||||
this.mode = mode;
|
||||
this.dns = dns;
|
||||
this.vmId = vmId;
|
||||
}
|
||||
}
|
||||
|
||||
23
api/src/com/cloud/vm/NetworkConcierge.java
Normal file
23
api/src/com/cloud/vm/NetworkConcierge.java
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
* NetworkConcierge reserves network settings for a VM based
|
||||
* on the NetworkCharacteristics given. A Concierge must
|
||||
* return a unique name so we know to call it to release
|
||||
* the reservation.
|
||||
*
|
||||
*/
|
||||
public interface NetworkConcierge extends Adapter {
|
||||
String getUniqueName();
|
||||
|
||||
Pair<String, NetworkTO> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException;
|
||||
|
||||
boolean release(String uniqueName, String uniqueId);
|
||||
}
|
||||
18
api/src/com/cloud/vm/NetworkProfiler.java
Normal file
18
api/src/com/cloud/vm/NetworkProfiler.java
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
public interface NetworkProfiler extends Adapter {
|
||||
Ternary<VmCharacteristics, List<NetworkCharacteristics>, List<DiskCharacteristics>> convert(VirtualMachine vm, ServiceOffering serviceOffering, List<NetworkOffering> networkOfferings, Collection<DiskOffering> diskOfferings, Account owner);
|
||||
}
|
||||
@ -15,12 +15,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.agent.api.to;
|
||||
package com.cloud.vm;
|
||||
|
||||
/**
|
||||
* Transfer object to transfer network settings.
|
||||
*/
|
||||
public class NetworkTO {
|
||||
private String uuid;
|
||||
private String ip;
|
||||
private String netmask;
|
||||
private String gateway;
|
||||
@ -23,6 +23,7 @@ package com.cloud.vm;
|
||||
*/
|
||||
public interface Nic {
|
||||
enum State {
|
||||
Allocated,
|
||||
AcquireIp,
|
||||
IpAcquired,
|
||||
}
|
||||
@ -47,4 +48,6 @@ public interface Nic {
|
||||
* @return the vm instance id that this nic belongs to.
|
||||
*/
|
||||
long getInstanceId();
|
||||
|
||||
long getDeviceId();
|
||||
}
|
||||
|
||||
14
api/src/com/cloud/vm/RunningOn.java
Normal file
14
api/src/com/cloud/vm/RunningOn.java
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
/**
|
||||
* RunningOn must be implemented by objects that runs on hosts.
|
||||
*
|
||||
*/
|
||||
public interface RunningOn {
|
||||
|
||||
Long getHostId();
|
||||
|
||||
}
|
||||
@ -23,7 +23,7 @@ import java.util.Date;
|
||||
* VirtualMachine describes the properties held by a virtual machine
|
||||
*
|
||||
*/
|
||||
public interface VirtualMachine {
|
||||
public interface VirtualMachine extends RunningOn {
|
||||
public enum Event {
|
||||
CreateRequested,
|
||||
StartRequested,
|
||||
@ -100,11 +100,6 @@ public interface VirtualMachine {
|
||||
*/
|
||||
public long getDataCenterId();
|
||||
|
||||
/**
|
||||
* @return id of the host it is running on. If not running, returns null.
|
||||
*/
|
||||
public Long getHostId();
|
||||
|
||||
/**
|
||||
* @return id of the host it was assigned last time.
|
||||
*/
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Mon Aug 16 18:14:16 PDT 2010
|
||||
build.number=32
|
||||
#Wed Aug 18 11:29:13 PDT 2010
|
||||
build.number=64
|
||||
|
||||
@ -232,9 +232,6 @@ Requires: %{name}-daemonize
|
||||
Requires: /sbin/service
|
||||
Requires: /sbin/chkconfig
|
||||
Requires: kvm
|
||||
%if "%{fedora}" != ""
|
||||
Requires: cloud-qemu-system-x86
|
||||
%endif
|
||||
Requires: libcgroup
|
||||
Requires: /usr/bin/uuidgen
|
||||
Requires: augeas >= 0.7.1
|
||||
|
||||
@ -39,7 +39,7 @@ import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
@ -21,7 +21,7 @@ package com.cloud.agent.api;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
|
||||
public abstract class AbstractStartCommand extends Command {
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.vm.NetworkTO;
|
||||
|
||||
public class HostTO {
|
||||
private String guid;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import com.cloud.vm.NetworkTO;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
|
||||
public class VmTO {
|
||||
|
||||
@ -25,9 +25,11 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
@Entity
|
||||
@Table(name="account_vlan_map")
|
||||
public class AccountVlanMapVO {
|
||||
public class AccountVlanMapVO implements OwnedBy {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@ -52,7 +54,8 @@ public class AccountVlanMapVO {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
||||
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = FreeIpSearch.create();
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("pod", podId);
|
||||
sc.setParameters("ipAddr", NetUtils.getLinkLocalGateway()); /*explicitly removing the gateway*/
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
@ -141,6 +142,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
||||
FreeIpSearch = createSearchBuilder();
|
||||
FreeIpSearch.and("dc", FreeIpSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
FreeIpSearch.and("pod", FreeIpSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
FreeIpSearch.and("ipAddr", FreeIpSearch.entity().getIpAddress(), SearchCriteria.Op.NEQ);
|
||||
FreeIpSearch.and("taken", FreeIpSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
|
||||
FreeIpSearch.done();
|
||||
|
||||
|
||||
@ -18,26 +18,24 @@
|
||||
|
||||
package com.cloud.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="domain")
|
||||
public class DomainVO {
|
||||
public static final long ROOT_DOMAIN = 1L;
|
||||
|
||||
public class DomainVO implements Domain {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private Long id = null;
|
||||
private long id;
|
||||
|
||||
@Column(name="parent")
|
||||
private Long parent = null;
|
||||
@ -46,13 +44,13 @@ public class DomainVO {
|
||||
private String name = null;
|
||||
|
||||
@Column(name="owner")
|
||||
private Long owner = null;
|
||||
private long accountId;
|
||||
|
||||
@Column(name="path")
|
||||
private String path = null;
|
||||
|
||||
@Column(name="level")
|
||||
private Integer level = null;
|
||||
private int level;
|
||||
|
||||
@Column(name=GenericDao.REMOVED_COLUMN)
|
||||
private Date removed;
|
||||
@ -65,15 +63,15 @@ public class DomainVO {
|
||||
|
||||
public DomainVO() {}
|
||||
|
||||
public DomainVO(String name, Long owner, Long parentId) {
|
||||
public DomainVO(String name, long owner, Long parentId) {
|
||||
this.parent = parentId;
|
||||
this.name = name;
|
||||
this.owner = owner;
|
||||
this.accountId = owner;
|
||||
this.path ="";
|
||||
this.level = 0;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -100,8 +98,8 @@ public class DomainVO {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getOwner() {
|
||||
return owner;
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public Date getRemoved() {
|
||||
@ -116,11 +114,11 @@ public class DomainVO {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
||||
DomainVO d1 = domainPair.get(0);
|
||||
DomainVO d2 = domainPair.get(1);
|
||||
|
||||
if (d1.getId().equals(parentId)) {
|
||||
if (d1.getId() == parentId) {
|
||||
result = d2.getPath().startsWith(d1.getPath());
|
||||
} else {
|
||||
result = d1.getPath().startsWith(d2.getPath());
|
||||
|
||||
@ -18,24 +18,27 @@
|
||||
|
||||
package com.cloud.network;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.SecondaryTable;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.SecondaryTable;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.domain.PartOf;
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
@Entity
|
||||
@Table(name=("security_group"))
|
||||
@SecondaryTable(name="account",
|
||||
pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
|
||||
public class SecurityGroupVO {
|
||||
public class SecurityGroupVO implements PartOf, OwnedBy {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private Long id;
|
||||
private long id;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
@ -44,24 +47,24 @@ public class SecurityGroupVO {
|
||||
private String description;
|
||||
|
||||
@Column(name="domain_id")
|
||||
private Long domainId;
|
||||
private long domainId;
|
||||
|
||||
@Column(name="account_id")
|
||||
private Long accountId;
|
||||
private long accountId;
|
||||
|
||||
@Column(name="account_name", table="account", insertable=false, updatable=false)
|
||||
private String accountName = null;
|
||||
|
||||
public SecurityGroupVO() {}
|
||||
|
||||
public SecurityGroupVO(String name, String description, Long domainId, Long accountId) {
|
||||
public SecurityGroupVO(String name, String description, long domainId, long accountId) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.domainId = domainId;
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -73,11 +76,11 @@ public class SecurityGroupVO {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
|
||||
@ -18,22 +18,23 @@
|
||||
|
||||
package com.cloud.network.security;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.SecondaryTable;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.domain.PartOf;
|
||||
import com.cloud.user.OwnedBy;
|
||||
|
||||
@Entity
|
||||
@Table(name=("network_group"))
|
||||
public class NetworkGroupVO {
|
||||
public class NetworkGroupVO implements PartOf, OwnedBy {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private Long id;
|
||||
private long id;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
@ -42,17 +43,17 @@ public class NetworkGroupVO {
|
||||
private String description;
|
||||
|
||||
@Column(name="domain_id")
|
||||
private Long domainId;
|
||||
private long domainId;
|
||||
|
||||
@Column(name="account_id")
|
||||
private Long accountId;
|
||||
private long accountId;
|
||||
|
||||
@Column(name="account_name")
|
||||
private String accountName = null;
|
||||
|
||||
public NetworkGroupVO() {}
|
||||
|
||||
public NetworkGroupVO(String name, String description, Long domainId, Long accountId, String accountName) {
|
||||
public NetworkGroupVO(String name, String description, long domainId, long accountId, String accountName) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.domainId = domainId;
|
||||
@ -60,7 +61,7 @@ public class NetworkGroupVO {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -72,11 +73,11 @@ public class NetworkGroupVO {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
package com.cloud.resource;
|
||||
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
|
||||
@ -29,15 +29,15 @@ import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.configuration.ResourceLimitVO;
|
||||
import com.cloud.configuration.ResourceCount.ResourceType;
|
||||
import com.cloud.configuration.ResourceLimitVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
@ -72,7 +72,6 @@ import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.SnapshotScheduleVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.StorageStats;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
@ -1521,9 +1520,9 @@ public interface ManagementServer {
|
||||
* in a Criteria object.
|
||||
* @return list of domains owned by the given user
|
||||
*/
|
||||
List<DomainVO> searchForDomains(Criteria c);
|
||||
List<? extends Domain> searchForDomains(Criteria c);
|
||||
|
||||
List<DomainVO> searchForDomainChildren(Criteria c);
|
||||
List<? extends Domain> searchForDomainChildren(Criteria c);
|
||||
|
||||
/**
|
||||
* create a new domain
|
||||
@ -1533,7 +1532,7 @@ public interface ManagementServer {
|
||||
* @param parentId
|
||||
*
|
||||
*/
|
||||
DomainVO createDomain(String name, Long ownerId, Long parentId);
|
||||
Domain createDomain(String name, Long ownerId, Long parentId);
|
||||
|
||||
/**
|
||||
* delete a domain with the given domainId
|
||||
@ -1560,14 +1559,14 @@ public interface ManagementServer {
|
||||
* find the domain by id
|
||||
* @param domainId the id of the domainId
|
||||
*/
|
||||
DomainVO findDomainIdById(Long domainId);
|
||||
Domain findDomainIdById(Long domainId);
|
||||
|
||||
/**
|
||||
* find the domain by its path
|
||||
* @param domainPath the path to use to lookup a domain
|
||||
* @return domainVO the domain with the matching path, or null if no domain with the given path exists
|
||||
* @return Domain the domain with the matching path, or null if no domain with the given path exists
|
||||
*/
|
||||
DomainVO findDomainByPath(String domainPath);
|
||||
Domain findDomainByPath(String domainPath);
|
||||
|
||||
/**
|
||||
* Finds accounts with account identifiers similar to the parameter
|
||||
|
||||
@ -37,6 +37,7 @@ import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@Entity
|
||||
@Table(name="vm_template")
|
||||
|
||||
@ -185,7 +185,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||
String accountId = null;
|
||||
if (account != null) {
|
||||
accountType = account.getType();
|
||||
accountId = account.getId().toString();
|
||||
accountId = Long.toString(account.getId());
|
||||
} else {
|
||||
accountType = Account.ACCOUNT_TYPE_ADMIN;
|
||||
}
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
|
||||
package com.cloud.user;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@ -35,7 +35,7 @@ public class AccountVO implements Account {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private Long id = null;
|
||||
private long id;
|
||||
|
||||
@Column(name="account_name")
|
||||
private String accountName = null;
|
||||
@ -44,7 +44,7 @@ public class AccountVO implements Account {
|
||||
private short type = ACCOUNT_TYPE_NORMAL;
|
||||
|
||||
@Column(name="domain_id")
|
||||
private Long domainId = null;
|
||||
private long domainId;
|
||||
|
||||
@Column(name="state")
|
||||
private String state;
|
||||
@ -56,7 +56,7 @@ public class AccountVO implements Account {
|
||||
private boolean needsCleanup = false;
|
||||
|
||||
public AccountVO() {}
|
||||
public AccountVO(Long id) {
|
||||
public AccountVO(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -67,8 +67,9 @@ public class AccountVO implements Account {
|
||||
public boolean getNeedsCleanup() {
|
||||
return needsCleanup;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -85,10 +86,11 @@ public class AccountVO implements Account {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
public void setDomainId(Long domainId) {
|
||||
}
|
||||
|
||||
public void setDomainId(long domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
|
||||
package com.cloud.user;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Date;
|
||||
|
||||
public interface User {
|
||||
public interface User extends OwnedBy {
|
||||
public static final long UID_SYSTEM = 1;
|
||||
|
||||
public Long getId();
|
||||
@ -45,8 +45,6 @@ public interface User {
|
||||
|
||||
public void setLastname(String lastname);
|
||||
|
||||
public long getAccountId();
|
||||
|
||||
public void setAccountId(long accountId);
|
||||
|
||||
public String getEmail();
|
||||
|
||||
@ -36,8 +36,8 @@ import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
@Local(value={AccountDao.class})
|
||||
public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements AccountDao {
|
||||
@ -94,7 +94,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
||||
u.setSecretKey(rs.getString(4));
|
||||
u.setState(rs.getString(5));
|
||||
|
||||
Account a = new AccountVO(rs.getLong(6));
|
||||
AccountVO a = new AccountVO(rs.getLong(6));
|
||||
a.setAccountName(rs.getString(7));
|
||||
a.setType(rs.getShort(8));
|
||||
a.setDomainId(rs.getLong(9));
|
||||
|
||||
@ -20,6 +20,7 @@ vmops=..,0755,/etc/xapi.d/plugins
|
||||
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
|
||||
systemvm-premium.zip=../../../../../vms,0755,/opt/xensource/bin
|
||||
hostvmstats.py=..,0755,/opt/xensource/sm
|
||||
xs_cleanup.sh=..,0755,/opt/xensource/bin
|
||||
network_info.sh=..,0755,/opt/xensource/bin
|
||||
prepsystemvm.sh=..,0755,/opt/xensource/bin
|
||||
setupxenserver.sh=..,0755,/opt/xensource/bin
|
||||
|
||||
@ -116,7 +116,6 @@ import com.cloud.storage.Storage.StorageResourceType;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
@ -124,6 +123,7 @@ import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.resource.DummySecondaryStorageResource;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.dao.UserStatisticsDao;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.ActionDelegate;
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.Set;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@ import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.offering.ServiceOffering.GuestIpType;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.VirtualMachineTemplate;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.dao.VMTemplatePoolDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -76,6 +76,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.maid.StackMaid;
|
||||
import com.cloud.server.ManagementServer;
|
||||
@ -402,7 +403,7 @@ public class ApiServer implements HttpRequestHandler {
|
||||
if (account.getType() == Account.ACCOUNT_TYPE_NORMAL) {
|
||||
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
||||
requestParameters.put(BaseCmd.Properties.ACCOUNT.getName(), new String[] { account.getAccountName() });
|
||||
requestParameters.put(BaseCmd.Properties.DOMAIN_ID.getName(), new String[] { account.getDomainId().toString() });
|
||||
requestParameters.put(BaseCmd.Properties.DOMAIN_ID.getName(), new String[] { Long.toString(account.getDomainId()) });
|
||||
requestParameters.put(BaseCmd.Properties.ACCOUNT_OBJ.getName(), new Object[] { account });
|
||||
} else {
|
||||
requestParameters.put(BaseCmd.Properties.USER_ID.getName(), new String[] { user.getId().toString() });
|
||||
@ -446,7 +447,7 @@ public class ApiServer implements HttpRequestHandler {
|
||||
if (domainPath == null || domainPath.trim().length() == 0) {
|
||||
domainId = DomainVO.ROOT_DOMAIN;
|
||||
} else {
|
||||
DomainVO domainObj = _ms.findDomainByPath(domainPath);
|
||||
Domain domainObj = _ms.findDomainByPath(domainPath);
|
||||
if (domainObj != null) {
|
||||
domainId = domainObj.getId();
|
||||
} else { // if an unknown path is passed in, fail the login call
|
||||
@ -501,7 +502,7 @@ public class ApiServer implements HttpRequestHandler {
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.LASTNAME.getName(), userAcct.getLastname()));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT_OBJ.getName(), account));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), account.getAccountName()));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), account.getDomainId().toString()));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), Long.toString(account.getDomainId())));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.TYPE.getName(), Short.valueOf(account.getType()).toString()));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.NETWORK_TYPE.getName(), networkType));
|
||||
loginParams.add(new Pair<String, Object>(BaseCmd.Properties.HYPERVISOR_TYPE.getName(), hypervisorType));
|
||||
|
||||
@ -877,7 +877,7 @@ public abstract class BaseCmd {
|
||||
Account account = getAccount(params);
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != targetAccountId) {
|
||||
if (account.getId() != targetAccountId) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find a " + targetDesc + " with id " + targetId + " for this account");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), targetDomainId)) {
|
||||
|
||||
@ -75,6 +75,13 @@ public class AddHostCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Can't specify cluster by both id and name");
|
||||
}
|
||||
|
||||
if (clusterName == null && clusterId == null) {
|
||||
// Stand alone, assign a name to it
|
||||
String[] stringarray = url.split("//");
|
||||
String address = stringarray[stringarray.length - 1];
|
||||
clusterName = "Standalone-" + address;
|
||||
}
|
||||
|
||||
if ((clusterName != null || clusterId != null) && podId == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Can't specify cluster without specifying the pod");
|
||||
}
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -98,7 +98,7 @@ public class AssignPortForwardingServiceCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to apply port forwarding services " + StringUtils.join(sgIdList, ",") + " to instance " + vmId + ". Invalid list of port forwarding services for the given instance.");
|
||||
}
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != validatedAccountId.longValue())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != validatedAccountId.longValue())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Permission denied applying port forwarding services " + StringUtils.join(sgIdList, ",") + " to instance " + vmId + ".");
|
||||
} else {
|
||||
Account validatedAccount = getManagementServer().findAccountById(validatedAccountId);
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
@ -97,7 +97,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseCmd {
|
||||
if (loadBalancer == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find load balancer rule, with id " + loadBalancerId);
|
||||
} else if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (loadBalancer.getAccountId() != account.getId().longValue())) {
|
||||
if (!isAdmin(account.getType()) && (loadBalancer.getAccountId() != account.getId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName() +
|
||||
" (id:" + loadBalancer.getId() + ")");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), loadBalancer.getDomainId())) {
|
||||
|
||||
@ -73,10 +73,10 @@ public class AttachIsoCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != vmInstanceCheck.getAccountId()) {
|
||||
if (account.getId() != vmInstanceCheck.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName() + " for this account");
|
||||
}
|
||||
if (!iso.isPublicTemplate() && (account.getId().longValue() != iso.getAccountId()) && (!iso.getName().startsWith("xs-tools"))) {
|
||||
if (!iso.isPublicTemplate() && (account.getId() != iso.getAccountId()) && (!iso.getName().startsWith("xs-tools"))) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to attach ISO " + iso.getName() + " to virtual machine " + vmInstanceCheck.getName() + " for this account");
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -90,10 +90,10 @@ public class AttachVolumeCmd extends BaseCmd {
|
||||
// If the account is not an admin, check that the volume and the virtual machine are owned by the account that was passed in
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != volume.getAccountId())
|
||||
if (account.getId() != volume.getAccountId())
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find volume with ID: " + volumeId + " for account: " + account.getAccountName());
|
||||
|
||||
if (account.getId().longValue() != vm.getAccountId())
|
||||
if (account.getId() != vm.getAccountId())
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find VM with ID: " + vmId + " for account: " + account.getAccountName());
|
||||
} else {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), volume.getDomainId()) ||
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -63,9 +63,9 @@ public class CreateDomainCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (parentDomainId == null){
|
||||
parentDomainId = DomainVO.ROOT_DOMAIN;
|
||||
parentDomainId = Domain.ROOT_DOMAIN;
|
||||
} else {
|
||||
DomainVO parentDomain = null;
|
||||
Domain parentDomain = null;
|
||||
parentDomain = getManagementServer().findDomainIdById(parentDomainId);
|
||||
if (parentDomain == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find parent domain " + parentDomainId);
|
||||
@ -76,7 +76,7 @@ public class CreateDomainCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Invalid parent domain " + parentDomainId + ", unable to create domain " + name);
|
||||
}
|
||||
|
||||
DomainVO domain = null;
|
||||
Domain domain = null;
|
||||
try {
|
||||
domain = getManagementServer().createDomain(name, account.getId(), parentDomainId);
|
||||
} catch (IllegalArgumentException illArgEx) {
|
||||
@ -96,7 +96,7 @@ public class CreateDomainCmd extends BaseCmd {
|
||||
} else {
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), domain.getId()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), domain.getName()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), domain.getLevel().toString()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), Integer.toString(domain.getLevel())));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.PARENT_DOMAIN_ID.getName(), domain.getParent().toString()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.PARENT_DOMAIN_NAME.getName(),
|
||||
getManagementServer().findDomainIdById(domain.getParent()).getName()));
|
||||
|
||||
@ -98,7 +98,7 @@ public class CreateIPForwardingRuleCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), vmOwner.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to create port forwarding rule, IP address " + ipAddress + " to virtual machine " + vmId + ", permission denied.");
|
||||
}
|
||||
} else if (account.getId().longValue() != userVM.getAccountId()) {
|
||||
} else if (account.getId() != userVM.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to create port forwarding rule, IP address " + ipAddress + " to virtual machine " + vmId + ", permission denied.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
@ -102,7 +102,7 @@ public class CreateLoadBalancerRuleCmd extends BaseCmd {
|
||||
Long accountId = accountByIp.getId();
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != accountId.longValue()) {
|
||||
if (account.getId() != accountId.longValue()) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to create load balancer rule, account " + account.getAccountName() + " doesn't own ip address " + publicIP);
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), accountByIp.getDomainId())) {
|
||||
|
||||
@ -110,7 +110,7 @@ public class CreateNetworkGroupCmd extends BaseCmd {
|
||||
List<Pair<String, Object>> embeddedObject = new ArrayList<Pair<String, Object>>();
|
||||
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), networkGroup.getId().toString()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.toString(networkGroup.getId())));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), networkGroup.getName()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.DESCRIPTION.getName(), networkGroup.getDescription()));
|
||||
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.network.SecurityGroupVO;
|
||||
@ -107,7 +107,7 @@ public class CreatePortForwardingServiceCmd extends BaseCmd {
|
||||
List<Pair<String, Object>> embeddedObject = new ArrayList<Pair<String, Object>>();
|
||||
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), securityGroup.getId().toString()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.toString(securityGroup.getId())));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), securityGroup.getName()));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.DESCRIPTION.getName(), securityGroup.getDescription()));
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ public class CreatePortForwardingServiceRuleCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), sg.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to find rules for port forwarding service id = " + securityGroupId + ", permission denied.");
|
||||
}
|
||||
} else if (account.getId().longValue() != sg.getAccountId().longValue()) {
|
||||
} else if (account.getId() != sg.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Invalid port forwarding service (" + securityGroupId + ") given, unable to create rule.");
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class CreatePortForwardingServiceRuleCmd extends BaseCmd {
|
||||
userId = Long.valueOf(1);
|
||||
}
|
||||
|
||||
long jobId = getManagementServer().createOrUpdateRuleAsync(true, userId.longValue(), sg.getAccountId().longValue(), null, securityGroupId, null, publicPort, null, privatePort, protocol, null);
|
||||
long jobId = getManagementServer().createOrUpdateRuleAsync(true, userId.longValue(), sg.getAccountId(), null, securityGroupId, null, publicPort, null, privatePort, protocol, null);
|
||||
long ruleId = 0;
|
||||
|
||||
if (jobId == 0) {
|
||||
|
||||
@ -26,8 +26,6 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.executor.CreatePrivateTemplateResultObject;
|
||||
import com.cloud.serializer.SerializerHelper;
|
||||
import com.cloud.server.Criteria;
|
||||
@ -111,7 +109,7 @@ public class CreateTemplateCmd extends BaseCmd {
|
||||
|
||||
boolean isAdmin = ((account == null) || isAdmin(account.getType()));
|
||||
if (!isAdmin) {
|
||||
if (account.getId().longValue() != volume.getAccountId()) {
|
||||
if (account.getId() != volume.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "unable to find a volume with id " + volumeId + " for this account");
|
||||
}
|
||||
} else if ((account != null) && !getManagementServer().isChildDomain(account.getDomainId(), volume.getDomainId())) {
|
||||
|
||||
@ -165,7 +165,7 @@ public class CreateVolumeCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), snapshotOwner.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to create volume from snapshot with id " + snapshotId + ", permission denied.");
|
||||
}
|
||||
} else if (account.getId().longValue() != snapshotCheck.getAccountId()) {
|
||||
} else if (account.getId() != snapshotCheck.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.SNAPSHOT_INVALID_PARAM_ERROR, "unable to find a snapshot with id " + snapshotId + " for this account");
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -61,12 +61,12 @@ public class DeleteDomainCmd extends BaseCmd{
|
||||
account = getManagementServer().findAccountById(Long.valueOf(1L));
|
||||
}
|
||||
|
||||
if ((domainId.longValue() == DomainVO.ROOT_DOMAIN) || !getManagementServer().isChildDomain(account.getDomainId(), domainId)) {
|
||||
if ((domainId.longValue() == Domain.ROOT_DOMAIN) || !getManagementServer().isChildDomain(account.getDomainId(), domainId)) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to delete domain " + domainId + ", permission denied.");
|
||||
}
|
||||
|
||||
// check if domain exists in the system
|
||||
DomainVO domain = getManagementServer().findDomainIdById(domainId);
|
||||
Domain domain = getManagementServer().findDomainIdById(domainId);
|
||||
if (domain == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find domain " + domainId);
|
||||
}
|
||||
|
||||
@ -18,22 +18,22 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.network.FirewallRuleVO;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.network.FirewallRuleVO;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public class DeleteIPForwardingRuleCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteIPForwardingRuleCmd.class.getName());
|
||||
@ -85,13 +85,13 @@ public class DeleteIPForwardingRuleCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), ruleOwner.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to delete port forwarding rule " + ruleId + ", permission denied.");
|
||||
}
|
||||
} else if (account.getId().longValue() != ruleOwner.getId().longValue()) {
|
||||
} else if (account.getId() != ruleOwner.getId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to delete port forwarding rule " + ruleId + ", permission denied.");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
getManagementServer().deleteRule(ruleId.longValue(), userId.longValue(), ruleOwner.getId().longValue());
|
||||
getManagementServer().deleteRule(ruleId.longValue(), userId.longValue(), ruleOwner.getId());
|
||||
} catch (InvalidParameterValueException ex1) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to delete port forwarding rule " + ruleId + ", internal error.");
|
||||
} catch (PermissionDeniedException ex2) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
@ -74,7 +74,7 @@ public class DeleteIsoCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (iso.getAccountId() != account.getId().longValue()) {
|
||||
if (iso.getAccountId() != account.getId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to delete ISO with id " + isoId);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
@ -64,7 +64,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find load balancer rule, with id " + loadBalancerId);
|
||||
} else if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (loadBalancer.getAccountId() != account.getId().longValue()) {
|
||||
if (loadBalancer.getAccountId() != account.getId()) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName() + " (id:" + loadBalancerId + ")");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), loadBalancer.getDomainId())) {
|
||||
|
||||
@ -68,7 +68,7 @@ public class DeletePortForwardingServiceCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != sg.getAccountId()) {
|
||||
if (account.getId() != sg.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "unable to find a port forwarding service with id " + id + " for this account");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), sg.getDomainId())) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -64,7 +64,7 @@ public class DestroyVMCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != vmInstance.getAccountId()) {
|
||||
if (account.getId() != vmInstance.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + "for this account");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -66,7 +66,7 @@ public class DetachIsoCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != vmInstanceCheck.getAccountId()) {
|
||||
if (account.getId() != vmInstanceCheck.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to detach ISO from virtual machine " + vmInstanceCheck.getName() + " for this account");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstanceCheck.getDomainId())) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -66,11 +66,11 @@ public class DisableAccountCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
// don't allow modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not disable system account");
|
||||
}
|
||||
|
||||
long jobId = getManagementServer().disableAccountAsync(account.getId().longValue());
|
||||
long jobId = getManagementServer().disableAccountAsync(account.getId());
|
||||
if (jobId == 0) {
|
||||
s_logger.warn("Unable to schedule async-job for DisableAccount comamnd");
|
||||
} else {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -65,7 +65,7 @@ public class DisableUserCmd extends BaseCmd {
|
||||
|
||||
// If the user is a System user, return an error. We do not allow this
|
||||
Account account = getManagementServer().findAccountById(user.getAccountId());
|
||||
if ((account != null) && (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM)) {
|
||||
if ((account != null) && (account.getId() == Account.ACCOUNT_ID_SYSTEM)) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "user id : " + id + " is a system user, disabling is not allowed");
|
||||
}
|
||||
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
@ -66,7 +66,7 @@ public class DisassociateIPAddrCmd extends BaseCmd {
|
||||
Long accountId = accountByIp.getId();
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != accountId.longValue()) {
|
||||
if (account.getId() != accountId.longValue()) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "account " + account.getAccountName() + " doesn't own ip address " + ipAddress);
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), accountByIp.getDomainId())) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -67,13 +67,13 @@ public class EnableAccountCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
// don't allow modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not enable system account");
|
||||
}
|
||||
|
||||
boolean success = true;
|
||||
try {
|
||||
success = getManagementServer().enableAccount(account.getId().longValue());
|
||||
success = getManagementServer().enableAccount(account.getId());
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("error enabling account " + accountName + " in domain " + domainId, ex);
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error enabling account " + accountName + " in domain " + domainId);
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.configuration.ResourceCount.ResourceType;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountVO;
|
||||
@ -84,7 +84,7 @@ public class ListAccountsCmd extends BaseCmd{
|
||||
isAdmin = true;
|
||||
if (domainId == null) {
|
||||
// default domainId to the admin's domain
|
||||
domainId = ((account == null) ? DomainVO.ROOT_DOMAIN : account.getDomainId());
|
||||
domainId = ((account == null) ? Domain.ROOT_DOMAIN : account.getDomainId());
|
||||
} else if (account != null) {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), domainId)) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid domain id (" + domainId + ") given, unable to list accounts");
|
||||
@ -135,8 +135,8 @@ public class ListAccountsCmd extends BaseCmd{
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(accountO.getId()).toString()));
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), accountO.getAccountName()));
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT_TYPE.getName(), Short.valueOf(accountO.getType()).toString()));
|
||||
DomainVO domain = getManagementServer().findDomainIdById(accountO.getDomainId());
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), domain.getId().toString()));
|
||||
Domain domain = getManagementServer().findDomainIdById(accountO.getDomainId());
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), Long.toString(domain.getId())));
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), domain.getName()));
|
||||
|
||||
//get network stat
|
||||
|
||||
@ -26,7 +26,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -101,16 +101,16 @@ public class ListDomainChildrenCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
// TODO : Recursive listing is not supported yet
|
||||
List<DomainVO> domains = getManagementServer().searchForDomainChildren(c);
|
||||
List<? extends Domain> domains = getManagementServer().searchForDomainChildren(c);
|
||||
|
||||
List<Pair<String, Object>> domainTags = new ArrayList<Pair<String, Object>>();
|
||||
Object[] dTag = new Object[domains.size()];
|
||||
int i = 0;
|
||||
for (DomainVO domain : domains) {
|
||||
for (Domain domain : domains) {
|
||||
List<Pair<String, Object>> domainData = new ArrayList<Pair<String, Object>>();
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(domain.getId()).toString()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), domain.getName()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), domain.getLevel().toString()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), Integer.toString(domain.getLevel())));
|
||||
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.HAS_CHILD.getName(),
|
||||
(domain.getChildCount()) > 0 ? "true" : "false"));
|
||||
|
||||
@ -26,7 +26,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -95,16 +95,16 @@ public class ListDomainsCmd extends BaseCmd {
|
||||
c.addCriteria(Criteria.LEVEL, level);
|
||||
}
|
||||
|
||||
List<DomainVO> domains = getManagementServer().searchForDomains(c);
|
||||
List<? extends Domain> domains = getManagementServer().searchForDomains(c);
|
||||
|
||||
List<Pair<String, Object>> domainTags = new ArrayList<Pair<String, Object>>();
|
||||
Object[] dTag = new Object[domains.size()];
|
||||
int i = 0;
|
||||
for (DomainVO domain : domains) {
|
||||
for (Domain domain : domains) {
|
||||
List<Pair<String, Object>> domainData = new ArrayList<Pair<String, Object>>();
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(domain.getId()).toString()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), domain.getName()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), domain.getLevel().toString()));
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.LEVEL.getName(), Integer.toString(domain.getLevel())));
|
||||
|
||||
if (domain.getParent() != null){
|
||||
domainData.add(new Pair<String, Object>(BaseCmd.Properties.PARENT_DOMAIN_ID.getName(), domain.getParent().toString()));
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
@ -165,7 +165,7 @@ public class ListEventsCmd extends BaseCmd {
|
||||
Account acct = getManagementServer().findAccountById(Long.valueOf(event.getAccountId()));
|
||||
if (acct != null) {
|
||||
eventData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), acct.getAccountName()));
|
||||
eventData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), acct.getDomainId().toString()));
|
||||
eventData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), Long.toString(acct.getDomainId())));
|
||||
eventData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(acct.getDomainId()).getName()));
|
||||
}
|
||||
if (event.getCreateDate() != null) {
|
||||
|
||||
@ -33,8 +33,8 @@ import com.cloud.domain.DomainVO;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao.TemplateFilter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -216,7 +216,7 @@ public class ListIsosCmd extends BaseCmd {
|
||||
isoData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), datacenter.getName()));
|
||||
|
||||
// If the user is an admin, add the template download status
|
||||
if (isAdmin || account.getId().longValue() == iso.getAccountId()) {
|
||||
if (isAdmin || account.getId() == iso.getAccountId()) {
|
||||
// add download status
|
||||
if (isoHost.getDownloadState()!=Status.DOWNLOADED) {
|
||||
String isoStatus = "Processing";
|
||||
|
||||
@ -74,7 +74,7 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), userAccount.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid load balancer rule id (" + loadBalancerId + ") given, unable to list instances.");
|
||||
}
|
||||
} else if (account.getId().longValue() != lbAcctId) {
|
||||
} else if (account.getId() != lbAcctId) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class ListNetworkGroupsCmd extends BaseCmd {
|
||||
|
||||
if (account != null) {
|
||||
// check that the user is the owner of the VM (admin case was already verified
|
||||
if (account.getId().longValue() != userVM.getAccountId()) {
|
||||
if (account.getId() != userVM.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to list network groups for virtual machine instance " + vmId + "; permission denied.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class ListPortForwardingRulesCmd extends BaseCmd {
|
||||
}
|
||||
} else {
|
||||
if (account != null) {
|
||||
if ((ipAddressVO.getAccountId() == null) || (account.getId().longValue() != ipAddressVO.getAccountId().longValue())) {
|
||||
if ((ipAddressVO.getAccountId() == null) || (account.getId() != ipAddressVO.getAccountId().longValue())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to list port forwarding rules for address " + ipAddress + ", permission denied for account " + account.getId());
|
||||
}
|
||||
addrOwner = account;
|
||||
|
||||
@ -85,7 +85,7 @@ public class ListPortForwardingServiceRulesCmd extends BaseCmd {
|
||||
if ((groupId != null) && (accountId != null)) {
|
||||
SecurityGroupVO sg = getManagementServer().findSecurityGroupById(groupId);
|
||||
if (sg != null) {
|
||||
if ((sg.getAccountId() != null) && sg.getAccountId().longValue() != accountId.longValue()) {
|
||||
if (sg.getAccountId() != accountId.longValue()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to list port forwarding service rules, account " + accountId + " does not own port forwarding service " + groupId);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.storage.SnapshotScheduleVO;
|
||||
@ -65,7 +65,7 @@ public class ListRecurringSnapshotScheduleCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), userAccount.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid volume id (" + volumeId + ") given, unable to list snapshots.");
|
||||
}
|
||||
} else if (account.getId().longValue() != volAcctId) {
|
||||
} else if (account.getId() != volAcctId) {
|
||||
throw new ServerApiException(BaseCmd.SNAPSHOT_INVALID_PARAM_ERROR, "account " + account.getAccountName() + " does not own volume id " + volAcctId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class ListServiceOfferingsCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
|
||||
}
|
||||
if ((account != null) && !isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != vmInstance.getAccountId()) {
|
||||
if (account.getId() != vmInstance.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,9 +30,9 @@ import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Snapshot.SnapshotType;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.Snapshot.SnapshotType;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -141,7 +141,7 @@ public class ListSnapshotsCmd extends BaseCmd {
|
||||
Account acct = getManagementServer().findAccountById(Long.valueOf(snapshot.getAccountId()));
|
||||
if (acct != null) {
|
||||
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), acct.getAccountName()));
|
||||
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), acct.getDomainId().toString()));
|
||||
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), Long.toString(acct.getDomainId())));
|
||||
snapshotData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(acct.getDomainId()).getName()));
|
||||
}
|
||||
volumeId = snapshot.getVolumeId();
|
||||
|
||||
@ -8,7 +8,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -86,9 +86,9 @@ public class ListTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
if (account.getType() == Account.ACCOUNT_TYPE_NORMAL && template.getAccountId() != accountId) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "unable to list permissions for " + getMediaType() + " with id " + id);
|
||||
} else if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) {
|
||||
DomainVO accountDomain = getManagementServer().findDomainIdById(account.getDomainId());
|
||||
Domain accountDomain = getManagementServer().findDomainIdById(account.getDomainId());
|
||||
Account templateAccount = getManagementServer().findAccountById(template.getAccountId());
|
||||
DomainVO templateDomain = getManagementServer().findDomainIdById(templateAccount.getDomainId());
|
||||
Domain templateDomain = getManagementServer().findDomainIdById(templateAccount.getDomainId());
|
||||
if (!templateDomain.getPath().contains(accountDomain.getPath())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "unable to list permissions for " + getMediaType() + " with id " + id);
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao.TemplateFilter;
|
||||
import com.cloud.storage.template.TemplateConstants;
|
||||
import com.cloud.user.Account;
|
||||
@ -196,7 +196,7 @@ public class ListTemplatesCmd extends BaseCmd {
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.ZONE_NAME.getName(), datacenter.getName()));
|
||||
|
||||
// If the user is an admin, add the template download status
|
||||
if (isAdmin || account.getId().longValue() == template.getAccountId()) {
|
||||
if (isAdmin || account.getId() == template.getAccountId()) {
|
||||
// add download status
|
||||
if (templateHostRef.getDownloadState()!=Status.DOWNLOADED) {
|
||||
String templateStatus = "Processing";
|
||||
|
||||
@ -185,7 +185,7 @@ public class ListVMsCmd extends BaseCmd {
|
||||
Account acct = getManagementServer().findAccountById(Long.valueOf(vmInstance.getAccountId()));
|
||||
if (acct != null) {
|
||||
vmData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), acct.getAccountName()));
|
||||
vmData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), acct.getDomainId().toString()));
|
||||
vmData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), Long.toString(acct.getDomainId())));
|
||||
vmData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(acct.getDomainId()).getName()));
|
||||
}
|
||||
vmData.add(new Pair<String, Object>(BaseCmd.Properties.HA_ENABLE.getName(), Boolean.valueOf(vmInstance.isHaEnabled()).toString()));
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
@ -62,7 +62,7 @@ public class ListZonesByCmd extends BaseCmd {
|
||||
if (available != null && available) {
|
||||
dataCenters = getManagementServer().listDataCenters();
|
||||
} else {
|
||||
dataCenters = getManagementServer().listDataCentersBy(account.getId().longValue());
|
||||
dataCenters = getManagementServer().listDataCentersBy(account.getId());
|
||||
}
|
||||
} else {
|
||||
// available is kinda useless in this case because we can't exactly list by
|
||||
|
||||
@ -17,16 +17,16 @@
|
||||
*/
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public class LockAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
|
||||
@ -63,11 +63,11 @@ public class LockAccountCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
// don't allow modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not lock system account");
|
||||
}
|
||||
|
||||
boolean success = getManagementServer().lockAccount(account.getId().longValue());
|
||||
boolean success = getManagementServer().lockAccount(account.getId());
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), Boolean.valueOf(success).toString()));
|
||||
return returnValues;
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -62,7 +62,7 @@ public class RebootVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
// the domain in which the VM lives is not in the admin's domain tree
|
||||
|
||||
@ -27,11 +27,11 @@ import org.apache.log4j.Logger;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Storage.FileSystem;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -86,7 +86,7 @@ public class RegisterIsoCmd extends BaseCmd {
|
||||
|
||||
long accountId = 1L; // default to system account
|
||||
if (account != null) {
|
||||
accountId = account.getId().longValue();
|
||||
accountId = account.getId();
|
||||
}
|
||||
|
||||
Account accountObj;
|
||||
|
||||
@ -105,7 +105,7 @@ public class RegisterTemplateCmd extends BaseCmd {
|
||||
|
||||
long accountId = 1L; // default to system account
|
||||
if (account != null) {
|
||||
accountId = account.getId().longValue();
|
||||
accountId = account.getId();
|
||||
}
|
||||
|
||||
Account accountObj;
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
@ -92,7 +92,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseCmd {
|
||||
if (loadBalancer == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find load balancer rule with id " + loadBalancerId);
|
||||
} else if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (loadBalancer.getAccountId() != account.getId().longValue())) {
|
||||
if (!isAdmin(account.getType()) && (loadBalancer.getAccountId() != account.getId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName() +
|
||||
" (id:" + loadBalancer.getId() + ")");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), loadBalancer.getDomainId())) {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.network.SecurityGroupVO;
|
||||
@ -66,7 +66,7 @@ public class RemovePortForwardingServiceCmd extends BaseCmd {
|
||||
if (securityG == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find a port forwarding service with id " + securityGroupId);
|
||||
} else if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != securityG.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != securityG.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find a port forwarding service with id " + securityGroupId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), securityG.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid port forwarding service id (" + securityGroupId + ") given, unable to remove port forwarding service.");
|
||||
@ -78,7 +78,7 @@ public class RemovePortForwardingServiceCmd extends BaseCmd {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
|
||||
}
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to remove port forwarding service.");
|
||||
@ -96,7 +96,7 @@ public class RemovePortForwardingServiceCmd extends BaseCmd {
|
||||
|
||||
Long accountId = ipAddrAccount.getId();
|
||||
if ((account != null) && !isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != accountId) {
|
||||
if (account.getId() != accountId) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "account " + account.getAccountName() + " doesn't own ip address " + publicIp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
@ -65,7 +65,7 @@ public class ResetVMPasswordCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to reset password.");
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -72,7 +72,7 @@ public class StartVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstanceCheck.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstanceCheck.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstanceCheck.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to start virtual machine.");
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -63,7 +63,7 @@ public class StopVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to sop virtual machine.");
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -70,7 +70,7 @@ public class UpdateAccountCmd extends BaseCmd{
|
||||
}
|
||||
|
||||
// don't allow modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not modify system account");
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@ -58,7 +58,7 @@ public class UpdateDomainCmd extends BaseCmd{
|
||||
Boolean editDomainResult = false;
|
||||
|
||||
//check if domain exists in the system
|
||||
DomainVO domain = getManagementServer().findDomainIdById(domainId);
|
||||
Domain domain = getManagementServer().findDomainIdById(domainId);
|
||||
if (domain == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find domain " + domainId);
|
||||
} else if (domain.getParent() == null) {
|
||||
|
||||
@ -103,7 +103,7 @@ public class UpdateIPForwardingRuleCmd extends BaseCmd {
|
||||
if (!getManagementServer().isChildDomain(account.getDomainId(), ipAddressVO.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update port forwarding rule on IP address " + publicIp + ", permission denied.");
|
||||
}
|
||||
} else if (account.getId().longValue() != ipAddressVO.getAccountId()) {
|
||||
} else if (account.getId() != ipAddressVO.getAccountId()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update port forwarding rule on IP address " + publicIp + ", permission denied.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.storage.Storage;
|
||||
@ -73,7 +73,7 @@ public class UpdateIsoCmd extends BaseCmd {
|
||||
if (account != null) {
|
||||
Long isoOwner = iso.getAccountId();
|
||||
if (!isAdmin(account.getType())) {
|
||||
if ((isoOwner == null) || (account.getId().longValue() != isoOwner.longValue())) {
|
||||
if ((isoOwner == null) || (account.getId() != isoOwner.longValue())) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to modify ISO with id " + isoId);
|
||||
}
|
||||
} else if (account.getType() != Account.ACCOUNT_TYPE_ADMIN) {
|
||||
|
||||
@ -63,7 +63,7 @@ public class UpdateLoadBalancerRuleCmd extends BaseCmd {
|
||||
Long accountId = lbOwner.getId();
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType())) {
|
||||
if (account.getId().longValue() != accountId.longValue()) {
|
||||
if (account.getId() != accountId.longValue()) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update load balancer rule, permission denied");
|
||||
}
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), lbOwner.getDomainId())) {
|
||||
|
||||
@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -104,9 +105,25 @@ public class UpdateTemplateCmd extends BaseCmd {
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_PUBLIC.getName(), Boolean.valueOf(updatedTemplate.isPublicTemplate()).toString()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CREATED.getName(), getDateString(updatedTemplate.getCreated())));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), updatedTemplate.getFormat()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), updatedTemplate.getGuestOSId()));
|
||||
GuestOS os = getManagementServer().findGuestOSById(updatedTemplate.getGuestOSId());
|
||||
if (os != null) {
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), os.getId()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_NAME.getName(), os.getDisplayName()));
|
||||
} else {
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_ID.getName(), -1));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.OS_TYPE_NAME.getName(), ""));
|
||||
}
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), updatedTemplate.getEnablePassword()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(updatedTemplate.isCrossZones()).toString()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(updatedTemplate.isCrossZones()).toString()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.IS_FEATURED.getName(), Boolean.valueOf(updatedTemplate.isFeatured()).toString()));
|
||||
|
||||
// add account ID and name
|
||||
Account owner = getManagementServer().findAccountById(updatedTemplate.getAccountId());
|
||||
if (owner != null) {
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.ACCOUNT.getName(), owner.getAccountName()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN_ID.getName(), owner.getDomainId()));
|
||||
templateData.add(new Pair<String, Object>(BaseCmd.Properties.DOMAIN.getName(), getManagementServer().findDomainIdById(owner.getDomainId()).getName()));
|
||||
}
|
||||
return templateData;
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "internal error updating template");
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.user.Account;
|
||||
@ -80,7 +80,7 @@ public class UpdateVMCmd extends BaseCmd{
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + vmId + ") given, unable to update virtual machine.");
|
||||
|
||||
@ -18,16 +18,15 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -71,7 +70,7 @@ public class UpgradeVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
if (account != null) {
|
||||
if (!isAdmin(account.getType()) && (account.getId().longValue() != vmInstance.getAccountId())) {
|
||||
if (!isAdmin(account.getType()) && (account.getId() != vmInstance.getAccountId())) {
|
||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + virtualMachineId + " for this account");
|
||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid virtual machine id (" + virtualMachineId + ") given, unable to upgrade virtual machine.");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user