mirror of https://github.com/apache/cloudstack.git
More changes for refactoring
This commit is contained in:
parent
e9014301e2
commit
327924a9ad
|
|
@ -183,7 +183,7 @@ import com.cloud.utils.net.NetUtils;
|
||||||
import com.cloud.utils.script.OutputInterpreter;
|
import com.cloud.utils.script.OutputInterpreter;
|
||||||
import com.cloud.utils.script.Script;
|
import com.cloud.utils.script.Script;
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.DiskCharacteristics;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.DomainRouter;
|
import com.cloud.vm.DomainRouter;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
|
|
@ -1174,7 +1174,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||||
|
|
||||||
protected Answer execute(CreateCommand cmd) {
|
protected Answer execute(CreateCommand cmd) {
|
||||||
StoragePoolTO pool = cmd.getPool();
|
StoragePoolTO pool = cmd.getPool();
|
||||||
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
DiskProfile dskch = cmd.getDiskCharacteristics();
|
||||||
StorageVol tmplVol = null;
|
StorageVol tmplVol = null;
|
||||||
StoragePool primaryPool = null;
|
StoragePool primaryPool = null;
|
||||||
StorageVol vol = null;
|
StorageVol vol = null;
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,9 @@ public interface Pod extends Grouping {
|
||||||
*/
|
*/
|
||||||
long getId();
|
long getId();
|
||||||
|
|
||||||
|
String getCidrAddress();
|
||||||
|
int getCidrSize();
|
||||||
|
public String getGateway();
|
||||||
|
|
||||||
//String getUniqueName();
|
//String getUniqueName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public interface NetworkConfiguration {
|
||||||
|
|
||||||
String getCidr();
|
String getCidr();
|
||||||
|
|
||||||
void setCidr(String cidr);
|
public long getDataCenterId();
|
||||||
|
|
||||||
long getNetworkOfferingId();
|
long getNetworkOfferingId();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,12 @@
|
||||||
*/
|
*/
|
||||||
package com.cloud.network;
|
package com.cloud.network;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.exception.ConflictingNetworkSettingsException;
|
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offering.ServiceOffering;
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.component.Adapter;
|
import com.cloud.utils.component.Adapter;
|
||||||
import com.cloud.vm.VirtualMachine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetworkProfiler takes the list of network offerings requested and figures
|
* NetworkProfiler takes the list of network offerings requested and figures
|
||||||
|
|
@ -23,7 +18,4 @@ import com.cloud.vm.VirtualMachine;
|
||||||
*/
|
*/
|
||||||
public interface NetworkProfiler extends Adapter {
|
public interface NetworkProfiler extends Adapter {
|
||||||
NetworkConfiguration convert(NetworkOffering offering, DeploymentPlan plan, Map<String, String> params, Account owner);
|
NetworkConfiguration convert(NetworkOffering offering, DeploymentPlan plan, Map<String, String> params, Account owner);
|
||||||
|
|
||||||
List<? extends NetworkConfiguration> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner);
|
|
||||||
boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkConfiguration> networkProfiles) throws ConflictingNetworkSettingsException;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import com.cloud.storage.Volume;
|
||||||
* and resources to allocate and create disks. There object is immutable once
|
* and resources to allocate and create disks. There object is immutable once
|
||||||
* it has been created.
|
* it has been created.
|
||||||
*/
|
*/
|
||||||
public class DiskCharacteristics {
|
public class DiskProfile {
|
||||||
private long size;
|
private long size;
|
||||||
private String[] tags;
|
private String[] tags;
|
||||||
private Volume.VolumeType type;
|
private Volume.VolumeType type;
|
||||||
|
|
@ -36,10 +36,10 @@ public class DiskCharacteristics {
|
||||||
private Long templateId;
|
private Long templateId;
|
||||||
private long volumeId;
|
private long volumeId;
|
||||||
|
|
||||||
protected DiskCharacteristics() {
|
protected DiskProfile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskCharacteristics(long volumeId, Volume.VolumeType type, String name, long diskOfferingId, long size, String[] tags, boolean useLocalStorage, boolean recreatable, Long templateId) {
|
public DiskProfile(long volumeId, Volume.VolumeType type, String name, long diskOfferingId, long size, String[] tags, boolean useLocalStorage, boolean recreatable, Long templateId) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.cloud.vm;
|
|
||||||
|
|
||||||
import com.cloud.network.Network.BroadcastDomainType;
|
|
||||||
import com.cloud.network.Network.Mode;
|
|
||||||
|
|
||||||
public class NetworkCharacteristics {
|
|
||||||
long id;
|
|
||||||
BroadcastDomainType type;
|
|
||||||
String cidr;
|
|
||||||
Mode mode;
|
|
||||||
long vmId;
|
|
||||||
|
|
||||||
public BroadcastDomainType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mode getMode() {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getNetworkId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getVirtualMachineId() {
|
|
||||||
return vmId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetworkCharacteristics() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetworkCharacteristics(long id, BroadcastDomainType type, String cidr, Mode mode, long vmId) {
|
|
||||||
this.id = id;
|
|
||||||
this.type = type;
|
|
||||||
this.cidr = cidr;
|
|
||||||
this.mode = mode;
|
|
||||||
this.vmId = vmId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
*/
|
*/
|
||||||
package com.cloud.vm;
|
package com.cloud.vm;
|
||||||
|
|
||||||
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
||||||
import com.cloud.network.NetworkConfiguration;
|
import com.cloud.network.NetworkConfiguration;
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
import com.cloud.utils.component.Adapter;
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,9 +19,11 @@ import com.cloud.utils.component.Adapter;
|
||||||
public interface NetworkConcierge extends Adapter {
|
public interface NetworkConcierge extends Adapter {
|
||||||
String getUniqueName();
|
String getUniqueName();
|
||||||
|
|
||||||
Nic allocate(VirtualMachine vm, NetworkConfiguration profile, Nic nic);
|
NicProfile allocate(VirtualMachine vm, NetworkConfiguration config, NicProfile nic) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException;
|
||||||
|
|
||||||
Pair<String, String> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException;
|
boolean create(Nic nic) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException;
|
||||||
|
|
||||||
|
String reserve(long vmId, NicProfile ch, DeployDestination dest) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException;
|
||||||
|
|
||||||
boolean release(String uniqueName, String uniqueId);
|
boolean release(String uniqueName, String uniqueId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,13 @@
|
||||||
package com.cloud.vm;
|
package com.cloud.vm;
|
||||||
|
|
||||||
import com.cloud.network.Network.Mode;
|
import com.cloud.network.Network.Mode;
|
||||||
|
import com.cloud.resource.Resource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nic represents one nic on the VM.
|
* Nic represents one nic on the VM.
|
||||||
*/
|
*/
|
||||||
public interface Nic {
|
public interface Nic extends Resource {
|
||||||
enum State {
|
|
||||||
Allocated,
|
|
||||||
AcquireIp,
|
|
||||||
IpAcquired,
|
|
||||||
}
|
|
||||||
|
|
||||||
State getState();
|
|
||||||
|
|
||||||
String getIp4Address();
|
String getIp4Address();
|
||||||
|
|
||||||
|
|
@ -41,17 +35,12 @@ public interface Nic {
|
||||||
*/
|
*/
|
||||||
long getNetworkProfileId();
|
long getNetworkProfileId();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the unique id to reference this nic.
|
|
||||||
*/
|
|
||||||
long getId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the vm instance id that this nic belongs to.
|
* @return the vm instance id that this nic belongs to.
|
||||||
*/
|
*/
|
||||||
long getInstanceId();
|
long getInstanceId();
|
||||||
|
|
||||||
long getDeviceId();
|
int getDeviceId();
|
||||||
|
|
||||||
Mode getMode();
|
Mode getMode();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.vm;
|
||||||
|
|
||||||
|
import com.cloud.network.Network.AddressFormat;
|
||||||
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
|
import com.cloud.network.Network.Mode;
|
||||||
|
import com.cloud.network.Network.TrafficType;
|
||||||
|
import com.cloud.network.NetworkConfiguration;
|
||||||
|
|
||||||
|
public class NicProfile {
|
||||||
|
long id;
|
||||||
|
BroadcastDomainType broadcastType;
|
||||||
|
String cidr;
|
||||||
|
Mode mode;
|
||||||
|
long vmId;
|
||||||
|
String gateway;
|
||||||
|
int deviceId;
|
||||||
|
AddressFormat format;
|
||||||
|
TrafficType trafficType;
|
||||||
|
String ip4Address;
|
||||||
|
String ip6Address;
|
||||||
|
String macAddress;
|
||||||
|
|
||||||
|
public BroadcastDomainType getType() {
|
||||||
|
return broadcastType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBroadcastType(BroadcastDomainType broadcastType) {
|
||||||
|
this.broadcastType = broadcastType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCidr(String cidr) {
|
||||||
|
this.cidr = cidr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(Mode mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVmId(long vmId) {
|
||||||
|
this.vmId = vmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGateway(String gateway) {
|
||||||
|
this.gateway = gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(int deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormat(AddressFormat format) {
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrafficType(TrafficType trafficType) {
|
||||||
|
this.trafficType = trafficType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp6Address(String ip6Address) {
|
||||||
|
this.ip6Address = ip6Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mode getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNetworkId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getVirtualMachineId() {
|
||||||
|
return vmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BroadcastDomainType getBroadcastType() {
|
||||||
|
return broadcastType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCidr() {
|
||||||
|
return cidr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMacAddress(String macAddress) {
|
||||||
|
this.macAddress = macAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getVmId() {
|
||||||
|
return vmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGateway() {
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AddressFormat getFormat() {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrafficType getTrafficType() {
|
||||||
|
return trafficType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp4Address() {
|
||||||
|
return ip4Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp6Address() {
|
||||||
|
return ip6Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMacAddress() {
|
||||||
|
return macAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp4Address(String ip4Address) {
|
||||||
|
this.ip4Address = ip4Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NicProfile(Nic nic, NetworkConfiguration network) {
|
||||||
|
this.id = nic.getId();
|
||||||
|
this.deviceId = nic.getDeviceId();
|
||||||
|
this.cidr = network.getCidr();
|
||||||
|
this.gateway = network.getGateway();
|
||||||
|
this.mode = network.getMode();
|
||||||
|
this.format = null;
|
||||||
|
this.broadcastType = network.getBroadcastDomainType();
|
||||||
|
this.trafficType = network.getTrafficType();
|
||||||
|
this.ip4Address = nic.getIp4Address();
|
||||||
|
this.ip6Address = null;
|
||||||
|
this.macAddress = nic.getMacAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NicProfile(long id, BroadcastDomainType type, String cidr, Mode mode, long vmId) {
|
||||||
|
this.id = id;
|
||||||
|
this.broadcastType = type;
|
||||||
|
this.cidr = cidr;
|
||||||
|
this.mode = mode;
|
||||||
|
this.vmId = vmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NicProfile(String ip4Address, String macAddress, String gateway) {
|
||||||
|
this.ip4Address = ip4Address;
|
||||||
|
this.macAddress = macAddress;
|
||||||
|
this.gateway = gateway;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.vm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
|
import com.cloud.offering.ServiceOffering;
|
||||||
|
|
||||||
|
public class VirtualMachineProfile {
|
||||||
|
VirtualMachine _vm;
|
||||||
|
int _cpus;
|
||||||
|
int _speed; // in mhz
|
||||||
|
long _ram; // in bytes
|
||||||
|
Hypervisor.Type _hypervisorType;
|
||||||
|
VirtualMachine.Type _type;
|
||||||
|
Map<String, String> _params;
|
||||||
|
Long _templateId;
|
||||||
|
List<DiskProfile> _disks;
|
||||||
|
List<NicProfile> _nics;
|
||||||
|
|
||||||
|
public VirtualMachineProfile(VirtualMachine.Type type) {
|
||||||
|
this._type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return _vm.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachine.Type getType() {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTemplateId() {
|
||||||
|
return _templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCpus() {
|
||||||
|
return _cpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSpeed() {
|
||||||
|
return _speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRam() {
|
||||||
|
return _ram;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNics(List<NicProfile> profiles) {
|
||||||
|
this._nics = profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisks(List<DiskProfile> profiles) {
|
||||||
|
this._disks = profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hypervisor.Type getHypervisorType() {
|
||||||
|
return _hypervisorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachine getVm() {
|
||||||
|
return _vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachineProfile(long id, int core, int speed, long ram, Long templateId, Hypervisor.Type type, Map<String, String> params) {
|
||||||
|
this._cpus = core;
|
||||||
|
this._speed = speed;
|
||||||
|
this._ram = ram;
|
||||||
|
this._hypervisorType = type;
|
||||||
|
this._params = params;
|
||||||
|
this._templateId = templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VirtualMachineProfile(VirtualMachine vm, ServiceOffering offering) {
|
||||||
|
this._cpus = offering.getCpu();
|
||||||
|
this._speed = offering.getSpeed();
|
||||||
|
this._ram = offering.getRamSize();
|
||||||
|
this._templateId = vm.getTemplateId();
|
||||||
|
this._type = vm.getType();
|
||||||
|
this._vm = vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VirtualMachineProfile() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VM-" + _type + "-" + _vm.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,5 +9,5 @@ import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
public interface VirtualMachineProfiler extends Adapter {
|
public interface VirtualMachineProfiler extends Adapter {
|
||||||
|
|
||||||
VmCharacteristics convert(ServiceOffering offering, VirtualMachineTemplate template);
|
VirtualMachineProfile convert(ServiceOffering offering, VirtualMachineTemplate template);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under the GNU General Public License v3 or later.
|
|
||||||
*
|
|
||||||
* It is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.cloud.vm;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
|
||||||
|
|
||||||
public class VmCharacteristics {
|
|
||||||
long id;
|
|
||||||
int core;
|
|
||||||
int speed; // in mhz
|
|
||||||
long ram; // in bytes
|
|
||||||
Hypervisor.Type hypervisorType;
|
|
||||||
VirtualMachine.Type type;
|
|
||||||
Map<String, String> params;
|
|
||||||
Long templateId;
|
|
||||||
|
|
||||||
public VmCharacteristics(VirtualMachine.Type type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VirtualMachine.Type getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTemplateId() {
|
|
||||||
return templateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCores() {
|
|
||||||
return core;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSpeed() {
|
|
||||||
return speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRam() {
|
|
||||||
return ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hypervisor.Type getHypervisorType() {
|
|
||||||
return hypervisorType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VmCharacteristics(long id, int core, int speed, long ram, Long templateId, Hypervisor.Type type, Map<String, String> params) {
|
|
||||||
this.core = core;
|
|
||||||
this.speed = speed;
|
|
||||||
this.ram = ram;
|
|
||||||
this.hypervisorType = type;
|
|
||||||
this.params = params;
|
|
||||||
this.id = id;
|
|
||||||
this.templateId = templateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected VmCharacteristics() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "VM-" + type + "-" + id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -44,7 +44,7 @@ import com.cloud.uservm.UserVm;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.Manager;
|
import com.cloud.utils.component.Manager;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AgentManager manages hosts. It directly coordinates between the
|
* AgentManager manages hosts. It directly coordinates between the
|
||||||
|
|
@ -180,7 +180,7 @@ public interface AgentManager extends Manager {
|
||||||
*/
|
*/
|
||||||
Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
||||||
|
|
||||||
Host findHost(VmCharacteristics vm, Set<? extends Host> avoids);
|
Host findHost(VirtualMachineProfile vm, Set<? extends Host> avoids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the agent in maintenance mode.
|
* Put the agent in maintenance mode.
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ import com.cloud.agent.api.Command;
|
||||||
import com.cloud.agent.api.to.StoragePoolTO;
|
import com.cloud.agent.api.to.StoragePoolTO;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.vm.DiskCharacteristics;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
|
||||||
public class CreateCommand extends Command {
|
public class CreateCommand extends Command {
|
||||||
private long volId;
|
private long volId;
|
||||||
private StoragePoolTO pool;
|
private StoragePoolTO pool;
|
||||||
private DiskCharacteristics diskCharacteristics;
|
private DiskProfile diskCharacteristics;
|
||||||
private String templateUrl;
|
private String templateUrl;
|
||||||
private long size;
|
private long size;
|
||||||
private String instanceName;
|
private String instanceName;
|
||||||
|
|
@ -45,7 +45,7 @@ public class CreateCommand extends Command {
|
||||||
* @param templateUrl
|
* @param templateUrl
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristics diskCharacteristics, String templateUrl, StoragePoolVO pool) {
|
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskProfile diskCharacteristics, String templateUrl, StoragePoolVO pool) {
|
||||||
this(vol, vm, diskCharacteristics, pool, 0);
|
this(vol, vm, diskCharacteristics, pool, 0);
|
||||||
this.templateUrl = templateUrl;
|
this.templateUrl = templateUrl;
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,7 @@ public class CreateCommand extends Command {
|
||||||
* @param diskCharacteristics
|
* @param diskCharacteristics
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskCharacteristics diskCharacteristics, StoragePoolVO pool, long size) {
|
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskProfile diskCharacteristics, StoragePoolVO pool, long size) {
|
||||||
this.volId = vol.getId();
|
this.volId = vol.getId();
|
||||||
this.diskCharacteristics = diskCharacteristics;
|
this.diskCharacteristics = diskCharacteristics;
|
||||||
this.pool = new StoragePoolTO(pool);
|
this.pool = new StoragePoolTO(pool);
|
||||||
|
|
@ -80,7 +80,7 @@ public class CreateCommand extends Command {
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskCharacteristics getDiskCharacteristics() {
|
public DiskProfile getDiskCharacteristics() {
|
||||||
return diskCharacteristics;
|
return diskCharacteristics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
|
||||||
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
|
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AlertVO> alerts = listActiveBy(sc, searchFilter);
|
List<AlertVO> alerts = listBy(sc, searchFilter);
|
||||||
if ((alerts != null) && !alerts.isEmpty()) {
|
if ((alerts != null) && !alerts.isEmpty()) {
|
||||||
return alerts.get(0);
|
return alerts.get(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
|
sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
|
||||||
|
|
||||||
List<AsyncJobVO> l = listBy(sc);
|
List<AsyncJobVO> l = listIncludingRemovedBy(sc);
|
||||||
if(l != null && l.size() > 0) {
|
if(l != null && l.size() > 0) {
|
||||||
if(l.size() > 1) {
|
if(l.size() > 1) {
|
||||||
s_logger.warn("Instance " + instanceType + "-" + instanceId + " has multiple pending async-job");
|
s_logger.warn("Instance " + instanceType + "-" + instanceId + " has multiple pending async-job");
|
||||||
|
|
@ -76,6 +76,6 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
|
||||||
SearchCriteria<AsyncJobVO> sc = expiringAsyncJobSearch.create();
|
SearchCriteria<AsyncJobVO> sc = expiringAsyncJobSearch.create();
|
||||||
sc.setParameters("created", cutTime);
|
sc.setParameters("created", cutTime);
|
||||||
Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
|
Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
|
||||||
return listBy(sc, filter);
|
return listIncludingRemovedBy(sc, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class SyncQueueDaoImpl extends GenericDaoBase<SyncQueueVO, Long> implemen
|
||||||
SearchCriteria<SyncQueueVO> sc = TypeIdSearch.create();
|
SearchCriteria<SyncQueueVO> sc = TypeIdSearch.create();
|
||||||
sc.setParameters("syncObjType", syncObjType);
|
sc.setParameters("syncObjType", syncObjType);
|
||||||
sc.setParameters("syncObjId", syncObjId);
|
sc.setParameters("syncObjId", syncObjId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SyncQueueDaoImpl() {
|
protected SyncQueueDaoImpl() {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long>
|
||||||
sc.setParameters("queueId", queueId);
|
sc.setParameters("queueId", queueId);
|
||||||
|
|
||||||
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
|
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
|
||||||
List<SyncQueueItemVO> l = listActiveBy(sc, filter);
|
List<SyncQueueItemVO> l = listBy(sc, filter);
|
||||||
if(l != null && l.size() > 0)
|
if(l != null && l.size() > 0)
|
||||||
return l.get(0);
|
return l.get(0);
|
||||||
|
|
||||||
|
|
@ -105,6 +105,6 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long>
|
||||||
sc.setParameters("lastProcessMsid", msid);
|
sc.setParameters("lastProcessMsid", msid);
|
||||||
|
|
||||||
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
|
Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
|
||||||
return listActiveBy(sc, filter);
|
return listBy(sc, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
|
||||||
SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
|
SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
|
||||||
sc.setParameters("msid", msid);
|
sc.setParameters("msid", msid);
|
||||||
|
|
||||||
List<ManagementServerHostVO> l = listBy(sc);
|
List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
|
||||||
if(l != null && l.size() > 0)
|
if(l != null && l.size() > 0)
|
||||||
return l.get(0);
|
return l.get(0);
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
|
||||||
SearchCriteria<ManagementServerHostVO> sc = activeSearch.create();
|
SearchCriteria<ManagementServerHostVO> sc = activeSearch.create();
|
||||||
sc.setParameters("lastUpdateTime", cutTime);
|
sc.setParameters("lastUpdateTime", cutTime);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void increaseAlertCount(long id) {
|
public void increaseAlertCount(long id) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||||
SearchCriteria<ConfigurationVO> sc = InstanceSearch.create();
|
SearchCriteria<ConfigurationVO> sc = InstanceSearch.create();
|
||||||
sc.setParameters("instance", "DEFAULT");
|
sc.setParameters("instance", "DEFAULT");
|
||||||
|
|
||||||
List<ConfigurationVO> configurations = listBy(sc);
|
List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
|
||||||
|
|
||||||
for (ConfigurationVO config : configurations) {
|
for (ConfigurationVO config : configurations) {
|
||||||
if (config.getValue() != null)
|
if (config.getValue() != null)
|
||||||
|
|
@ -71,7 +71,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||||
sc = InstanceSearch.create();
|
sc = InstanceSearch.create();
|
||||||
sc.setParameters("instance", instance);
|
sc.setParameters("instance", instance);
|
||||||
|
|
||||||
configurations = listBy(sc);
|
configurations = listIncludingRemovedBy(sc);
|
||||||
|
|
||||||
for (ConfigurationVO config : configurations) {
|
for (ConfigurationVO config : configurations) {
|
||||||
if (config.getValue() != null)
|
if (config.getValue() != null)
|
||||||
|
|
@ -126,7 +126,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||||
public String getValue(String name) {
|
public String getValue(String name) {
|
||||||
SearchCriteria<ConfigurationVO> sc = NameSearch.create();
|
SearchCriteria<ConfigurationVO> sc = NameSearch.create();
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
List<ConfigurationVO> configurations = listBy(sc);
|
List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
|
||||||
|
|
||||||
if (configurations.size() == 0) {
|
if (configurations.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceCountVO findByDomainIdAndType(long domainId, ResourceType type) {
|
private ResourceCountVO findByDomainIdAndType(long domainId, ResourceType type) {
|
||||||
|
|
@ -64,7 +64,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResourceLimitVO> listByDomainId(Long domainId) {
|
public List<ResourceLimitVO> listByDomainId(Long domainId) {
|
||||||
|
|
@ -58,7 +58,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
||||||
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceLimitVO findByAccountIdAndType(Long accountId, ResourceCount.ResourceType type) {
|
public ResourceLimitVO findByAccountIdAndType(Long accountId, ResourceCount.ResourceType type) {
|
||||||
|
|
@ -69,7 +69,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResourceLimitVO> listByAccountId(Long accountId) {
|
public List<ResourceLimitVO> listByAccountId(Long accountId) {
|
||||||
|
|
@ -79,7 +79,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
||||||
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(Long id, Long max) {
|
public boolean update(Long id, Long max) {
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,12 @@ public class HostPodVO implements Pod {
|
||||||
private String cidrAddress;
|
private String cidrAddress;
|
||||||
|
|
||||||
@Column(name = "cidr_size")
|
@Column(name = "cidr_size")
|
||||||
private long cidrSize;
|
private int cidrSize;
|
||||||
|
|
||||||
@Column(name = "description")
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public HostPodVO(String name, long dcId, String gateway, String cidrAddress, long cidrSize, String description) {
|
public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.dataCenterId = dcId;
|
this.dataCenterId = dcId;
|
||||||
this.gateway = gateway;
|
this.gateway = gateway;
|
||||||
|
|
@ -88,7 +88,8 @@ public class HostPodVO implements Pod {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCidrAddress() {
|
@Override
|
||||||
|
public String getCidrAddress() {
|
||||||
return cidrAddress;
|
return cidrAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,15 +97,17 @@ public class HostPodVO implements Pod {
|
||||||
this.cidrAddress = cidrAddress;
|
this.cidrAddress = cidrAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCidrSize() {
|
@Override
|
||||||
|
public int getCidrSize() {
|
||||||
return cidrSize;
|
return cidrSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCidrSize(long cidrSize) {
|
public void setCidrSize(int cidrSize) {
|
||||||
this.cidrSize = cidrSize;
|
this.cidrSize = cidrSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGateway() {
|
@Override
|
||||||
|
public String getGateway() {
|
||||||
return gateway;
|
return gateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ public class AccountVlanMapDaoImpl extends GenericDaoBase<AccountVlanMapVO, Long
|
||||||
public List<AccountVlanMapVO> listAccountVlanMapsByAccount(long accountId) {
|
public List<AccountVlanMapVO> listAccountVlanMapsByAccount(long accountId) {
|
||||||
SearchCriteria<AccountVlanMapVO> sc = AccountSearch.create();
|
SearchCriteria<AccountVlanMapVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AccountVlanMapVO> listAccountVlanMapsByVlan(long vlanDbId) {
|
public List<AccountVlanMapVO> listAccountVlanMapsByVlan(long vlanDbId) {
|
||||||
SearchCriteria<AccountVlanMapVO> sc = VlanSearch.create();
|
SearchCriteria<AccountVlanMapVO> sc = VlanSearch.create();
|
||||||
sc.setParameters("vlanDbId", vlanDbId);
|
sc.setParameters("vlanDbId", vlanDbId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,7 +53,7 @@ public class AccountVlanMapDaoImpl extends GenericDaoBase<AccountVlanMapVO, Long
|
||||||
SearchCriteria<AccountVlanMapVO> sc = AccountVlanSearch.create();
|
SearchCriteria<AccountVlanMapVO> sc = AccountVlanSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("vlanDbId", vlanDbId);
|
sc.setParameters("vlanDbId", vlanDbId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountVlanMapDaoImpl() {
|
public AccountVlanMapDaoImpl() {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||||
SearchCriteria<ClusterVO> sc = PodSearch.create();
|
SearchCriteria<ClusterVO> sc = PodSearch.create();
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("pod", podId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -54,6 +54,6 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("pod", podId);
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
|
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
package com.cloud.dc.dao;
|
package com.cloud.dc.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.dc.DataCenterVnetVO;
|
import com.cloud.dc.DataCenterVnetVO;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
@ -39,7 +39,10 @@ public interface DataCenterDao extends GenericDao<DataCenterVO, Long> {
|
||||||
|
|
||||||
void releaseVnet(String vnet, long dcId, long accountId);
|
void releaseVnet(String vnet, long dcId, long accountId);
|
||||||
void releasePrivateIpAddress(String ipAddress, long dcId, Long instanceId);
|
void releasePrivateIpAddress(String ipAddress, long dcId, Long instanceId);
|
||||||
void releaseLinkLocalPrivateIpAddress(String ipAddress, long dcId, Long instanceId);
|
void releasePrivateIpAddress(long nicId);
|
||||||
|
void releaseLinkLocalPrivateIpAddress(String ipAddress, long dcId, Long instanceId);
|
||||||
|
void releaseLinkLocalPrivateIpAddress(long nicId);
|
||||||
|
|
||||||
boolean deletePrivateIpAddressByPod(long podId);
|
boolean deletePrivateIpAddressByPod(long podId);
|
||||||
boolean deleteLinkLocalPrivateIpAddressByPod(long podId);
|
boolean deleteLinkLocalPrivateIpAddressByPod(long podId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||||
public DataCenterVO findByName(String name) {
|
public DataCenterVO findByName(String name) {
|
||||||
SearchCriteria<DataCenterVO> sc = NameSearch.create();
|
SearchCriteria<DataCenterVO> sc = NameSearch.create();
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -84,6 +84,16 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||||
_ipAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
_ipAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releasePrivateIpAddress(long nicId) {
|
||||||
|
_ipAllocDao.releaseIpAddress(nicId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseLinkLocalPrivateIpAddress(long nicId) {
|
||||||
|
_LinkLocalIpAllocDao.releaseIpAddress(nicId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseLinkLocalPrivateIpAddress(String ipAddress, long dcId, Long instanceId) {
|
public void releaseLinkLocalPrivateIpAddress(String ipAddress, long dcId, Long instanceId) {
|
||||||
_LinkLocalIpAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
_LinkLocalIpAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,16 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
||||||
update(vo, sc);
|
update(vo, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void releaseIpAddress(long nicId) {
|
||||||
|
SearchCriteria<DataCenterIpAddressVO> sc = IpDcSearch.create();
|
||||||
|
sc.setParameters("instance", nicId);
|
||||||
|
|
||||||
|
DataCenterIpAddressVO vo = createForUpdate();
|
||||||
|
vo.setTakenAt(null);
|
||||||
|
vo.setInstanceId(null);
|
||||||
|
update(vo, sc);
|
||||||
|
}
|
||||||
|
|
||||||
protected DataCenterIpAddressDaoImpl() {
|
protected DataCenterIpAddressDaoImpl() {
|
||||||
super();
|
super();
|
||||||
FreeIpSearch = createSearchBuilder();
|
FreeIpSearch = createSearchBuilder();
|
||||||
|
|
@ -173,7 +183,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
||||||
SearchCriteria<DataCenterIpAddressVO> sc = PodDcSearch.create();
|
SearchCriteria<DataCenterIpAddressVO> sc = PodDcSearch.create();
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("dataCenterId", dcId);
|
sc.setParameters("dataCenterId", dcId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataCenterIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
|
public List<DataCenterIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
|
||||||
|
|
@ -181,7 +191,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
||||||
sc.setParameters("dcId", dcId);
|
sc.setParameters("dcId", dcId);
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
|
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,17 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
||||||
update(vo, sc);
|
update(vo, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void releaseIpAddress(long nicId) {
|
||||||
|
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = IpDcSearch.create();
|
||||||
|
sc.setParameters("instance", nicId);
|
||||||
|
|
||||||
|
DataCenterLinkLocalIpAddressVO vo = createForUpdate();
|
||||||
|
|
||||||
|
vo.setTakenAt(null);
|
||||||
|
vo.setInstanceId(null);
|
||||||
|
update(vo, sc);
|
||||||
|
}
|
||||||
|
|
||||||
protected DataCenterLinkLocalIpAddressDaoImpl() {
|
protected DataCenterLinkLocalIpAddressDaoImpl() {
|
||||||
super();
|
super();
|
||||||
FreeIpSearch = createSearchBuilder();
|
FreeIpSearch = createSearchBuilder();
|
||||||
|
|
@ -175,7 +186,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
||||||
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = PodDcSearch.create();
|
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = PodDcSearch.create();
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("dataCenterId", dcId);
|
sc.setParameters("dataCenterId", dcId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataCenterLinkLocalIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
|
public List<DataCenterLinkLocalIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
|
||||||
|
|
@ -183,7 +194,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
||||||
sc.setParameters("dcId", dcId);
|
sc.setParameters("dcId", dcId);
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
|
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
||||||
public List<DataCenterVnetVO> listAllocatedVnets(long dcId) {
|
public List<DataCenterVnetVO> listAllocatedVnets(long dcId) {
|
||||||
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
|
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
|
public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
|
||||||
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();;
|
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();;
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("vnet", vnet);
|
sc.setParameters("vnet", vnet);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(long dcId, int start, int end) {
|
public void add(long dcId, int start, int end) {
|
||||||
|
|
@ -114,7 +114,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
|
|
||||||
DataCenterVnetVO vo = findOneBy(sc);
|
DataCenterVnetVO vo = findOneIncludingRemovedBy(sc);
|
||||||
if (vo == null) {
|
if (vo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||||
SearchCriteria<HostPodVO> sc = DataCenterIdSearch.create();
|
SearchCriteria<HostPodVO> sc = DataCenterIdSearch.create();
|
||||||
sc.setParameters("dcId", id);
|
sc.setParameters("dcId", id);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HostPodVO findByName(String name, long dcId) {
|
public HostPodVO findByName(String name, long dcId) {
|
||||||
|
|
@ -68,7 +68,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
|
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements G
|
||||||
public List<PodVlanVO> listAllocatedVnets(long podId) {
|
public List<PodVlanVO> listAllocatedVnets(long podId) {
|
||||||
SearchCriteria<PodVlanVO> sc = PodSearchAllocated.create();
|
SearchCriteria<PodVlanVO> sc = PodSearchAllocated.create();
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(long podId, int start, int end) {
|
public void add(long podId, int start, int end) {
|
||||||
|
|
@ -106,7 +106,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements G
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
|
|
||||||
PodVlanVO vo = findOneBy(sc);
|
PodVlanVO vo = findOneIncludingRemovedBy(sc);
|
||||||
if (vo == null) {
|
if (vo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ public class PodVlanMapDaoImpl extends GenericDaoBase<PodVlanMapVO, Long> implem
|
||||||
public List<PodVlanMapVO> listPodVlanMapsByPod(long podId) {
|
public List<PodVlanMapVO> listPodVlanMapsByPod(long podId) {
|
||||||
SearchCriteria<PodVlanMapVO> sc = PodSearch.create();
|
SearchCriteria<PodVlanMapVO> sc = PodSearch.create();
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PodVlanMapVO> listPodVlanMapsByVlan(long vlanDbId) {
|
public List<PodVlanMapVO> listPodVlanMapsByVlan(long vlanDbId) {
|
||||||
SearchCriteria<PodVlanMapVO> sc = VlanSearch.create();
|
SearchCriteria<PodVlanMapVO> sc = VlanSearch.create();
|
||||||
sc.setParameters("vlanDbId", vlanDbId);
|
sc.setParameters("vlanDbId", vlanDbId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,7 +53,7 @@ public class PodVlanMapDaoImpl extends GenericDaoBase<PodVlanMapVO, Long> implem
|
||||||
SearchCriteria<PodVlanMapVO> sc = PodVlanSearch.create();
|
SearchCriteria<PodVlanMapVO> sc = PodVlanSearch.create();
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
sc.setParameters("vlanDbId", vlanDbId);
|
sc.setParameters("vlanDbId", vlanDbId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PodVlanMapDaoImpl() {
|
public PodVlanMapDaoImpl() {
|
||||||
|
|
|
||||||
|
|
@ -64,14 +64,14 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
||||||
SearchCriteria<VlanVO> sc = ZoneVlanIdSearch.create();
|
SearchCriteria<VlanVO> sc = ZoneVlanIdSearch.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
sc.setParameters("vlanId", vlanId);
|
sc.setParameters("vlanId", vlanId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VlanVO> findByZone(long zoneId) {
|
public List<VlanVO> findByZone(long zoneId) {
|
||||||
SearchCriteria<VlanVO> sc = ZoneSearch.create();
|
SearchCriteria<VlanVO> sc = ZoneSearch.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VlanDaoImpl() {
|
public VlanDaoImpl() {
|
||||||
|
|
@ -105,7 +105,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
||||||
SearchCriteria<VlanVO> sc = ZoneTypeSearch.create();
|
SearchCriteria<VlanVO> sc = ZoneTypeSearch.create();
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
sc.setParameters("vlanType", vlanType);
|
sc.setParameters("vlanType", vlanType);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -248,7 +248,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
||||||
sc.setParameters("zoneId", zoneId);
|
sc.setParameters("zoneId", zoneId);
|
||||||
sc.setParameters("vlanType", VlanType.DirectAttached);
|
sc.setParameters("vlanType", VlanType.DirectAttached);
|
||||||
|
|
||||||
return listBy(sc).size() > 0;
|
return listIncludingRemovedBy(sc).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
||||||
sc.setParameters("vlanType", VlanType.DirectAttached);
|
sc.setParameters("vlanType", VlanType.DirectAttached);
|
||||||
sc.setJoinParameters("vlan", "podId", podId);
|
sc.setJoinParameters("vlan", "podId", podId);
|
||||||
|
|
||||||
VlanVO vlan = findOneBy(sc);
|
VlanVO vlan = findOneIncludingRemovedBy(sc);
|
||||||
if (vlan == null) {
|
if (vlan == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
||||||
public DomainVO findDomainByPath(String domainPath) {
|
public DomainVO findDomainByPath(String domainPath) {
|
||||||
SearchCriteria<DomainVO> sc = createSearchCriteria();
|
SearchCriteria<DomainVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("path", SearchCriteria.Op.EQ, domainPath);
|
sc.addAnd("path", SearchCriteria.Op.EQ, domainPath);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -205,7 +205,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
||||||
SearchCriteria<DomainVO> sc = DomainPairSearch.create();
|
SearchCriteria<DomainVO> sc = DomainPairSearch.create();
|
||||||
sc.setParameters("id", parentId, childId);
|
sc.setParameters("id", parentId, childId);
|
||||||
|
|
||||||
List<DomainVO> domainPair = listActiveBy(sc);
|
List<DomainVO> domainPair = listBy(sc);
|
||||||
|
|
||||||
if ((domainPair != null) && (domainPair.size() == 2)) {
|
if ((domainPair != null) && (domainPair.size() == 2)) {
|
||||||
DomainVO d1 = domainPair.get(0);
|
DomainVO d1 = domainPair.get(0);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter) {
|
public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter) {
|
||||||
return listBy(sc, filter);
|
return listIncludingRemovedBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -61,7 +61,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
||||||
if (oldTime == null) return null;
|
if (oldTime == null) return null;
|
||||||
SearchCriteria<EventVO> sc = createSearchCriteria();
|
SearchCriteria<EventVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
|
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
|
||||||
return listBy(sc, null);
|
return listIncludingRemovedBy(sc, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
||||||
sc.setParameters("state", EventState.Completed);
|
sc.setParameters("state", EventState.Completed);
|
||||||
sc.setParameters("startId", 0);
|
sc.setParameters("startId", 0);
|
||||||
sc.setParameters("createDate", minTime, maxTime);
|
sc.setParameters("createDate", minTime, maxTime);
|
||||||
return listBy(sc, null);
|
return listIncludingRemovedBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -80,6 +80,6 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
||||||
SearchCriteria<EventVO> sc = CompletedEventSearch.create();
|
SearchCriteria<EventVO> sc = CompletedEventSearch.create();
|
||||||
sc.setParameters("state", EventState.Completed);
|
sc.setParameters("state", EventState.Completed);
|
||||||
sc.setParameters("startId", startId);
|
sc.setParameters("startId", startId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
||||||
public List<WorkVO> findPreviousHA(final long instanceId) {
|
public List<WorkVO> findPreviousHA(final long instanceId) {
|
||||||
final SearchCriteria<WorkVO> sc = PreviousInstanceSearch.create();
|
final SearchCriteria<WorkVO> sc = PreviousInstanceSearch.create();
|
||||||
sc.setParameters("instance", instanceId);
|
sc.setParameters("instance", instanceId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -152,7 +152,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
sc.setParameters("step", Step.Done, Step.Cancelled, Step.Error);
|
sc.setParameters("step", Step.Done, Step.Cancelled, Step.Error);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -169,6 +169,6 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
||||||
SearchCriteria<WorkVO> sc = PreviousWorkSearch.create();
|
SearchCriteria<WorkVO> sc = PreviousWorkSearch.create();
|
||||||
sc.setParameters("instance", instanceId);
|
sc.setParameters("instance", instanceId);
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
return listActiveBy(sc, null).size() > 0;
|
return listBy(sc, null).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ public class DetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implements De
|
||||||
sc.setParameters("hostId", hostId);
|
sc.setParameters("hostId", hostId);
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
SearchCriteria<HostVO> sc = TypeDcSearch.create();
|
SearchCriteria<HostVO> sc = TypeDcSearch.create();
|
||||||
sc.setParameters("type", Host.Type.SecondaryStorage);
|
sc.setParameters("type", Host.Type.SecondaryStorage);
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
List<HostVO> storageHosts = listActiveBy(sc);
|
List<HostVO> storageHosts = listBy(sc);
|
||||||
|
|
||||||
if (storageHosts == null || storageHosts.size() != 1) {
|
if (storageHosts == null || storageHosts.size() != 1) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -232,7 +232,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
public List<HostVO> listSecondaryStorageHosts() {
|
public List<HostVO> listSecondaryStorageHosts() {
|
||||||
SearchCriteria<HostVO> sc = TypeSearch.create();
|
SearchCriteria<HostVO> sc = TypeSearch.create();
|
||||||
sc.setParameters("type", Host.Type.SecondaryStorage);
|
sc.setParameters("type", Host.Type.SecondaryStorage);
|
||||||
List<HostVO> secondaryStorageHosts = listBy(sc);
|
List<HostVO> secondaryStorageHosts = listIncludingRemovedBy(sc);
|
||||||
|
|
||||||
return secondaryStorageHosts;
|
return secondaryStorageHosts;
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("status", Status.Up.toString());
|
sc.setParameters("status", Status.Up.toString());
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -290,7 +290,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
|
|
||||||
sc.setParameters("cluster", clusterId);
|
sc.setParameters("cluster", clusterId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -300,7 +300,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("status", Status.Up.toString());
|
sc.setParameters("status", Status.Up.toString());
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -309,7 +309,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("privateIpAddress", privateIpAddress);
|
sc.setParameters("privateIpAddress", privateIpAddress);
|
||||||
|
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -318,7 +318,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("storageIpAddress", privateIpAddress);
|
sc.setParameters("storageIpAddress", privateIpAddress);
|
||||||
|
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -416,7 +416,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
@Override
|
@Override
|
||||||
public HostVO findByGuid(String guid) {
|
public HostVO findByGuid(String guid) {
|
||||||
SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
|
SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -425,13 +425,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("ping", timeout);
|
sc.setParameters("ping", timeout);
|
||||||
sc.setParameters("state", Status.Up.toString(), Status.Updating.toString(),
|
sc.setParameters("state", Status.Up.toString(), Status.Updating.toString(),
|
||||||
Status.Disconnected.toString(), Status.Down.toString());
|
Status.Disconnected.toString(), Status.Down.toString());
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HostVO> findHostsLike(String hostName) {
|
public List<HostVO> findHostsLike(String hostName) {
|
||||||
SearchCriteria<HostVO> sc = NameLikeSearch.create();
|
SearchCriteria<HostVO> sc = NameLikeSearch.create();
|
||||||
sc.setParameters("name", "%" + hostName + "%");
|
sc.setParameters("name", "%" + hostName + "%");
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -439,25 +439,25 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
SearchCriteria<HostVO> sc = LastPingedSearch2.create();
|
SearchCriteria<HostVO> sc = LastPingedSearch2.create();
|
||||||
sc.setParameters("ping", timeout);
|
sc.setParameters("ping", timeout);
|
||||||
sc.setParameters("type", type.toString());
|
sc.setParameters("type", type.toString());
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HostVO> listByDataCenter(long dcId) {
|
public List<HostVO> listByDataCenter(long dcId) {
|
||||||
SearchCriteria<HostVO> sc = DcSearch.create("dc", dcId);
|
SearchCriteria<HostVO> sc = DcSearch.create("dc", dcId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HostVO> listByHostPod(long podId) {
|
public List<HostVO> listByHostPod(long podId) {
|
||||||
SearchCriteria<HostVO> sc = PodSearch.create("pod", podId);
|
SearchCriteria<HostVO> sc = PodSearch.create("pod", podId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HostVO> listByStatus(Status... status) {
|
public List<HostVO> listByStatus(Status... status) {
|
||||||
SearchCriteria<HostVO> sc = StatusSearch.create();
|
SearchCriteria<HostVO> sc = StatusSearch.create();
|
||||||
sc.setParameters("status", (Object[])status);
|
sc.setParameters("status", (Object[])status);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -466,7 +466,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.setParameters("type", type.toString());
|
sc.setParameters("type", type.toString());
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -478,7 +478,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||||
sc.addAnd("routing_capbable", SearchCriteria.Op.EQ, Integer.valueOf(1));
|
sc.addAnd("routing_capbable", SearchCriteria.Op.EQ, Integer.valueOf(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveDetails(HostVO host) {
|
protected void saveDetails(HostVO host) {
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.utils.net.NetUtils;
|
import com.cloud.utils.net.NetUtils;
|
||||||
import com.cloud.utils.script.Script;
|
import com.cloud.utils.script.Script;
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.DiskCharacteristics;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.DomainRouter;
|
import com.cloud.vm.DomainRouter;
|
||||||
import com.cloud.vm.SecondaryStorageVmVO;
|
import com.cloud.vm.SecondaryStorageVmVO;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
|
|
@ -4729,7 +4729,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||||
@Override
|
@Override
|
||||||
public CreateAnswer execute(CreateCommand cmd) {
|
public CreateAnswer execute(CreateCommand cmd) {
|
||||||
StoragePoolTO pool = cmd.getPool();
|
StoragePoolTO pool = cmd.getPool();
|
||||||
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
DiskProfile dskch = cmd.getDiskCharacteristics();
|
||||||
|
|
||||||
VDI vdi = null;
|
VDI vdi = null;
|
||||||
Connection conn = getConnection();
|
Connection conn = getConnection();
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class StackMaidDaoImpl extends GenericDaoBase<StackMaidVO, Long> implemen
|
||||||
sc.setParameters("threadId", Thread.currentThread().getId());
|
sc.setParameters("threadId", Thread.currentThread().getId());
|
||||||
|
|
||||||
Filter filter = new Filter(StackMaidVO.class, "seq", false, 0L, (long)1);
|
Filter filter = new Filter(StackMaidVO.class, "seq", false, 0L, (long)1);
|
||||||
List<StackMaidVO> l = listBy(sc, filter);
|
List<StackMaidVO> l = listIncludingRemovedBy(sc, filter);
|
||||||
if(l != null && l.size() > 0) {
|
if(l != null && l.size() > 0) {
|
||||||
expunge(l.get(0).getId());
|
expunge(l.get(0).getId());
|
||||||
return l.get(0);
|
return l.get(0);
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
SearchCriteria<FirewallRuleVO> sc = FWByIPAndForwardingSearch.create();
|
SearchCriteria<FirewallRuleVO> sc = FWByIPAndForwardingSearch.create();
|
||||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||||
sc.setParameters("forwarding", forwarding);
|
sc.setParameters("forwarding", forwarding);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -199,14 +199,14 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
public List<FirewallRuleVO> listIPForwarding(String publicIPAddress) {
|
public List<FirewallRuleVO> listIPForwarding(String publicIPAddress) {
|
||||||
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
||||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FirewallRuleVO> listIPForwardingForUpdate(String publicIPAddress) {
|
public List<FirewallRuleVO> listIPForwardingForUpdate(String publicIPAddress) {
|
||||||
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
||||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||||
return listActiveBy(sc, null);
|
return listBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -234,7 +234,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
sc.setParameters("publicIpAddress", publicIp);
|
sc.setParameters("publicIpAddress", publicIp);
|
||||||
sc.setParameters("publicPort", publicPort);
|
sc.setParameters("publicPort", publicPort);
|
||||||
sc.setParameters("algorithm", algo);
|
sc.setParameters("algorithm", algo);
|
||||||
return listActiveBy(sc, null);
|
return listBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -245,7 +245,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
sc.setParameters("publicPort", port);
|
sc.setParameters("publicPort", port);
|
||||||
sc.setParameters("forwarding", forwarding);
|
sc.setParameters("forwarding", forwarding);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -270,7 +270,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
sc.setParameters("publicIpAddress", publicIpAddress);
|
sc.setParameters("publicIpAddress", publicIpAddress);
|
||||||
sc.setParameters("groupId", securityGroupId);
|
sc.setParameters("groupId", securityGroupId);
|
||||||
sc.setParameters("forwarding", false);
|
sc.setParameters("forwarding", false);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -278,7 +278,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
||||||
sc.setParameters("groupId", securityGroupId);
|
sc.setParameters("groupId", securityGroupId);
|
||||||
sc.setParameters("forwarding", Boolean.TRUE);
|
sc.setParameters("forwarding", Boolean.TRUE);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -287,7 +287,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||||
sc.setParameters("forwarding", forwarding);
|
sc.setParameters("forwarding", forwarding);
|
||||||
sc.addAnd("privateIpAddress", SearchCriteria.Op.EQ, privateIp);
|
sc.addAnd("privateIpAddress", SearchCriteria.Op.EQ, privateIp);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -295,7 +295,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
||||||
sc.setParameters("groupId", loadBalancerId);
|
sc.setParameters("groupId", loadBalancerId);
|
||||||
sc.setParameters("forwarding", Boolean.FALSE);
|
sc.setParameters("forwarding", Boolean.FALSE);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -304,7 +304,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||||
sc.setParameters("groupId", groupId);
|
sc.setParameters("groupId", groupId);
|
||||||
sc.setParameters("privateIpAddress", privateIp);
|
sc.setParameters("privateIpAddress", privateIp);
|
||||||
sc.setParameters("forwarding", forwarding);
|
sc.setParameters("forwarding", forwarding);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,14 +172,14 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, String> implem
|
||||||
public List<IPAddressVO> listByAccount(long accountId) {
|
public List<IPAddressVO> listByAccount(long accountId) {
|
||||||
SearchCriteria<IPAddressVO> sc = AccountSearch.create();
|
SearchCriteria<IPAddressVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IPAddressVO> listByDcIdIpAddress(long dcId, String ipAddress) {
|
public List<IPAddressVO> listByDcIdIpAddress(long dcId, String ipAddress) {
|
||||||
SearchCriteria<IPAddressVO> sc = DcIpSearch.create();
|
SearchCriteria<IPAddressVO> sc = DcIpSearch.create();
|
||||||
sc.setParameters("dataCenterId", dcId);
|
sc.setParameters("dataCenterId", dcId);
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
||||||
public List<LoadBalancerVO> listByIpAddress(String ipAddress) {
|
public List<LoadBalancerVO> listByIpAddress(String ipAddress) {
|
||||||
SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
|
SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -97,7 +97,7 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
||||||
SearchCriteria<LoadBalancerVO> sc = IpAndPublicPortSearch.create();
|
SearchCriteria<LoadBalancerVO> sc = IpAndPublicPortSearch.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
sc.setParameters("publicPort", publicPort);
|
sc.setParameters("publicPort", publicPort);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -105,6 +105,6 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
||||||
SearchCriteria<LoadBalancerVO> sc = AccountAndNameSearch.create();
|
SearchCriteria<LoadBalancerVO> sc = AccountAndNameSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
||||||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("instanceId", SearchCriteria.Op.EQ, instanceId);
|
sc.addAnd("instanceId", SearchCriteria.Op.EQ, instanceId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -62,7 +62,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
||||||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -71,6 +71,6 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
||||||
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
||||||
sc.addAnd("pending", SearchCriteria.Op.EQ, pending);
|
sc.addAnd("pending", SearchCriteria.Op.EQ, pending);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class NetworkRuleConfigDaoImpl extends GenericDaoBase<NetworkRuleConfigVO
|
||||||
public List<NetworkRuleConfigVO> listBySecurityGroupId(long securityGroupId) {
|
public List<NetworkRuleConfigVO> listBySecurityGroupId(long securityGroupId) {
|
||||||
SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
|
SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
|
||||||
sc.setParameters("securityGroupId", securityGroupId);
|
sc.setParameters("securityGroupId", securityGroupId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteBySecurityGroup(long securityGroupId) {
|
public void deleteBySecurityGroup(long securityGroupId) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||||
public List<SecurityGroupVO> listByAccountId(long accountId) {
|
public List<SecurityGroupVO> listByAccountId(long accountId) {
|
||||||
SearchCriteria<SecurityGroupVO> sc = AccountIdSearch.create();
|
SearchCriteria<SecurityGroupVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -63,7 +63,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SecurityGroupVO> securityGroups = listActiveBy(sc);
|
List<SecurityGroupVO> securityGroups = listBy(sc);
|
||||||
return ((securityGroups != null) && !securityGroups.isEmpty());
|
return ((securityGroups != null) && !securityGroups.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
SearchCriteria<SecurityGroupVO> sc = createSearchCriteria();
|
SearchCriteria<SecurityGroupVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||||
List<SecurityGroupVO> accountGroups = listActiveBy(sc);
|
List<SecurityGroupVO> accountGroups = listBy(sc);
|
||||||
availableGroups.addAll(accountGroups);
|
availableGroups.addAll(accountGroups);
|
||||||
} else if (domainId != null) {
|
} else if (domainId != null) {
|
||||||
while (domainId != null) {
|
while (domainId != null) {
|
||||||
|
|
@ -83,7 +83,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.NEQ, accountId); // we added the account specific ones above
|
sc.addAnd("accountId", SearchCriteria.Op.NEQ, accountId); // we added the account specific ones above
|
||||||
}
|
}
|
||||||
List<SecurityGroupVO> domainGroups = listActiveBy(sc);
|
List<SecurityGroupVO> domainGroups = listBy(sc);
|
||||||
availableGroups.addAll(domainGroups);
|
availableGroups.addAll(domainGroups);
|
||||||
|
|
||||||
// get the parent domain, repeat the loop
|
// get the parent domain, repeat the loop
|
||||||
|
|
|
||||||
|
|
@ -57,28 +57,28 @@ public class SecurityGroupVMMapDaoImpl extends GenericDaoBase<SecurityGroupVMMap
|
||||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIpAndVmId.create();
|
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIpAndVmId.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
sc.setParameters("instanceId", vmId);
|
sc.setParameters("instanceId", vmId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId) {
|
public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId) {
|
||||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroup.create();
|
SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroup.create();
|
||||||
sc.setParameters("securityGroupId", securityGroupId);
|
sc.setParameters("securityGroupId", securityGroupId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecurityGroupVMMapVO> listByIp(String ipAddress) {
|
public List<SecurityGroupVMMapVO> listByIp(String ipAddress) {
|
||||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIp.create();
|
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIp.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecurityGroupVMMapVO> listByInstanceId(long vmId) {
|
public List<SecurityGroupVMMapVO> listByInstanceId(long vmId) {
|
||||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
|
SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
|
||||||
sc.setParameters("instanceId", vmId);
|
sc.setParameters("instanceId", vmId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
||||||
public List<IngressRuleVO> listByNetworkGroupId(long networkGroupId) {
|
public List<IngressRuleVO> listByNetworkGroupId(long networkGroupId) {
|
||||||
SearchCriteria<IngressRuleVO> sc = networkGroupIdSearch.create();
|
SearchCriteria<IngressRuleVO> sc = networkGroupIdSearch.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteByNetworkGroup(long networkGroupId) {
|
public int deleteByNetworkGroup(long networkGroupId) {
|
||||||
|
|
@ -86,7 +86,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
||||||
public List<IngressRuleVO> listByAllowedNetworkGroupId(long networkGroupId) {
|
public List<IngressRuleVO> listByAllowedNetworkGroupId(long networkGroupId) {
|
||||||
SearchCriteria<IngressRuleVO> sc = allowedNetworkGroupIdSearch.create();
|
SearchCriteria<IngressRuleVO> sc = allowedNetworkGroupIdSearch.create();
|
||||||
sc.setParameters("allowedNetworkId", networkGroupId);
|
sc.setParameters("allowedNetworkId", networkGroupId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -98,7 +98,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
||||||
sc.setParameters("startPort", startPort);
|
sc.setParameters("startPort", startPort);
|
||||||
sc.setParameters("endPort", endPort);
|
sc.setParameters("endPort", endPort);
|
||||||
sc.setParameters("cidr", cidr);
|
sc.setParameters("cidr", cidr);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -109,7 +109,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
||||||
sc.setParameters("startPort", startPort);
|
sc.setParameters("startPort", startPort);
|
||||||
sc.setParameters("endPort", endPort);
|
sc.setParameters("endPort", endPort);
|
||||||
sc.setJoinParameters("groupName", "groupName", networkGroup);
|
sc.setJoinParameters("groupName", "groupName", networkGroup);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -161,6 +161,6 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
||||||
sc.setParameters("endPort", endPort);
|
sc.setParameters("endPort", endPort);
|
||||||
sc.setParameters("allowedNetworkId", allowedGroupId);
|
sc.setParameters("allowedNetworkId", allowedGroupId);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
public List<NetworkGroupVO> listByAccountId(long accountId) {
|
public List<NetworkGroupVO> listByAccountId(long accountId) {
|
||||||
SearchCriteria<NetworkGroupVO> sc = AccountIdSearch.create();
|
SearchCriteria<NetworkGroupVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -76,7 +76,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<NetworkGroupVO> securityGroups = listActiveBy(sc);
|
List<NetworkGroupVO> securityGroups = listBy(sc);
|
||||||
return ((securityGroups != null) && !securityGroups.isEmpty());
|
return ((securityGroups != null) && !securityGroups.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
SearchCriteria<NetworkGroupVO> sc = createSearchCriteria();
|
SearchCriteria<NetworkGroupVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||||
List<NetworkGroupVO> accountGroups = listActiveBy(sc);
|
List<NetworkGroupVO> accountGroups = listBy(sc);
|
||||||
availableGroups.addAll(accountGroups);
|
availableGroups.addAll(accountGroups);
|
||||||
} else if (domainId != null) {
|
} else if (domainId != null) {
|
||||||
while (domainId != null) {
|
while (domainId != null) {
|
||||||
|
|
@ -96,7 +96,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.NEQ, accountId); // we added the account specific ones above
|
sc.addAnd("accountId", SearchCriteria.Op.NEQ, accountId); // we added the account specific ones above
|
||||||
}
|
}
|
||||||
List<NetworkGroupVO> domainGroups = listActiveBy(sc);
|
List<NetworkGroupVO> domainGroups = listBy(sc);
|
||||||
availableGroups.addAll(domainGroups);
|
availableGroups.addAll(domainGroups);
|
||||||
|
|
||||||
// get the parent domain, repeat the loop
|
// get the parent domain, repeat the loop
|
||||||
|
|
@ -114,7 +114,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("groupName", name);
|
sc.setParameters("groupName", name);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -124,6 +124,6 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
||||||
|
|
||||||
sc.setParameters("groupNames", (Object [])names);
|
sc.setParameters("groupNames", (Object [])names);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("name", groupName);
|
sc.setParameters("name", groupName);
|
||||||
|
|
||||||
return listActiveBy(sc, searchFilter);
|
return listBy(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -56,7 +56,7 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
||||||
SearchCriteria<NetworkGroupRulesVO> sc = AccountSearch.create();
|
SearchCriteria<NetworkGroupRulesVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
|
|
||||||
return listActiveBy(sc, searchFilter);
|
return listBy(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -86,6 +86,6 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
||||||
sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
return listActiveBy(sc, searchFilter);
|
return listBy(sc, searchFilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,28 +79,28 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByIpAndVmId.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByIpAndVmId.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
sc.setParameters("instanceId", vmId);
|
sc.setParameters("instanceId", vmId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkGroupVMMapVO> listByNetworkGroup(long networkGroupId) {
|
public List<NetworkGroupVMMapVO> listByNetworkGroup(long networkGroupId) {
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroup.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroup.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkGroupVMMapVO> listByIp(String ipAddress) {
|
public List<NetworkGroupVMMapVO> listByIp(String ipAddress) {
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByIp.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByIp.create();
|
||||||
sc.setParameters("ipAddress", ipAddress);
|
sc.setParameters("ipAddress", ipAddress);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkGroupVMMapVO> listByInstanceId(long vmId) {
|
public List<NetworkGroupVMMapVO> listByInstanceId(long vmId) {
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmId.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmId.create();
|
||||||
sc.setParameters("instanceId", vmId);
|
sc.setParameters("instanceId", vmId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -115,7 +115,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroupAndStates.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroupAndStates.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
sc.setParameters("states", (Object[])vmStates);
|
sc.setParameters("states", (Object[])vmStates);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -130,7 +130,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
||||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmIdGroupId.create();
|
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmIdGroupId.create();
|
||||||
sc.setParameters("networkGroupId", networkGroupId);
|
sc.setParameters("networkGroupId", networkGroupId);
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
||||||
public NetworkGroupWorkVO findByVmId(long vmId, boolean taken) {
|
public NetworkGroupWorkVO findByVmId(long vmId, boolean taken) {
|
||||||
SearchCriteria<NetworkGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
|
SearchCriteria<NetworkGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
|
||||||
sc.setParameters("vmId", vmId);
|
sc.setParameters("vmId", vmId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -161,7 +161,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
||||||
SearchCriteria<NetworkGroupWorkVO> sc = VmIdStepSearch.create();
|
SearchCriteria<NetworkGroupWorkVO> sc = VmIdStepSearch.create();
|
||||||
sc.setParameters("vmId", vmId);
|
sc.setParameters("vmId", vmId);
|
||||||
sc.setParameters("step", step);
|
sc.setParameters("step", step);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -196,7 +196,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
||||||
sc.setParameters("taken", timeBefore);
|
sc.setParameters("taken", timeBefore);
|
||||||
sc.setParameters("step", Step.Processing);
|
sc.setParameters("step", Step.Processing);
|
||||||
|
|
||||||
List<NetworkGroupWorkVO> result = listBy(sc);
|
List<NetworkGroupWorkVO> result = listIncludingRemovedBy(sc);
|
||||||
|
|
||||||
NetworkGroupWorkVO work = createForUpdate();
|
NetworkGroupWorkVO work = createForUpdate();
|
||||||
work.setStep(Step.Error);
|
work.setStep(Step.Error);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> im
|
||||||
public VmRulesetLogVO findByVmId(long vmId) {
|
public VmRulesetLogVO findByVmId(long vmId) {
|
||||||
SearchCriteria<VmRulesetLogVO> sc = VmIdSearch.create();
|
SearchCriteria<VmRulesetLogVO> sc = VmIdSearch.create();
|
||||||
sc.setParameters("vmId", vmId);
|
sc.setParameters("vmId", vmId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,4 +164,10 @@ public class NetworkOfferingVO implements NetworkOffering {
|
||||||
public NetworkOfferingVO(String name, TrafficType trafficType, GuestIpType type) {
|
public NetworkOfferingVO(String name, TrafficType trafficType, GuestIpType type) {
|
||||||
this(name, "System Offering for " + name, trafficType, type, true, null, null, null);
|
this(name, "System Offering for " + name, trafficType, type, true, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder buf = new StringBuilder("[Network Offering [");
|
||||||
|
return buf.append(id).append("-").append(trafficType).append("-").append(name).append("-").append(guestIpType).append("]").toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,14 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
||||||
SearchCriteria<DiskOfferingVO> sc = DomainIdSearch.create();
|
SearchCriteria<DiskOfferingVO> sc = DomainIdSearch.create();
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
// FIXME: this should not be exact match, but instead should find all available disk offerings from parent domains
|
// FIXME: this should not be exact match, but instead should find all available disk offerings from parent domains
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskOfferingVO> findPrivateDiskOffering() {
|
public List<DiskOfferingVO> findPrivateDiskOffering() {
|
||||||
SearchCriteria<DiskOfferingVO> sc = PrivateDiskOfferingSearch.create();
|
SearchCriteria<DiskOfferingVO> sc = PrivateDiskOfferingSearch.create();
|
||||||
sc.setParameters("diskSize", 0);
|
sc.setParameters("diskSize", 0);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class DiskTemplateDaoImpl extends GenericDaoBase<DiskTemplateVO, Long> im
|
||||||
sc.setParameters("type", type);
|
sc.setParameters("type", type);
|
||||||
sc.setParameters("size", size);
|
sc.setParameters("size", size);
|
||||||
|
|
||||||
List<DiskTemplateVO> vos = listActiveBy(sc);
|
List<DiskTemplateVO> vos = listBy(sc);
|
||||||
assert(vos.size() <= 1); // Should only have one. If more than one something is wrong.
|
assert(vos.size() <= 1); // Should only have one. If more than one something is wrong.
|
||||||
return vos.size() == 0 ? null : vos.get(0);
|
return vos.size() == 0 ? null : vos.get(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
||||||
SearchCriteria<LaunchPermissionVO> sc = TemplateAndAccountSearch.create();
|
SearchCriteria<LaunchPermissionVO> sc = TemplateAndAccountSearch.create();
|
||||||
sc.setParameters("templateId", templateId);
|
sc.setParameters("templateId", templateId);
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -153,6 +153,6 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
||||||
public List<LaunchPermissionVO> findByTemplate(long templateId) {
|
public List<LaunchPermissionVO> findByTemplate(long templateId) {
|
||||||
SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
|
SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
|
||||||
sc.setParameters("templateId", templateId);
|
sc.setParameters("templateId", templateId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
||||||
public SnapshotVO findNextSnapshot(long snapshotId) {
|
public SnapshotVO findNextSnapshot(long snapshotId) {
|
||||||
SearchCriteria<SnapshotVO> sc = ParentIdSearch.create();
|
SearchCriteria<SnapshotVO> sc = ParentIdSearch.create();
|
||||||
sc.setParameters("prevSnapshotId", snapshotId);
|
sc.setParameters("prevSnapshotId", snapshotId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -52,7 +52,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
||||||
public List<SnapshotVO> listByVolumeId(Filter filter, long volumeId ) {
|
public List<SnapshotVO> listByVolumeId(Filter filter, long volumeId ) {
|
||||||
SearchCriteria<SnapshotVO> sc = VolumeIdSearch.create();
|
SearchCriteria<SnapshotVO> sc = VolumeIdSearch.create();
|
||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
return listActiveBy(sc, filter);
|
return listBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SnapshotDaoImpl() {
|
protected SnapshotDaoImpl() {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
||||||
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdIntervalSearch.create();
|
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdIntervalSearch.create();
|
||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
sc.setParameters("interval", interval);
|
sc.setParameters("interval", interval);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,7 +53,7 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
||||||
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
|
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
|
||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
sc.setParameters("active", true);
|
sc.setParameters("active", true);
|
||||||
return listActiveBy(sc, filter);
|
return listBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SnapshotPolicyDaoImpl() {
|
protected SnapshotPolicyDaoImpl() {
|
||||||
|
|
@ -76,6 +76,6 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
||||||
public List<SnapshotPolicyVO> listActivePolicies() {
|
public List<SnapshotPolicyVO> listActivePolicies() {
|
||||||
SearchCriteria<SnapshotPolicyVO> sc = ActivePolicySearch.create();
|
SearchCriteria<SnapshotPolicyVO> sc = ActivePolicySearch.create();
|
||||||
sc.setParameters("active", true);
|
sc.setParameters("active", true);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
sc.setParameters("snapshotId", snapshotId);
|
||||||
sc.setParameters("policyId", policyId);
|
sc.setParameters("policyId", policyId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -70,7 +70,7 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
||||||
public List<SnapshotPolicyRefVO> listBySnapshotId(long snapshotId) {
|
public List<SnapshotPolicyRefVO> listBySnapshotId(long snapshotId) {
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapSearch.create();
|
SearchCriteria<SnapshotPolicyRefVO> sc = snapSearch.create();
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
sc.setParameters("snapshotId", snapshotId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -78,6 +78,6 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = policySearch.create();
|
SearchCriteria<SnapshotPolicyRefVO> sc = policySearch.create();
|
||||||
sc.setParameters("policyId", policyId);
|
sc.setParameters("policyId", policyId);
|
||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +64,7 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
||||||
sc.setParameters("scheduledTimestamp", date);
|
sc.setParameters("scheduledTimestamp", date);
|
||||||
// Don't return manual snapshots. They will be executed through another code path.
|
// Don't return manual snapshots. They will be executed through another code path.
|
||||||
sc.addAnd("policyId", SearchCriteria.Op.NEQ, 1L);
|
sc.addAnd("policyId", SearchCriteria.Op.NEQ, 1L);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,7 +76,7 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
||||||
sc.setParameters("scheduledTimestamp", currentTimestamp);
|
sc.setParameters("scheduledTimestamp", currentTimestamp);
|
||||||
// Don't return manual snapshots. They will be executed through another code path.
|
// Don't return manual snapshots. They will be executed through another code path.
|
||||||
sc.addAnd("policyId", SearchCriteria.Op.NEQ, 1L);
|
sc.addAnd("policyId", SearchCriteria.Op.NEQ, 1L);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -92,7 +92,7 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
||||||
}
|
}
|
||||||
SearchCriteria.Op op = executing ? SearchCriteria.Op.NNULL : SearchCriteria.Op.NULL;
|
SearchCriteria.Op op = executing ? SearchCriteria.Op.NNULL : SearchCriteria.Op.NULL;
|
||||||
sc.addAnd("asyncJobId", op);
|
sc.addAnd("asyncJobId", op);
|
||||||
List<SnapshotScheduleVO> snapshotSchedules = listActiveBy(sc);
|
List<SnapshotScheduleVO> snapshotSchedules = listBy(sc);
|
||||||
// This will return only one schedule because of a DB uniqueness constraint.
|
// This will return only one schedule because of a DB uniqueness constraint.
|
||||||
assert (snapshotSchedules.size() <= 1);
|
assert (snapshotSchedules.size() <= 1);
|
||||||
if (snapshotSchedules.isEmpty()) {
|
if (snapshotSchedules.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
public List<StoragePoolVO> findPoolByName(String name) {
|
public List<StoragePoolVO> findPoolByName(String name) {
|
||||||
SearchCriteria<StoragePoolVO> sc = NameSearch.create();
|
SearchCriteria<StoragePoolVO> sc = NameSearch.create();
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -147,14 +147,14 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
public StoragePoolVO findPoolByUUID(String uuid) {
|
public StoragePoolVO findPoolByUUID(String uuid) {
|
||||||
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
||||||
sc.setParameters("uuid", uuid);
|
sc.setParameters("uuid", uuid);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
|
public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
|
||||||
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
||||||
sc.setParameters("uuid", uuid);
|
sc.setParameters("uuid", uuid);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -162,7 +162,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
public List<StoragePoolVO> listByDataCenterId(long datacenterId) {
|
public List<StoragePoolVO> listByDataCenterId(long datacenterId) {
|
||||||
SearchCriteria<StoragePoolVO> sc = DatacenterSearch.create();
|
SearchCriteria<StoragePoolVO> sc = DatacenterSearch.create();
|
||||||
sc.setParameters("datacenterId", datacenterId);
|
sc.setParameters("datacenterId", datacenterId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
public List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp) {
|
public List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp) {
|
||||||
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", hostFqdnOrIp);
|
sc.setParameters("host", hostFqdnOrIp);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -204,7 +204,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
sc.setParameters("datacenterId", datacenterId);
|
sc.setParameters("datacenterId", datacenterId);
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -215,12 +215,12 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
|
|
||||||
sc.setParameters("cluster", clusterId);
|
sc.setParameters("cluster", clusterId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
} else {
|
} else {
|
||||||
SearchCriteria<StoragePoolVO> sc = DcPodAnyClusterSearch.create();
|
SearchCriteria<StoragePoolVO> sc = DcPodAnyClusterSearch.create();
|
||||||
sc.setParameters("datacenterId", datacenterId);
|
sc.setParameters("datacenterId", datacenterId);
|
||||||
sc.setParameters("podId", podId);
|
sc.setParameters("podId", podId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +230,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
sc.setParameters("hostAddress", host);
|
sc.setParameters("hostAddress", host);
|
||||||
sc.setParameters("path", path);
|
sc.setParameters("path", path);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoragePoolVO listById(Integer id)
|
public StoragePoolVO listById(Integer id)
|
||||||
|
|
@ -238,7 +238,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||||
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
||||||
sc.setParameters("id", id);
|
sc.setParameters("id", id);
|
||||||
|
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailV
|
||||||
SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
|
SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
|
||||||
sc.setParameters("pool", poolId);
|
sc.setParameters("pool", poolId);
|
||||||
|
|
||||||
List<StoragePoolDetailVO> details = listActiveBy(sc);
|
List<StoragePoolDetailVO> details = listBy(sc);
|
||||||
Map<String, String> detailsMap = new HashMap<String, String>();
|
Map<String, String> detailsMap = new HashMap<String, String>();
|
||||||
for (StoragePoolDetailVO detail : details) {
|
for (StoragePoolDetailVO detail : details) {
|
||||||
detailsMap.put(detail.getName(), detail.getValue());
|
detailsMap.put(detail.getName(), detail.getValue());
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,14 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo
|
||||||
public List<StoragePoolHostVO> listByPoolId(long id) {
|
public List<StoragePoolHostVO> listByPoolId(long id) {
|
||||||
SearchCriteria<StoragePoolHostVO> sc = PoolSearch.create();
|
SearchCriteria<StoragePoolHostVO> sc = PoolSearch.create();
|
||||||
sc.setParameters("pool_id", id);
|
sc.setParameters("pool_id", id);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoragePoolHostVO> listByHostId(long hostId) {
|
public List<StoragePoolHostVO> listByHostId(long hostId) {
|
||||||
SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
|
SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -106,7 +106,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo
|
||||||
SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create();
|
SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create();
|
||||||
sc.setParameters("pool_id", poolId);
|
sc.setParameters("pool_id", poolId);
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -74,35 +74,35 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||||
public List<VMTemplateVO> listByPublic() {
|
public List<VMTemplateVO> listByPublic() {
|
||||||
SearchCriteria<VMTemplateVO> sc = PublicSearch.create();
|
SearchCriteria<VMTemplateVO> sc = PublicSearch.create();
|
||||||
sc.setParameters("public", 1);
|
sc.setParameters("public", 1);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findByName(String templateName) {
|
public VMTemplateVO findByName(String templateName) {
|
||||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||||
sc.setParameters("uniqueName", templateName);
|
sc.setParameters("uniqueName", templateName);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findByTemplateName(String templateName) {
|
public VMTemplateVO findByTemplateName(String templateName) {
|
||||||
SearchCriteria<VMTemplateVO> sc = NameSearch.create();
|
SearchCriteria<VMTemplateVO> sc = NameSearch.create();
|
||||||
sc.setParameters("name", templateName);
|
sc.setParameters("name", templateName);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findRoutingTemplate() {
|
public VMTemplateVO findRoutingTemplate() {
|
||||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||||
sc.setParameters("uniqueName", routerTmpltName);
|
sc.setParameters("uniqueName", routerTmpltName);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findConsoleProxyTemplate() {
|
public VMTemplateVO findConsoleProxyTemplate() {
|
||||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||||
sc.setParameters("uniqueName", consoleProxyTmpltName);
|
sc.setParameters("uniqueName", consoleProxyTmpltName);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -110,7 +110,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||||
SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
|
SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("ready", SearchCriteria.Op.EQ, true);
|
sc.addAnd("ready", SearchCriteria.Op.EQ, true);
|
||||||
sc.addAnd("format", SearchCriteria.Op.NEQ, Storage.ImageFormat.ISO);
|
sc.addAnd("format", SearchCriteria.Op.NEQ, Storage.ImageFormat.ISO);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -123,14 +123,14 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||||
if (path != null)
|
if (path != null)
|
||||||
sc.addAnd("path", SearchCriteria.Op.EQ, path);
|
sc.addAnd("path", SearchCriteria.Op.EQ, path);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateVO> listByAccountId(long accountId) {
|
public List<VMTemplateVO> listByAccountId(long accountId) {
|
||||||
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,8 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
PoolTemplateSearch.done();
|
PoolTemplateSearch.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(VMTemplateHostVO instance) {
|
@Override
|
||||||
|
public void update(VMTemplateHostVO instance) {
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -138,7 +139,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
public List<VMTemplateHostVO> listByHostId(long id) {
|
public List<VMTemplateHostVO> listByHostId(long id) {
|
||||||
SearchCriteria<VMTemplateHostVO> sc = HostSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host_id", id);
|
sc.setParameters("host_id", id);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,14 +147,14 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateHostVO> listByOnlyTemplateId(long templateId) {
|
public List<VMTemplateHostVO> listByOnlyTemplateId(long templateId) {
|
||||||
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -161,17 +162,15 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateHostVO> listByTemplateStatus(long templateId, VMTemplateHostVO.Status downloadState) {
|
public List<VMTemplateHostVO> listByTemplateStatus(long templateId, VMTemplateHostVO.Status downloadState) {
|
||||||
SearchCriteria<VMTemplateHostVO> sc = TemplateStatusSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = TemplateStatusSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
sc.setParameters("download_state", downloadState.toString());
|
sc.setParameters("download_state", downloadState.toString());
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -257,7 +256,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
sc.setParameters("pool_id", poolId);
|
sc.setParameters("pool_id", poolId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -265,7 +264,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -273,7 +272,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
SearchCriteria<VMTemplateHostVO> sc = PoolTemplateSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = PoolTemplateSearch.create();
|
||||||
sc.setParameters("pool_id", poolId);
|
sc.setParameters("pool_id", poolId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -281,7 +280,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
SearchCriteria<VMTemplateHostVO> sc = HostDestroyedSearch.create();
|
SearchCriteria<VMTemplateHostVO> sc = HostDestroyedSearch.create();
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
sc.setParameters("destroyed", true);
|
sc.setParameters("destroyed", true);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -290,7 +289,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
||||||
sc.setParameters("host_id", hostId);
|
sc.setParameters("host_id", hostId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
if (!lock)
|
if (!lock)
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
else
|
else
|
||||||
return lock(sc, true);
|
return lock(sc, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,14 +100,14 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
||||||
public List<VMTemplateStoragePoolVO> listByPoolId(long id) {
|
public List<VMTemplateStoragePoolVO> listByPoolId(long id) {
|
||||||
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolSearch.create();
|
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolSearch.create();
|
||||||
sc.setParameters("pool_id", id);
|
sc.setParameters("pool_id", id);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateStoragePoolVO> listByTemplateId(long templateId) {
|
public List<VMTemplateStoragePoolVO> listByTemplateId(long templateId) {
|
||||||
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateSearch.create();
|
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -115,7 +115,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
||||||
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolTemplateSearch.create();
|
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolTemplateSearch.create();
|
||||||
sc.setParameters("pool_id", hostId);
|
sc.setParameters("pool_id", hostId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -123,7 +123,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
||||||
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateStatusSearch.create();
|
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateStatusSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
sc.setParameters("download_state", downloadState.toString());
|
sc.setParameters("download_state", downloadState.toString());
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -132,7 +132,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
||||||
sc.setParameters("pool_id", poolId);
|
sc.setParameters("pool_id", poolId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
sc.setParameters("download_state", downloadState.toString());
|
sc.setParameters("download_state", downloadState.toString());
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,14 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
||||||
public List<VMTemplateZoneVO> listByZoneId(long id) {
|
public List<VMTemplateZoneVO> listByZoneId(long id) {
|
||||||
SearchCriteria<VMTemplateZoneVO> sc = ZoneSearch.create();
|
SearchCriteria<VMTemplateZoneVO> sc = ZoneSearch.create();
|
||||||
sc.setParameters("zone_id", id);
|
sc.setParameters("zone_id", id);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateZoneVO> listByTemplateId(long templateId) {
|
public List<VMTemplateZoneVO> listByTemplateId(long templateId) {
|
||||||
SearchCriteria<VMTemplateZoneVO> sc = TemplateSearch.create();
|
SearchCriteria<VMTemplateZoneVO> sc = TemplateSearch.create();
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -73,7 +73,7 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
||||||
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
||||||
sc.setParameters("zone_id", zoneId);
|
sc.setParameters("zone_id", zoneId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -81,7 +81,7 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
||||||
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
||||||
sc.setParameters("zone_id", zoneId);
|
sc.setParameters("zone_id", zoneId);
|
||||||
sc.setParameters("template_id", templateId);
|
sc.setParameters("template_id", templateId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = DetachedAccountIdSearch.create();
|
SearchCriteria<VolumeVO> sc = DetachedAccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -109,14 +109,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = AccountIdSearch.create();
|
SearchCriteria<VolumeVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VolumeVO> findByInstance(long id) {
|
public List<VolumeVO> findByInstance(long id) {
|
||||||
SearchCriteria<VolumeVO> sc = InstanceIdSearch.create();
|
SearchCriteria<VolumeVO> sc = InstanceIdSearch.create();
|
||||||
sc.setParameters("instanceId", id);
|
sc.setParameters("instanceId", id);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -124,14 +124,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = InstanceAndDeviceIdSearch.create();
|
SearchCriteria<VolumeVO> sc = InstanceAndDeviceIdSearch.create();
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
sc.setParameters("deviceId", deviceId);
|
sc.setParameters("deviceId", deviceId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VolumeVO> findByPoolId(long poolId) {
|
public List<VolumeVO> findByPoolId(long poolId) {
|
||||||
SearchCriteria<VolumeVO> sc = PoolIdSearch.create();
|
SearchCriteria<VolumeVO> sc = PoolIdSearch.create();
|
||||||
sc.setParameters("poolId", poolId);
|
sc.setParameters("poolId", poolId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -140,7 +140,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
sc.setParameters("instanceId", id);
|
sc.setParameters("instanceId", id);
|
||||||
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -148,7 +148,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = InstanceAndTypeSearch.create();
|
SearchCriteria<VolumeVO> sc = InstanceAndTypeSearch.create();
|
||||||
sc.setParameters("instanceId", id);
|
sc.setParameters("instanceId", id);
|
||||||
sc.setParameters("vType", vType.toString());
|
sc.setParameters("vType", vType.toString());
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -156,14 +156,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = InstanceIdDestroyedSearch.create();
|
SearchCriteria<VolumeVO> sc = InstanceIdDestroyedSearch.create();
|
||||||
sc.setParameters("instanceId", vmId);
|
sc.setParameters("instanceId", vmId);
|
||||||
sc.setParameters("destroyed", true);
|
sc.setParameters("destroyed", true);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VolumeVO> findByDetachedDestroyed() {
|
public List<VolumeVO> findByDetachedDestroyed() {
|
||||||
SearchCriteria<VolumeVO> sc = DetachedDestroyedSearch.create();
|
SearchCriteria<VolumeVO> sc = DetachedDestroyedSearch.create();
|
||||||
sc.setParameters("destroyed", true);
|
sc.setParameters("destroyed", true);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -174,7 +174,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
sc.setParameters("destroyed", false);
|
sc.setParameters("destroyed", false);
|
||||||
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -183,7 +183,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
sc.setParameters("template", templateId);
|
sc.setParameters("template", templateId);
|
||||||
sc.setParameters("zone", zoneId);
|
sc.setParameters("zone", zoneId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
|
|
@ -215,7 +215,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||||
SearchCriteria<VolumeVO> sc = MirrorSearch.create();
|
SearchCriteria<VolumeVO> sc = MirrorSearch.create();
|
||||||
sc.setParameters("mirrorState", MirrorState.ACTIVE.toString());
|
sc.setParameters("mirrorState", MirrorState.ACTIVE.toString());
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -112,26 +112,26 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
||||||
public List<AccountVO> findAccountsLike(String accountName) {
|
public List<AccountVO> findAccountsLike(String accountName) {
|
||||||
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("accountName", SearchCriteria.Op.LIKE, "%"+accountName+"%");
|
sc.addAnd("accountName", SearchCriteria.Op.LIKE, "%"+accountName+"%");
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Account findActiveAccount(String accountName, Long domainId) {
|
public Account findActiveAccount(String accountName, Long domainId) {
|
||||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Account findAccount(String accountName, Long domainId) {
|
public Account findAccount(String accountName, Long domainId) {
|
||||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account findActiveAccountByName(String accountName) {
|
public Account findActiveAccountByName(String accountName) {
|
||||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVO> findActiveAccounts(Long maxAccountId, Filter filter) {
|
public List<AccountVO> findActiveAccounts(Long maxAccountId, Filter filter) {
|
||||||
|
|
@ -140,7 +140,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
||||||
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("id", SearchCriteria.Op.LTEQ, maxAccountId);
|
sc.addAnd("id", SearchCriteria.Op.LTEQ, maxAccountId);
|
||||||
|
|
||||||
return listActiveBy(sc, filter);
|
return listBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVO> findRecentlyDeletedAccounts(Long maxAccountId, Date earliestRemovedDate, Filter filter) {
|
public List<AccountVO> findRecentlyDeletedAccounts(Long maxAccountId, Date earliestRemovedDate, Filter filter) {
|
||||||
|
|
@ -152,7 +152,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
||||||
sc.addAnd("removed", SearchCriteria.Op.NNULL);
|
sc.addAnd("removed", SearchCriteria.Op.NNULL);
|
||||||
sc.addAnd("removed", SearchCriteria.Op.GTEQ, earliestRemovedDate);
|
sc.addAnd("removed", SearchCriteria.Op.GTEQ, earliestRemovedDate);
|
||||||
|
|
||||||
return listBy(sc, filter);
|
return listIncludingRemovedBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVO> findNewAccounts(Long minAccountId, Filter filter) {
|
public List<AccountVO> findNewAccounts(Long minAccountId, Filter filter) {
|
||||||
|
|
@ -161,7 +161,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
||||||
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("id", SearchCriteria.Op.GT, minAccountId);
|
sc.addAnd("id", SearchCriteria.Op.GT, minAccountId);
|
||||||
|
|
||||||
return listBy(sc, filter);
|
return listIncludingRemovedBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class UserAccountDaoImpl extends GenericDaoBase<UserAccountVO, Long> impl
|
||||||
SearchCriteria<UserAccountVO> sc = createSearchCriteria();
|
SearchCriteria<UserAccountVO> sc = createSearchCriteria();
|
||||||
sc.addAnd("username", SearchCriteria.Op.EQ, username);
|
sc.addAnd("username", SearchCriteria.Op.EQ, username);
|
||||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -75,41 +75,41 @@ public class UserDaoImpl extends GenericDaoBase<UserVO, Long> implements UserDao
|
||||||
SearchCriteria<UserVO> sc = UsernamePasswordSearch.create();
|
SearchCriteria<UserVO> sc = UsernamePasswordSearch.create();
|
||||||
sc.setParameters("username", username);
|
sc.setParameters("username", username);
|
||||||
sc.setParameters("password", password);
|
sc.setParameters("password", password);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserVO> listByAccount(long accountId) {
|
public List<UserVO> listByAccount(long accountId) {
|
||||||
SearchCriteria<UserVO> sc = AccountIdSearch.create();
|
SearchCriteria<UserVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
return listActiveBy(sc, null);
|
return listBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVO getUser(String username) {
|
public UserVO getUser(String username) {
|
||||||
SearchCriteria<UserVO> sc = UsernameSearch.create();
|
SearchCriteria<UserVO> sc = UsernameSearch.create();
|
||||||
sc.setParameters("username", username);
|
sc.setParameters("username", username);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVO getUser(long userId) {
|
public UserVO getUser(long userId) {
|
||||||
SearchCriteria<UserVO> sc = UserIdSearch.create();
|
SearchCriteria<UserVO> sc = UserIdSearch.create();
|
||||||
sc.setParameters("id", userId);
|
sc.setParameters("id", userId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserVO> findUsersLike(String username) {
|
public List<UserVO> findUsersLike(String username) {
|
||||||
SearchCriteria<UserVO> sc = UsernameLikeSearch.create();
|
SearchCriteria<UserVO> sc = UsernameLikeSearch.create();
|
||||||
sc.setParameters("username", "%" + username + "%");
|
sc.setParameters("username", "%" + username + "%");
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVO findUserBySecretKey(String secretKey) {
|
public UserVO findUserBySecretKey(String secretKey) {
|
||||||
SearchCriteria<UserVO> sc = SecretKeySearch.create();
|
SearchCriteria<UserVO> sc = SecretKeySearch.create();
|
||||||
sc.setParameters("secretKey", secretKey);
|
sc.setParameters("secretKey", secretKey);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class UserStatisticsDaoImpl extends GenericDaoBase<UserStatisticsVO, Long
|
||||||
SearchCriteria<UserStatisticsVO> sc = UserDcSearch.create();
|
SearchCriteria<UserStatisticsVO> sc = UserDcSearch.create();
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ public class VMInstanceVO implements VirtualMachine {
|
||||||
Type type,
|
Type type,
|
||||||
Long vmTemplateId,
|
Long vmTemplateId,
|
||||||
long guestOSId,
|
long guestOSId,
|
||||||
|
|
||||||
boolean haEnabled) {
|
boolean haEnabled) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
@ -138,6 +139,9 @@ public class VMInstanceVO implements VirtualMachine {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.guestOSId = guestOSId;
|
this.guestOSId = guestOSId;
|
||||||
this.haEnabled = haEnabled;
|
this.haEnabled = haEnabled;
|
||||||
|
this.mirroredVols = false;
|
||||||
|
this.vncPassword = Long.toHexString(new Random().nextLong());
|
||||||
|
this.state = State.Creating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -193,11 +197,13 @@ public class VMInstanceVO implements VirtualMachine {
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
@Override
|
||||||
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
@Override
|
||||||
|
public Date getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,7 +211,8 @@ public class VMInstanceVO implements VirtualMachine {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDataCenterId() {
|
@Override
|
||||||
|
public long getDataCenterId() {
|
||||||
return dataCenterId;
|
return dataCenterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,7 +299,8 @@ public class VMInstanceVO implements VirtualMachine {
|
||||||
this.templateId = templateId;
|
this.templateId = templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getGuestOSId() {
|
@Override
|
||||||
|
public long getGuestOSId() {
|
||||||
return guestOSId;
|
return guestOSId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,21 +231,21 @@ public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> im
|
||||||
SearchCriteria<ConsoleProxyVO> sc = DataCenterStatusSearch.create();
|
SearchCriteria<ConsoleProxyVO> sc = DataCenterStatusSearch.create();
|
||||||
sc.setParameters("states", (Object[])states);
|
sc.setParameters("states", (Object[])states);
|
||||||
sc.setParameters("dc", dataCenterId);
|
sc.setParameters("dc", dataCenterId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConsoleProxyVO> getProxyListInStates(State... states) {
|
public List<ConsoleProxyVO> getProxyListInStates(State... states) {
|
||||||
SearchCriteria<ConsoleProxyVO> sc = StateSearch.create();
|
SearchCriteria<ConsoleProxyVO> sc = StateSearch.create();
|
||||||
sc.setParameters("states", (Object[])states);
|
sc.setParameters("states", (Object[])states);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConsoleProxyVO> listByHostId(long hostId) {
|
public List<ConsoleProxyVO> listByHostId(long hostId) {
|
||||||
SearchCriteria<ConsoleProxyVO> sc = HostSearch.create();
|
SearchCriteria<ConsoleProxyVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -253,7 +253,7 @@ public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> im
|
||||||
SearchCriteria<ConsoleProxyVO> sc = HostUpSearch.create();
|
SearchCriteria<ConsoleProxyVO> sc = HostUpSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
public DomainRouterVO findByPublicIpAddress(String ipAddress) {
|
public DomainRouterVO findByPublicIpAddress(String ipAddress) {
|
||||||
SearchCriteria<DomainRouterVO> sc = IpSearch.create();
|
SearchCriteria<DomainRouterVO> sc = IpSearch.create();
|
||||||
sc.setParameters("ip", ipAddress);
|
sc.setParameters("ip", ipAddress);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -196,7 +196,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
public List<DomainRouterVO> listByDataCenter(long dcId) {
|
public List<DomainRouterVO> listByDataCenter(long dcId) {
|
||||||
SearchCriteria<DomainRouterVO> sc = DcSearch.create();
|
SearchCriteria<DomainRouterVO> sc = DcSearch.create();
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -205,7 +205,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("role", Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
|
sc.setParameters("role", Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -214,21 +214,21 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("role", role);
|
sc.setParameters("role", role);
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DomainRouterVO> listBy(long accountId) {
|
public List<DomainRouterVO> listBy(long accountId) {
|
||||||
SearchCriteria<DomainRouterVO> sc = AccountSearch.create();
|
SearchCriteria<DomainRouterVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DomainRouterVO> listByHostId(Long hostId) {
|
public List<DomainRouterVO> listByHostId(Long hostId) {
|
||||||
SearchCriteria<DomainRouterVO> sc = HostSearch.create();
|
SearchCriteria<DomainRouterVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -238,7 +238,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
}
|
}
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -287,13 +287,13 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||||
public List<DomainRouterVO> listByDomain(Long domainId) {
|
public List<DomainRouterVO> listByDomain(Long domainId) {
|
||||||
SearchCriteria<DomainRouterVO> sc = DomainIdSearch.create();
|
SearchCriteria<DomainRouterVO> sc = DomainIdSearch.create();
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DomainRouterVO> listByVlanDbId(Long vlanDbId) {
|
public List<DomainRouterVO> listByVlanDbId(Long vlanDbId) {
|
||||||
SearchCriteria<DomainRouterVO> sc = VlanDbIdSearch.create();
|
SearchCriteria<DomainRouterVO> sc = VlanDbIdSearch.create();
|
||||||
sc.setParameters("vlanDbId", vlanDbId);
|
sc.setParameters("vlanDbId", vlanDbId);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,21 +158,21 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
||||||
SearchCriteria<SecondaryStorageVmVO> sc = DataCenterStatusSearch.create();
|
SearchCriteria<SecondaryStorageVmVO> sc = DataCenterStatusSearch.create();
|
||||||
sc.setParameters("states", (Object[])states);
|
sc.setParameters("states", (Object[])states);
|
||||||
sc.setParameters("dc", dataCenterId);
|
sc.setParameters("dc", dataCenterId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecondaryStorageVmVO> getSecStorageVmListInStates(State... states) {
|
public List<SecondaryStorageVmVO> getSecStorageVmListInStates(State... states) {
|
||||||
SearchCriteria<SecondaryStorageVmVO> sc = StateSearch.create();
|
SearchCriteria<SecondaryStorageVmVO> sc = StateSearch.create();
|
||||||
sc.setParameters("states", (Object[])states);
|
sc.setParameters("states", (Object[])states);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecondaryStorageVmVO> listByHostId(long hostId) {
|
public List<SecondaryStorageVmVO> listByHostId(long hostId) {
|
||||||
SearchCriteria<SecondaryStorageVmVO> sc = HostSearch.create();
|
SearchCriteria<SecondaryStorageVmVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -180,7 +180,7 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
||||||
SearchCriteria<SecondaryStorageVmVO> sc = HostUpSearch.create();
|
SearchCriteria<SecondaryStorageVmVO> sc = HostUpSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -208,6 +208,6 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
||||||
public List<SecondaryStorageVmVO> listByZoneId(long zoneId) {
|
public List<SecondaryStorageVmVO> listByZoneId(long zoneId) {
|
||||||
SearchCriteria<SecondaryStorageVmVO> sc = ZoneSearch.create();
|
SearchCriteria<SecondaryStorageVmVO> sc = ZoneSearch.create();
|
||||||
sc.setParameters("zone", zoneId);
|
sc.setParameters("zone", zoneId);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("pod", podId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserVmVO> listByAccountAndDataCenter(long accountId, long dcId) {
|
public List<UserVmVO> listByAccountAndDataCenter(long accountId, long dcId) {
|
||||||
|
|
@ -135,7 +135,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -148,7 +148,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
ssc.addOr("state", SearchCriteria.Op.EQ, state.toString());
|
ssc.addOr("state", SearchCriteria.Op.EQ, state.toString());
|
||||||
}
|
}
|
||||||
sc.addAnd("state", SearchCriteria.Op.SC, ssc);
|
sc.addAnd("state", SearchCriteria.Op.SC, ssc);
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -165,7 +165,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
|
|
||||||
sc.setParameters("router", routerId);
|
sc.setParameters("router", routerId);
|
||||||
|
|
||||||
return listBy(sc);
|
return listIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -225,20 +225,20 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("state", State.Destroyed, State.Expunging);
|
sc.setParameters("state", State.Destroyed, State.Expunging);
|
||||||
sc.setParameters("updateTime", date);
|
sc.setParameters("updateTime", date);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserVmVO> listByAccountId(long id) {
|
public List<UserVmVO> listByAccountId(long id) {
|
||||||
SearchCriteria<UserVmVO> sc = AccountSearch.create();
|
SearchCriteria<UserVmVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("account", id);
|
sc.setParameters("account", id);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserVmVO> listByHostId(Long id) {
|
public List<UserVmVO> listByHostId(Long id) {
|
||||||
SearchCriteria<UserVmVO> sc = HostSearch.create();
|
SearchCriteria<UserVmVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", id);
|
sc.setParameters("host", id);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -246,7 +246,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
SearchCriteria<UserVmVO> sc = HostUpSearch.create();
|
SearchCriteria<UserVmVO> sc = HostUpSearch.create();
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserVmVO> listRunningByHostId(long hostId) {
|
public List<UserVmVO> listRunningByHostId(long hostId) {
|
||||||
|
|
@ -254,13 +254,13 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("host", hostId);
|
sc.setParameters("host", hostId);
|
||||||
sc.setParameters("state", State.Running);
|
sc.setParameters("state", State.Running);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserVmVO findByName(String name) {
|
public UserVmVO findByName(String name) {
|
||||||
SearchCriteria<UserVmVO> sc = NameSearch.create();
|
SearchCriteria<UserVmVO> sc = NameSearch.create();
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -282,7 +282,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setJoinParameters("offeringSearch", "guestIpType", NetworkOffering.GuestIpType.Virtualized);
|
sc.setJoinParameters("offeringSearch", "guestIpType", NetworkOffering.GuestIpType.Virtualized);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -292,6 +292,6 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||||
sc.setParameters("ip", ipAddress);
|
sc.setParameters("ip", ipAddress);
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Expunging});
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
public List<VMInstanceVO> findVMInstancesLike(String name) {
|
public List<VMInstanceVO> findVMInstancesLike(String name) {
|
||||||
SearchCriteria<VMInstanceVO> sc = NameLikeSearch.create();
|
SearchCriteria<VMInstanceVO> sc = NameLikeSearch.create();
|
||||||
sc.setParameters("name", "%" + name + "%");
|
sc.setParameters("name", "%" + name + "%");
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -180,7 +180,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = HostSearch.create();
|
SearchCriteria<VMInstanceVO> sc = HostSearch.create();
|
||||||
sc.setParameters("host", hostid);
|
sc.setParameters("host", hostid);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -188,7 +188,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = LastHostSearch.create();
|
SearchCriteria<VMInstanceVO> sc = LastHostSearch.create();
|
||||||
sc.setParameters("lastHost", hostId);
|
sc.setParameters("lastHost", hostId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -196,7 +196,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = ZoneSearch.create();
|
SearchCriteria<VMInstanceVO> sc = ZoneSearch.create();
|
||||||
sc.setParameters("zone", zoneId);
|
sc.setParameters("zone", zoneId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -204,7 +204,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = ZoneVmTypeSearch.create();
|
SearchCriteria<VMInstanceVO> sc = ZoneVmTypeSearch.create();
|
||||||
sc.setParameters("zone", zoneId);
|
sc.setParameters("zone", zoneId);
|
||||||
sc.setParameters("type", type.toString());
|
sc.setParameters("type", type.toString());
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
sc.setParameters("template", templateId);
|
sc.setParameters("template", templateId);
|
||||||
sc.setParameters("state", State.Expunging);
|
sc.setParameters("state", State.Expunging);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -255,7 +255,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = HostIdTypesSearch.create();
|
SearchCriteria<VMInstanceVO> sc = HostIdTypesSearch.create();
|
||||||
sc.setParameters("hostid", hostid);
|
sc.setParameters("hostid", hostid);
|
||||||
sc.setParameters("types", (Object[]) types);
|
sc.setParameters("types", (Object[]) types);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -264,14 +264,14 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
sc.setParameters("hostid", hostid);
|
sc.setParameters("hostid", hostid);
|
||||||
sc.setParameters("types", (Object[]) types);
|
sc.setParameters("types", (Object[]) types);
|
||||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMInstanceVO> listByTypes(Type... types) {
|
public List<VMInstanceVO> listByTypes(Type... types) {
|
||||||
SearchCriteria<VMInstanceVO> sc = TypesSearch.create();
|
SearchCriteria<VMInstanceVO> sc = TypesSearch.create();
|
||||||
sc.setParameters("types", (Object[]) types);
|
sc.setParameters("types", (Object[]) types);
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -279,7 +279,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||||
SearchCriteria<VMInstanceVO> sc = IdTypesSearch.create();
|
SearchCriteria<VMInstanceVO> sc = IdTypesSearch.create();
|
||||||
sc.setParameters("id", id);
|
sc.setParameters("id", id);
|
||||||
sc.setParameters("types", (Object[]) types);
|
sc.setParameters("types", (Object[]) types);
|
||||||
return findOneBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ import com.cloud.utils.nio.NioServer;
|
||||||
import com.cloud.utils.nio.Task;
|
import com.cloud.utils.nio.Task;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -400,7 +400,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
||||||
public Host findHost(final Host.Type type, final DataCenterVO dc, final HostPodVO pod, final StoragePoolVO sp,
|
public Host findHost(final Host.Type type, final DataCenterVO dc, final HostPodVO pod, final StoragePoolVO sp,
|
||||||
final ServiceOffering offering, final VMTemplateVO template, VMInstanceVO vm,
|
final ServiceOffering offering, final VMTemplateVO template, VMInstanceVO vm,
|
||||||
Host currentHost, final Set<Host> avoid) {
|
Host currentHost, final Set<Host> avoid) {
|
||||||
VmCharacteristics vmc = new VmCharacteristics(vm.getType());
|
VirtualMachineProfile vmc = new VirtualMachineProfile(vm.getType());
|
||||||
Enumeration<HostAllocator> en = _hostAllocators.enumeration();
|
Enumeration<HostAllocator> en = _hostAllocators.enumeration();
|
||||||
while (en.hasMoreElements()) {
|
while (en.hasMoreElements()) {
|
||||||
final HostAllocator allocator = en.nextElement();
|
final HostAllocator allocator = en.nextElement();
|
||||||
|
|
@ -1065,7 +1065,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pod findPod(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids) {
|
public Pod findPod(VirtualMachineProfile vm, DataCenter dc, Set<? extends Pod> avoids) {
|
||||||
for (PodAllocator allocator : _podAllocators) {
|
for (PodAllocator allocator : _podAllocators) {
|
||||||
Pod pod = allocator.allocateTo(vm, dc, avoids);
|
Pod pod = allocator.allocateTo(vm, dc, avoids);
|
||||||
if (pod != null) {
|
if (pod != null) {
|
||||||
|
|
@ -1774,7 +1774,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Host findHost(VmCharacteristics vm, Set<? extends Host> avoids) {
|
public Host findHost(VirtualMachineProfile vm, Set<? extends Host> avoids) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import com.cloud.offering.ServiceOffering;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.uservm.UserVm;
|
import com.cloud.uservm.UserVm;
|
||||||
import com.cloud.utils.component.Adapter;
|
import com.cloud.utils.component.Adapter;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
public interface HostAllocator extends Adapter {
|
public interface HostAllocator extends Adapter {
|
||||||
boolean isVirtualMachineUpgradable(final UserVm vm, final ServiceOffering offering);
|
boolean isVirtualMachineUpgradable(final UserVm vm, final ServiceOffering offering);
|
||||||
Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Type type, DataCenterVO dc, HostPodVO pod, Long clusterId, VMTemplateVO template, Set<Host> avoid);
|
Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Type type, DataCenterVO dc, HostPodVO pod, Long clusterId, VMTemplateVO template, Set<Host> avoid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.template.VirtualMachineTemplate;
|
import com.cloud.template.VirtualMachineTemplate;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.Adapter;
|
import com.cloud.utils.component.Adapter;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
public interface PodAllocator extends Adapter {
|
public interface PodAllocator extends Adapter {
|
||||||
Pair<HostPodVO, Long> allocateTo(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
Pair<HostPodVO, Long> allocateTo(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
||||||
|
|
||||||
Pod allocateTo(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids);
|
Pod allocateTo(VirtualMachineProfile vm, DataCenter dc, Set<? extends Pod> avoids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
import com.cloud.vm.SecondaryStorageVmVO;
|
import com.cloud.vm.SecondaryStorageVmVO;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||||
|
|
@ -83,7 +83,7 @@ public class FirstFitAllocator implements HostAllocator {
|
||||||
protected String _allocationAlgorithm = "random";
|
protected String _allocationAlgorithm = "random";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Type type, DataCenterVO dc,
|
public Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Type type, DataCenterVO dc,
|
||||||
HostPodVO pod, Long clusterId, VMTemplateVO template,
|
HostPodVO pod, Long clusterId, VMTemplateVO template,
|
||||||
Set<Host> avoid) {
|
Set<Host> avoid) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import com.cloud.host.Host;
|
||||||
import com.cloud.offering.ServiceOffering;
|
import com.cloud.offering.ServiceOffering;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
@Local(value={HostAllocator.class})
|
@Local(value={HostAllocator.class})
|
||||||
public class FirstFitRoutingAllocator extends FirstFitAllocator {
|
public class FirstFitRoutingAllocator extends FirstFitAllocator {
|
||||||
@Override
|
@Override
|
||||||
public Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
public Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
||||||
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
||||||
try {
|
try {
|
||||||
NDC.push("FirstFitRoutingAllocator");
|
NDC.push("FirstFitRoutingAllocator");
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.uservm.UserVm;
|
import com.cloud.uservm.UserVm;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
@Local(value=HostAllocator.class)
|
@Local(value=HostAllocator.class)
|
||||||
public class RandomAllocator implements HostAllocator {
|
public class RandomAllocator implements HostAllocator {
|
||||||
|
|
@ -45,7 +45,7 @@ public class RandomAllocator implements HostAllocator {
|
||||||
private HostDao _hostDao;
|
private HostDao _hostDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
public Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
||||||
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
||||||
if (type == Host.Type.Storage) {
|
if (type == Host.Type.Storage) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import com.cloud.storage.dao.StoragePoolDao;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
@Local(value=HostAllocator.class)
|
@Local(value=HostAllocator.class)
|
||||||
public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
||||||
|
|
@ -53,7 +53,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
||||||
@Inject AgentManager _agentMgr;
|
@Inject AgentManager _agentMgr;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
public Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
||||||
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
||||||
Host host = super.allocateTo(vm, offering, type, dc, pod, clusterId, template, avoid);
|
Host host = super.allocateTo(vm, offering, type, dc, pod, clusterId, template, avoid);
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.uservm.UserVm;
|
import com.cloud.uservm.UserVm;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ahuang
|
* @author ahuang
|
||||||
|
|
@ -47,7 +47,7 @@ public class TestingAllocator implements HostAllocator {
|
||||||
String _name;
|
String _name;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Host allocateTo(VmCharacteristics vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
public Host allocateTo(VirtualMachineProfile vm, ServiceOffering offering, Host.Type type, DataCenterVO dc, HostPodVO pod,
|
||||||
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
Long clusterId, VMTemplateVO template, Set<Host> avoid) {
|
||||||
if (type == Host.Type.Routing && _routingHost != null) {
|
if (type == Host.Type.Routing && _routingHost != null) {
|
||||||
return _hostDao.findById(_routingHost);
|
return _hostDao.findById(_routingHost);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ import com.cloud.vm.State;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VmCharacteristics;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.dao.UserVmDao;
|
import com.cloud.vm.dao.UserVmDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ public class UserConcentratedAllocator implements PodAllocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pod allocateTo(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids) {
|
public Pod allocateTo(VirtualMachineProfile vm, DataCenter dc, Set<? extends Pod> avoids) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,10 @@ public enum Config {
|
||||||
CheckPodCIDRs("Advanced", ManagementServer.class, String.class, "check.pod.cidrs", "true", "If true, different pods must belong to different CIDR subnets.", "true,false"),
|
CheckPodCIDRs("Advanced", ManagementServer.class, String.class, "check.pod.cidrs", "true", "If true, different pods must belong to different CIDR subnets.", "true,false"),
|
||||||
MD5Hashed("Advanced", ManagementServer.class, Boolean.class, "security.password.md5hashed", "true", "If set to false password is sent in clear text or else md5hashed", null),
|
MD5Hashed("Advanced", ManagementServer.class, Boolean.class, "security.password.md5hashed", "true", "If set to false password is sent in clear text or else md5hashed", null),
|
||||||
|
|
||||||
|
ControlCidr("Advanced", ManagementServer.class, String.class, "control.cidr", "169.254.0.0/16", "Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods", null),
|
||||||
|
ControlGateway("Advanced", ManagementServer.class, String.class, "control.gateway", "169.254.0.1", "gateway for the control network traffic", null),
|
||||||
|
|
||||||
|
|
||||||
// XenServer
|
// XenServer
|
||||||
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),
|
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),
|
||||||
XenPublicNetwork("Network", ManagementServer.class, String.class, "xen.public.network.device", null, "[ONLY IF THE PUBLIC NETWORK IS ON A DEDICATED NIC]:The network name label of the physical device dedicated to the public network on a XenServer host", null),
|
XenPublicNetwork("Network", ManagementServer.class, String.class, "xen.public.network.device", null, "[ONLY IF THE PUBLIC NETWORK IS ON A DEDICATED NIC]:The network name label of the physical device dedicated to the public network on a XenServer host", null),
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||||
checkPodAttributes(podId, newPodName, pod.getDataCenterId(), gateway, cidr, startIp, endIp, checkForDuplicates);
|
checkPodAttributes(podId, newPodName, pod.getDataCenterId(), gateway, cidr, startIp, endIp, checkForDuplicates);
|
||||||
|
|
||||||
String cidrAddress = getCidrAddress(cidr);
|
String cidrAddress = getCidrAddress(cidr);
|
||||||
long cidrSize = getCidrSize(cidr);
|
int cidrSize = getCidrSize(cidr);
|
||||||
|
|
||||||
if (startIp != null && endIp == null) {
|
if (startIp != null && endIp == null) {
|
||||||
endIp = NetUtils.getIpRangeEndIpFromCidr(cidrAddress, cidrSize);
|
endIp = NetUtils.getIpRangeEndIpFromCidr(cidrAddress, cidrSize);
|
||||||
|
|
@ -457,7 +457,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||||
checkPodAttributes(-1, podName, zoneId, gateway, cidr, startIp, endIp, true);
|
checkPodAttributes(-1, podName, zoneId, gateway, cidr, startIp, endIp, true);
|
||||||
|
|
||||||
String cidrAddress = getCidrAddress(cidr);
|
String cidrAddress = getCidrAddress(cidr);
|
||||||
long cidrSize = getCidrSize(cidr);
|
int cidrSize = getCidrSize(cidr);
|
||||||
|
|
||||||
if (startIp != null) {
|
if (startIp != null) {
|
||||||
if (endIp == null) {
|
if (endIp == null) {
|
||||||
|
|
@ -1562,9 +1562,9 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||||
return cidrPair[0];
|
return cidrPair[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getCidrSize(String cidr) {
|
private int getCidrSize(String cidr) {
|
||||||
String[] cidrPair = cidr.split("\\/");
|
String[] cidrPair = cidr.split("\\/");
|
||||||
return Long.parseLong(cidrPair[1]);
|
return Integer.parseInt(cidrPair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCidrAddress(long podId) {
|
private String getCidrAddress(long podId) {
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ import com.cloud.dc.VlanVO;
|
||||||
import com.cloud.dc.dao.DataCenterDao;
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
import com.cloud.dc.dao.HostPodDao;
|
import com.cloud.dc.dao.HostPodDao;
|
||||||
import com.cloud.dc.dao.VlanDao;
|
import com.cloud.dc.dao.VlanDao;
|
||||||
|
import com.cloud.deploy.DataCenterDeployment;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.event.EventState;
|
import com.cloud.event.EventState;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
|
|
@ -140,6 +141,7 @@ import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VirtualMachine.Event;
|
import com.cloud.vm.VirtualMachine.Event;
|
||||||
import com.cloud.vm.VirtualMachineManager;
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.VmManager;
|
import com.cloud.vm.VmManager;
|
||||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
@ -840,7 +842,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
s_logger.debug("Assign console proxy from a newly started instance for request from data center : " + dataCenterId);
|
s_logger.debug("Assign console proxy from a newly started instance for request from data center : " + dataCenterId);
|
||||||
|
|
||||||
Map<String, Object> context = createProxyInstance(dataCenterId);
|
Map<String, Object> context = createProxyInstance2(dataCenterId);
|
||||||
|
|
||||||
long proxyVmId = (Long) context.get("proxyVmId");
|
long proxyVmId = (Long) context.get("proxyVmId");
|
||||||
if (proxyVmId == 0) {
|
if (proxyVmId == 0) {
|
||||||
|
|
@ -879,7 +881,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
s_logger.debug("Assign console proxy from a newly started instance for request from data center : " + dataCenterId);
|
s_logger.debug("Assign console proxy from a newly started instance for request from data center : " + dataCenterId);
|
||||||
|
|
||||||
Map<String, Object> context = createProxyInstance(dataCenterId);
|
Map<String, Object> context = createProxyInstance2(dataCenterId);
|
||||||
|
|
||||||
long proxyVmId = (Long) context.get("proxyVmId");
|
long proxyVmId = (Long) context.get("proxyVmId");
|
||||||
if (proxyVmId == 0) {
|
if (proxyVmId == 0) {
|
||||||
|
|
@ -1012,16 +1014,19 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
|
|
||||||
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
||||||
String name = VirtualMachineName.getConsoleProxyName(id, _instance);
|
String name = VirtualMachineName.getConsoleProxyName(id, _instance);
|
||||||
|
|
||||||
DataCenterVO dc = _dcDao.findById(dataCenterId);
|
DataCenterVO dc = _dcDao.findById(dataCenterId);
|
||||||
|
|
||||||
ConsoleProxyVO proxy = new ConsoleProxyVO(id, name, _template.getId(), _template.getGuestOSId(), dataCenterId, 0);
|
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId, 1);
|
||||||
proxy = _consoleProxyDao.persist(proxy);
|
|
||||||
List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemVmControlNetwork, NetworkOfferingVO.SystemVmManagementNetwork, NetworkOfferingVO.SystemVmPublicNetwork);
|
List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemVmControlNetwork, NetworkOfferingVO.SystemVmManagementNetwork, NetworkOfferingVO.SystemVmPublicNetwork);
|
||||||
List<NetworkConfigurationVO> profiles = new ArrayList<NetworkConfigurationVO>(offerings.size());
|
List<NetworkConfigurationVO> profiles = new ArrayList<NetworkConfigurationVO>(offerings.size());
|
||||||
|
for (NetworkOfferingVO offering : offerings) {
|
||||||
|
profiles.add(_networkMgr.setupNetworkProfile(_accountMgr.getSystemAccount(), offering, plan));
|
||||||
|
}
|
||||||
|
ConsoleProxyVO proxy = new ConsoleProxyVO(id, name, _template.getId(), _template.getGuestOSId(), dataCenterId, 0);
|
||||||
|
proxy = _consoleProxyDao.persist(proxy);
|
||||||
try {
|
try {
|
||||||
proxy = _vmMgr.allocate(proxy, _template, _serviceOffering, profiles, dc, _accountMgr.getSystemAccount());
|
VirtualMachineProfile vmProfile = _vmMgr.allocate(proxy, _template, _serviceOffering, profiles, plan, _accountMgr.getSystemAccount());
|
||||||
proxy = _vmMgr.create(proxy);
|
|
||||||
} catch (InsufficientCapacityException e) {
|
} catch (InsufficientCapacityException e) {
|
||||||
s_logger.warn("InsufficientCapacity", e);
|
s_logger.warn("InsufficientCapacity", e);
|
||||||
throw new CloudRuntimeException("Insufficient capcity exception", e);
|
throw new CloudRuntimeException("Insufficient capcity exception", e);
|
||||||
|
|
@ -1030,95 +1035,14 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
throw new CloudRuntimeException("Unable to contact storage", e);
|
throw new CloudRuntimeException("Unable to contact storage", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
Map<String, Object> context = new HashMap<String, Object>();
|
||||||
|
context.put("dc", dc);
|
||||||
|
// context.put("publicIpAddress", publicIpAndVlan._ipAddr);
|
||||||
/*
|
HostPodVO pod = _podDao.findById(proxy.getPodId());
|
||||||
Transaction txn = Transaction.currentTxn();
|
context.put("pod", pod);
|
||||||
try {
|
context.put("proxyVmId", proxy.getId());
|
||||||
DataCenterVO dc = _dcDao.findById(dataCenterId);
|
|
||||||
assert (dc != null);
|
|
||||||
context.put("dc", dc);
|
|
||||||
|
|
||||||
// this will basically allocate the pod based on data center id as
|
return context;
|
||||||
// we use system user id here
|
|
||||||
Set<Long> avoidPods = new HashSet<Long>();
|
|
||||||
Pair<HostPodVO, Long> pod = null;
|
|
||||||
networkInfo publicIpAndVlan = null;
|
|
||||||
|
|
||||||
// About MAC address allocation
|
|
||||||
// MAC address used by User VM is inherited from DomR MAC address,
|
|
||||||
// with the least 16 bits overrided. to avoid
|
|
||||||
// potential conflicts, domP will mask bit 31
|
|
||||||
//
|
|
||||||
String[] macAddresses = _dcDao.getNextAvailableMacAddressPair(dataCenterId, (1L << 31));
|
|
||||||
String privateMacAddress = macAddresses[0];
|
|
||||||
String publicMacAddress = macAddresses[1];
|
|
||||||
macAddresses = _dcDao.getNextAvailableMacAddressPair(dataCenterId, (1L << 31));
|
|
||||||
String guestMacAddress = macAddresses[0];
|
|
||||||
while ((pod = _agentMgr.findPod(_template, _serviceOffering, dc, Account.ACCOUNT_ID_SYSTEM, avoidPods)) != null) {
|
|
||||||
publicIpAndVlan = allocPublicIpAddress(dataCenterId, pod.first().getId(), publicMacAddress);
|
|
||||||
if (publicIpAndVlan == null) {
|
|
||||||
s_logger.warn("Unable to allocate public IP address for console proxy vm in data center : " + dataCenterId + ", pod="
|
|
||||||
+ pod.first().getId());
|
|
||||||
avoidPods.add(pod.first().getId());
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pod == null || publicIpAndVlan == null) {
|
|
||||||
s_logger.warn("Unable to allocate pod for console proxy vm in data center : " + dataCenterId);
|
|
||||||
|
|
||||||
context.put("proxyVmId", (long) 0);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
|
||||||
|
|
||||||
context.put("publicIpAddress", publicIpAndVlan._ipAddr);
|
|
||||||
context.put("pod", pod);
|
|
||||||
if (s_logger.isDebugEnabled()) {
|
|
||||||
s_logger.debug("Pod allocated " + pod.first().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
String cidrNetmask = NetUtils.getCidrNetmask(pod.first().getCidrSize());
|
|
||||||
|
|
||||||
// Find the VLAN ID, VLAN gateway, and VLAN netmask for
|
|
||||||
// publicIpAddress
|
|
||||||
publicIpAddress = publicIpAndVlan._ipAddr;
|
|
||||||
|
|
||||||
String vlanGateway = publicIpAndVlan._gateWay;
|
|
||||||
String vlanNetmask = publicIpAndVlan._netMask;
|
|
||||||
|
|
||||||
txn.start();
|
|
||||||
ConsoleProxyVO proxy;
|
|
||||||
String name = VirtualMachineName.getConsoleProxyName(id, _instance).intern();
|
|
||||||
proxy = new ConsoleProxyVO(id, name, guestMacAddress, null, NetUtils.getLinkLocalNetMask(), privateMacAddress, null, cidrNetmask,
|
|
||||||
_template.getId(), _template.getGuestOSId(), publicMacAddress, publicIpAddress, vlanNetmask, publicIpAndVlan._vlanDbId,
|
|
||||||
publicIpAndVlan._vlanid, pod.first().getId(), dataCenterId, vlanGateway, null, dc.getDns1(), dc.getDns2(), _domain,
|
|
||||||
_proxyRamSize, 0);
|
|
||||||
|
|
||||||
proxy.setLastHostId(pod.second());
|
|
||||||
proxy = _consoleProxyDao.persist(proxy);
|
|
||||||
long proxyVmId = proxy.getId();
|
|
||||||
|
|
||||||
final EventVO event = new EventVO();
|
|
||||||
event.setUserId(User.UID_SYSTEM);
|
|
||||||
event.setAccountId(Account.ACCOUNT_ID_SYSTEM);
|
|
||||||
event.setType(EventTypes.EVENT_PROXY_CREATE);
|
|
||||||
event.setLevel(EventVO.LEVEL_INFO);
|
|
||||||
event.setDescription("New console proxy created - " + proxy.getName());
|
|
||||||
_eventDao.persist(event);
|
|
||||||
txn.commit();
|
|
||||||
|
|
||||||
context.put("proxyVmId", proxyVmId);
|
|
||||||
return context;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
s_logger.error("Unexpected exception : ", e);
|
|
||||||
|
|
||||||
context.put("proxyVmId", (long) 0);
|
|
||||||
return context;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
@DB
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ import javax.persistence.Table;
|
||||||
import com.cloud.network.Network.BroadcastDomainType;
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
import com.cloud.network.Network.Mode;
|
import com.cloud.network.Network.Mode;
|
||||||
import com.cloud.network.Network.TrafficType;
|
import com.cloud.network.Network.TrafficType;
|
||||||
import com.cloud.vm.NetworkCharacteristics;
|
import com.cloud.utils.NumbersUtil;
|
||||||
|
import com.cloud.utils.net.NetUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetworkProfileVO contains information about a specific network.
|
* NetworkProfileVO contains information about a specific network.
|
||||||
|
|
@ -72,15 +73,16 @@ public class NetworkConfigurationVO implements NetworkConfiguration {
|
||||||
public NetworkConfigurationVO() {
|
public NetworkConfigurationVO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkConfigurationVO(NetworkConfiguration that, long accountId, long offeringId) {
|
public NetworkConfigurationVO(NetworkConfiguration that, long offeringId, long dataCenterId) {
|
||||||
this(that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId);
|
this(that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, dataCenterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkConfigurationVO(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId) {
|
public NetworkConfigurationVO(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId, long dataCenterId) {
|
||||||
this.trafficType = trafficType;
|
this.trafficType = trafficType;
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.broadcastDomainType = broadcastDomainType;
|
this.broadcastDomainType = broadcastDomainType;
|
||||||
this.networkOfferingId = networkOfferingId;
|
this.networkOfferingId = networkOfferingId;
|
||||||
|
this.dataCenterId = dataCenterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -134,7 +136,6 @@ public class NetworkConfigurationVO implements NetworkConfiguration {
|
||||||
return cidr;
|
return cidr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCidr(String cidr) {
|
public void setCidr(String cidr) {
|
||||||
this.cidr = cidr;
|
this.cidr = cidr;
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +148,42 @@ public class NetworkConfigurationVO implements NetworkConfiguration {
|
||||||
this.vlanId = vlanId;
|
this.vlanId = vlanId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkCharacteristics toCharacteristics() {
|
@Override
|
||||||
return new NetworkCharacteristics(id, broadcastDomainType, cidr, mode, 0);
|
public int hashCode() {
|
||||||
|
return NumbersUtil.hash(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getDataCenterId() {
|
||||||
|
return dataCenterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof NetworkConfigurationVO)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
NetworkConfigurationVO that = (NetworkConfigurationVO)obj;
|
||||||
|
if (this.trafficType != that.trafficType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.vlanId != null && that.vlanId != null && this.vlanId.longValue() != that.vlanId.longValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.vlanId != that.vlanId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((this.cidr == null && that.cidr != null) || (this.cidr != null && that.cidr == null)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.cidr == null && that.cidr == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetUtils.isNetworkAWithinNetworkB(this.cidr, that.cidr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.cloud.async.executor.LoadBalancerParam;
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.dc.HostPodVO;
|
import com.cloud.dc.HostPodVO;
|
||||||
import com.cloud.dc.VlanVO;
|
import com.cloud.dc.VlanVO;
|
||||||
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
|
|
@ -36,6 +37,7 @@ import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.component.Manager;
|
import com.cloud.utils.component.Manager;
|
||||||
import com.cloud.vm.DomainRouter;
|
import com.cloud.vm.DomainRouter;
|
||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.NicVO;
|
import com.cloud.vm.NicVO;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
|
@ -213,15 +215,17 @@ public interface NetworkManager extends Manager {
|
||||||
*/
|
*/
|
||||||
List<IPAddressVO> listPublicIpAddressesInVirtualNetwork(long accountId, long dcId, Boolean sourceNat);
|
List<IPAddressVO> listPublicIpAddressesInVirtualNetwork(long accountId, long dcId, Boolean sourceNat);
|
||||||
|
|
||||||
NetworkConfigurationVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering);
|
NetworkConfigurationVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering, DeploymentPlan plan);
|
||||||
NetworkConfigurationVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering, Map<String, String> params);
|
NetworkConfigurationVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering, Map<String, String> params, DeploymentPlan plan);
|
||||||
List<NetworkConfigurationVO> setupNetworkProfiles(AccountVO account, List<NetworkOfferingVO> offerings);
|
List<NetworkConfigurationVO> setupNetworkProfiles(AccountVO account, List<NetworkOfferingVO> offerings, DeploymentPlan plan);
|
||||||
|
|
||||||
List<NetworkOfferingVO> getSystemAccountNetworkOfferings(String... offeringNames);
|
List<NetworkOfferingVO> getSystemAccountNetworkOfferings(String... offeringNames);
|
||||||
|
|
||||||
<K extends VMInstanceVO> List<NicVO> allocate(K vm, List<Pair<NetworkConfigurationVO, NicVO>> networks) throws InsufficientCapacityException;
|
<K extends VMInstanceVO> List<NicProfile> allocate(K vm, List<Pair<NetworkConfigurationVO, NicProfile>> networks) throws InsufficientCapacityException;
|
||||||
|
|
||||||
<K extends VMInstanceVO> List<NicTO> prepare(K vm);
|
<K extends VMInstanceVO> List<NicTO> prepare(K vm);
|
||||||
|
|
||||||
<K extends VMInstanceVO> void create(K vm);
|
<K extends VMInstanceVO> void create(K vm);
|
||||||
|
|
||||||
|
<K extends VMInstanceVO> List<NicVO> getNics(K vm);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ import com.cloud.vm.DomainRouter;
|
||||||
import com.cloud.vm.DomainRouter.Role;
|
import com.cloud.vm.DomainRouter.Role;
|
||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
import com.cloud.vm.NetworkConcierge;
|
import com.cloud.vm.NetworkConcierge;
|
||||||
import com.cloud.vm.Nic;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.NicVO;
|
import com.cloud.vm.NicVO;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
|
|
@ -205,7 +205,9 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
@Inject NetworkConfigurationDao _networkProfileDao = null;
|
@Inject NetworkConfigurationDao _networkProfileDao = null;
|
||||||
@Inject NicDao _nicDao;
|
@Inject NicDao _nicDao;
|
||||||
|
|
||||||
|
@Inject(adapter=NetworkProfiler.class)
|
||||||
Adapters<NetworkProfiler> _networkProfilers;
|
Adapters<NetworkProfiler> _networkProfilers;
|
||||||
|
@Inject(adapter=NetworkConcierge.class)
|
||||||
Adapters<NetworkConcierge> _networkConcierges;
|
Adapters<NetworkConcierge> _networkConcierges;
|
||||||
|
|
||||||
long _routerTemplateId = -1;
|
long _routerTemplateId = -1;
|
||||||
|
|
@ -2342,14 +2344,22 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetworkConfigurationVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering) {
|
public NetworkConfigurationVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering, DeploymentPlan plan) {
|
||||||
return setupNetworkProfile(owner, offering, new HashMap<String, String>());
|
return setupNetworkProfile(owner, offering, new HashMap<String, String>(), plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetworkConfigurationVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering, Map<String, String> params) {
|
public NetworkConfigurationVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering, Map<String, String> params, DeploymentPlan plan) {
|
||||||
|
List<NetworkConfigurationVO> configs = _networkProfileDao.listBy(owner.getId(), offering.getId(), plan.getDataCenterId());
|
||||||
|
if (configs.size() > 0) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Found existing network configuration for offering " + offering + ": " + configs.get(0));
|
||||||
|
}
|
||||||
|
return configs.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
for (NetworkProfiler profiler : _networkProfilers) {
|
for (NetworkProfiler profiler : _networkProfilers) {
|
||||||
NetworkConfiguration profile = profiler.convert(offering, null, params, owner);
|
NetworkConfiguration profile = profiler.convert(offering, plan, params, owner);
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2362,18 +2372,18 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkConfigurationVO vo = new NetworkConfigurationVO(profile, owner.getId(), offering.getId());
|
NetworkConfigurationVO vo = new NetworkConfigurationVO(profile, offering.getId(), plan.getDataCenterId());
|
||||||
return _networkProfileDao.persist(vo);
|
return _networkProfileDao.persist(vo, owner.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new CloudRuntimeException("Unable to convert network offering to network profile: " + offering.getId());
|
throw new CloudRuntimeException("Unable to convert network offering to network profile: " + offering.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkConfigurationVO> setupNetworkProfiles(AccountVO owner, List<NetworkOfferingVO> offerings) {
|
public List<NetworkConfigurationVO> setupNetworkProfiles(AccountVO owner, List<NetworkOfferingVO> offerings, DeploymentPlan plan) {
|
||||||
List<NetworkConfigurationVO> profiles = new ArrayList<NetworkConfigurationVO>(offerings.size());
|
List<NetworkConfigurationVO> profiles = new ArrayList<NetworkConfigurationVO>(offerings.size());
|
||||||
for (NetworkOfferingVO offering : offerings) {
|
for (NetworkOfferingVO offering : offerings) {
|
||||||
profiles.add(setupNetworkProfile(owner, offering));
|
profiles.add(setupNetworkProfile(owner, offering, plan));
|
||||||
}
|
}
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
@ -2397,40 +2407,40 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
|
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
public <K extends VMInstanceVO> List<NicVO> allocate(K vm, List<Pair<NetworkConfigurationVO, NicVO>> networks) throws InsufficientCapacityException {
|
public <K extends VMInstanceVO> List<NicProfile> allocate(K vm, List<Pair<NetworkConfigurationVO, NicProfile>> networks) throws InsufficientCapacityException {
|
||||||
List<NicVO> nics = new ArrayList<NicVO>(networks.size());
|
List<NicProfile> nicProfiles = new ArrayList<NicProfile>(networks.size());
|
||||||
|
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
|
|
||||||
for (Pair<NetworkConfigurationVO, NicVO> network : networks) {
|
for (Pair<NetworkConfigurationVO, NicProfile> network : networks) {
|
||||||
for (NetworkConcierge concierge : _networkConcierges) {
|
for (NetworkConcierge concierge : _networkConcierges) {
|
||||||
Nic nic = concierge.allocate(vm, network.first(), network.second());
|
NicProfile profile = concierge.allocate(vm, network.first(), network.second());
|
||||||
if (nic == null) {
|
if (profile == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NicVO vo = new NicVO(concierge.getUniqueName(), vm.getId(), network.first().getId());
|
NicVO vo = new NicVO(concierge.getUniqueName(), vm.getId(), network.first().getId());
|
||||||
|
|
||||||
if (nic.getIp4Address() != null) {
|
if (profile.getIp4Address() != null) {
|
||||||
vo.setIp4Address(nic.getIp4Address());
|
vo.setIp4Address(profile.getIp4Address());
|
||||||
vo.setState(NicVO.State.IpAcquired);
|
vo.setState(NicVO.State.Reserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nic.getMacAddress() != null) {
|
if (profile.getMacAddress() != null) {
|
||||||
vo.setMacAddress(nic.getMacAddress());
|
vo.setMacAddress(profile.getMacAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nic.getMode() != null) {
|
if (profile.getMode() != null) {
|
||||||
vo.setMode(nic.getMode());
|
vo.setMode(profile.getMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
vo = _nicDao.persist(vo);
|
vo = _nicDao.persist(vo);
|
||||||
nics.add(vo);
|
nicProfiles.add(new NicProfile(vo, network.first()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
return nics;
|
return nicProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -2440,6 +2450,13 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <K extends VMInstanceVO> void create(K vm) {
|
public <K extends VMInstanceVO> void create(K vm) {
|
||||||
|
for (NetworkConcierge concierge : _networkConcierges) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <K extends VMInstanceVO> List<NicVO> getNics(K vm) {
|
||||||
|
return _nicDao.listBy(vm.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class NetworkUsageTask implements Runnable {
|
protected class NetworkUsageTask implements Runnable {
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,7 @@ import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
public interface NetworkConfigurationDao extends GenericDao<NetworkConfigurationVO, Long> {
|
public interface NetworkConfigurationDao extends GenericDao<NetworkConfigurationVO, Long> {
|
||||||
List<NetworkConfigurationVO> listBy(long accountId);
|
List<NetworkConfigurationVO> listBy(long accountId);
|
||||||
List<NetworkConfigurationVO> listBy(long accountId, long offeringId);
|
List<NetworkConfigurationVO> listBy(long accountId, long offeringId, long dataCenterId);
|
||||||
|
NetworkConfigurationVO persist(NetworkConfigurationVO config, long accountId);
|
||||||
|
void addAccountToNetworkConfiguration(long configId, long accountId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,18 @@ import com.cloud.network.Network.TrafficType;
|
||||||
import com.cloud.network.NetworkAccountDaoImpl;
|
import com.cloud.network.NetworkAccountDaoImpl;
|
||||||
import com.cloud.network.NetworkAccountVO;
|
import com.cloud.network.NetworkAccountVO;
|
||||||
import com.cloud.network.NetworkConfigurationVO;
|
import com.cloud.network.NetworkConfigurationVO;
|
||||||
|
import com.cloud.utils.db.DB;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
import com.cloud.utils.db.SearchBuilder;
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
|
import com.cloud.utils.db.Transaction;
|
||||||
|
|
||||||
@Local(value=NetworkConfigurationDao.class)
|
@Local(value=NetworkConfigurationDao.class) @DB(txn=false)
|
||||||
public class NetworkConfigurationDaoImpl extends GenericDaoBase<NetworkConfigurationVO, Long> implements NetworkConfigurationDao {
|
public class NetworkConfigurationDaoImpl extends GenericDaoBase<NetworkConfigurationVO, Long> implements NetworkConfigurationDao {
|
||||||
final SearchBuilder<NetworkConfigurationVO> ProfileSearch;
|
final SearchBuilder<NetworkConfigurationVO> ProfileSearch;
|
||||||
final SearchBuilder<NetworkConfigurationVO> AccountSearch;
|
final SearchBuilder<NetworkConfigurationVO> AccountSearch;
|
||||||
|
final SearchBuilder<NetworkConfigurationVO> OfferingSearch;
|
||||||
|
|
||||||
NetworkAccountDaoImpl _accountsDao = new NetworkAccountDaoImpl();
|
NetworkAccountDaoImpl _accountsDao = new NetworkAccountDaoImpl();
|
||||||
|
|
||||||
protected NetworkConfigurationDaoImpl() {
|
protected NetworkConfigurationDaoImpl() {
|
||||||
|
|
@ -44,29 +48,31 @@ public class NetworkConfigurationDaoImpl extends GenericDaoBase<NetworkConfigura
|
||||||
ProfileSearch.and("trafficType", ProfileSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("trafficType", ProfileSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
|
||||||
ProfileSearch.and("cidr", ProfileSearch.entity().getCidr(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("cidr", ProfileSearch.entity().getCidr(), SearchCriteria.Op.EQ);
|
||||||
ProfileSearch.and("broadcastType", ProfileSearch.entity().getBroadcastDomainType(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("broadcastType", ProfileSearch.entity().getBroadcastDomainType(), SearchCriteria.Op.EQ);
|
||||||
SearchBuilder<NetworkAccountVO> join = _accountsDao.createSearchBuilder();
|
ProfileSearch.and("offering", ProfileSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
|
||||||
join.and("account", join.entity().getAccountId(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("datacenter", ProfileSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
ProfileSearch.join("accounts", join, ProfileSearch.entity().getId(), join.entity().getNetworkConfigurationId());
|
|
||||||
ProfileSearch.done();
|
ProfileSearch.done();
|
||||||
|
|
||||||
AccountSearch = createSearchBuilder();
|
AccountSearch = createSearchBuilder();
|
||||||
AccountSearch.and("offering", AccountSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
|
AccountSearch.and("offering", AccountSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
|
||||||
join = _accountsDao.createSearchBuilder();
|
SearchBuilder<NetworkAccountVO> join = _accountsDao.createSearchBuilder();
|
||||||
join.and("account", join.entity().getAccountId(), SearchCriteria.Op.EQ);
|
join.and("account", join.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||||
AccountSearch.join("accounts", join, AccountSearch.entity().getId(), join.entity().getNetworkConfigurationId());
|
AccountSearch.join("accounts", join, AccountSearch.entity().getId(), join.entity().getNetworkConfigurationId());
|
||||||
|
AccountSearch.and("datacenter", AccountSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
AccountSearch.done();
|
AccountSearch.done();
|
||||||
|
|
||||||
|
OfferingSearch = createSearchBuilder();
|
||||||
|
OfferingSearch.and("offering", OfferingSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
|
||||||
|
OfferingSearch.and("datacenter", OfferingSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkConfigurationVO findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType, long accountId) {
|
public List<NetworkConfigurationVO> findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType, long networkOfferingId, long dataCenterId) {
|
||||||
SearchCriteria<NetworkConfigurationVO> sc = ProfileSearch.create();
|
SearchCriteria<NetworkConfigurationVO> sc = ProfileSearch.create();
|
||||||
sc.setParameters("trafficType", trafficType);
|
sc.setParameters("trafficType", trafficType);
|
||||||
sc.setParameters("broadcastType", broadcastType);
|
sc.setParameters("broadcastType", broadcastType);
|
||||||
sc.setJoinParameters("accounts", "account", accountId);
|
sc.setParameters("offering", networkOfferingId);
|
||||||
|
sc.setParameters("datacenter", dataCenterId);
|
||||||
return null;
|
|
||||||
|
|
||||||
|
return search(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -75,15 +81,37 @@ public class NetworkConfigurationDaoImpl extends GenericDaoBase<NetworkConfigura
|
||||||
sc.setParameters("account", accountId);
|
sc.setParameters("account", accountId);
|
||||||
sc.setJoinParameters("accounts", "account", accountId);
|
sc.setJoinParameters("accounts", "account", accountId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkConfigurationVO> listBy(long accountId, long offeringId) {
|
public List<NetworkConfigurationVO> listBy(long accountId, long offeringId, long dataCenterId) {
|
||||||
SearchCriteria<NetworkConfigurationVO> sc = AccountSearch.create();
|
SearchCriteria<NetworkConfigurationVO> sc = AccountSearch.create();
|
||||||
sc.setParameters("offering", offeringId);
|
sc.setParameters("offering", offeringId);
|
||||||
sc.setJoinParameters("accounts", "account", accountId);
|
sc.setJoinParameters("accounts", "account", accountId);
|
||||||
|
sc.setParameters("datacenter", dataCenterId);
|
||||||
|
|
||||||
return listActiveBy(sc);
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NetworkConfigurationVO persist(NetworkConfigurationVO config) {
|
||||||
|
throw new UnsupportedOperationException("Use the persist for NetworkConfigurationDao");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @DB
|
||||||
|
public NetworkConfigurationVO persist(NetworkConfigurationVO config, long accountId) {
|
||||||
|
Transaction txn = Transaction.currentTxn();
|
||||||
|
txn.start();
|
||||||
|
config = super.persist(config);
|
||||||
|
addAccountToNetworkConfiguration(config.getId(), accountId);
|
||||||
|
txn.commit();
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAccountToNetworkConfiguration(long configurationId, long accountId) {
|
||||||
|
NetworkAccountVO account = new NetworkAccountVO(configurationId, accountId);
|
||||||
|
_accountsDao.persist(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,43 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.cloud.network;
|
package com.cloud.network.profiler;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
|
|
||||||
import com.cloud.dc.DataCenterVO;
|
import com.cloud.dc.DataCenterVO;
|
||||||
import com.cloud.dc.dao.DataCenterDao;
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
|
import com.cloud.dc.dao.VlanDao;
|
||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.exception.ConflictingNetworkSettingsException;
|
|
||||||
import com.cloud.network.Network.BroadcastDomainType;
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
import com.cloud.network.Network.Mode;
|
import com.cloud.network.Network.Mode;
|
||||||
|
import com.cloud.network.Network.TrafficType;
|
||||||
|
import com.cloud.network.NetworkConfiguration;
|
||||||
|
import com.cloud.network.NetworkConfigurationVO;
|
||||||
|
import com.cloud.network.NetworkProfiler;
|
||||||
import com.cloud.network.dao.NetworkConfigurationDao;
|
import com.cloud.network.dao.NetworkConfigurationDao;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offering.NetworkOffering.GuestIpType;
|
import com.cloud.offering.NetworkOffering.GuestIpType;
|
||||||
import com.cloud.offering.ServiceOffering;
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.component.AdapterBase;
|
import com.cloud.utils.component.AdapterBase;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.vm.VirtualMachine;
|
|
||||||
|
|
||||||
@Local(value=NetworkProfiler.class)
|
@Local(value=NetworkProfiler.class)
|
||||||
public class NetworkProfilerImpl extends AdapterBase implements NetworkProfiler {
|
public class GuestNetworkProfiler extends AdapterBase implements NetworkProfiler {
|
||||||
@Inject protected NetworkConfigurationDao _profileDao;
|
@Inject protected NetworkConfigurationDao _profileDao;
|
||||||
@Inject protected DataCenterDao _dcDao;
|
@Inject protected DataCenterDao _dcDao;
|
||||||
|
@Inject protected VlanDao _vlanDao;
|
||||||
|
|
||||||
protected NetworkProfilerImpl() {
|
protected GuestNetworkProfiler() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetworkConfiguration convert(NetworkOffering offering, DeploymentPlan plan, Map<String, String> params, Account owner) {
|
public NetworkConfiguration convert(NetworkOffering offering, DeploymentPlan plan, Map<String, String> params, Account owner) {
|
||||||
List<NetworkConfigurationVO> profiles = _profileDao.listBy(owner.getId(), offering.getId());
|
if (offering.getTrafficType() != TrafficType.Guest) {
|
||||||
|
return null;
|
||||||
for (NetworkConfigurationVO profile : profiles) {
|
|
||||||
// FIXME: We should do more comparisons such as if the specific cidr matches.
|
|
||||||
return profile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuestIpType ipType = offering.getGuestIpType();
|
GuestIpType ipType = offering.getGuestIpType();
|
||||||
|
|
@ -53,22 +51,10 @@ public class NetworkProfilerImpl extends AdapterBase implements NetworkProfiler
|
||||||
mode = Mode.Dhcp;
|
mode = Mode.Dhcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkConfigurationVO profile = new NetworkConfigurationVO(offering.getTrafficType(), mode, broadcastType, offering.getId());
|
NetworkConfigurationVO profile = new NetworkConfigurationVO(offering.getTrafficType(), mode, broadcastType, offering.getId(), plan.getDataCenterId());
|
||||||
DataCenterVO dc = _dcDao.findById(plan.getDataCenterId());
|
DataCenterVO dc = _dcDao.findById(plan.getDataCenterId());
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<? extends NetworkConfiguration> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner) {
|
|
||||||
List<NetworkConfigurationVO> profiles = _profileDao.listBy(owner.getId());
|
|
||||||
for (NetworkOffering offering : networkOfferings) {
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkConfiguration> networkProfiles) throws ConflictingNetworkSettingsException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
|
||||||
|
|
||||||
sc.setParameters("name", name);
|
sc.setParameters("name", name);
|
||||||
|
|
||||||
return findOneActiveBy(sc);
|
return findOneBy(sc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue