mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
4987f93144
|
|
@ -183,7 +183,7 @@ import com.cloud.utils.net.NetUtils;
|
|||
import com.cloud.utils.script.OutputInterpreter;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.DiskCharacteristics;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.DomainRouter;
|
||||
import com.cloud.vm.State;
|
||||
import com.cloud.vm.VirtualMachineName;
|
||||
|
|
@ -1174,7 +1174,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||
|
||||
protected Answer execute(CreateCommand cmd) {
|
||||
StoragePoolTO pool = cmd.getPool();
|
||||
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
||||
DiskProfile dskch = cmd.getDiskCharacteristics();
|
||||
StorageVol tmplVol = null;
|
||||
StoragePool primaryPool = null;
|
||||
StorageVol vol = null;
|
||||
|
|
|
|||
|
|
@ -15,5 +15,9 @@ public interface Pod extends Grouping {
|
|||
*/
|
||||
long getId();
|
||||
|
||||
String getCidrAddress();
|
||||
int getCidrSize();
|
||||
public String getGateway();
|
||||
|
||||
//String getUniqueName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.deploy;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
|
||||
public class DeployDestination {
|
||||
DataCenter _dc;
|
||||
Pod _pod;
|
||||
Cluster _cluster;
|
||||
Host _host;
|
||||
Map<Volume, StoragePool> _storage;
|
||||
|
||||
public DataCenter getDataCenter() {
|
||||
return _dc;
|
||||
}
|
||||
|
||||
public Pod getPod() {
|
||||
return _pod;
|
||||
}
|
||||
|
||||
public Cluster getCluster() {
|
||||
return _cluster;
|
||||
}
|
||||
|
||||
public Host getHost() {
|
||||
return _host;
|
||||
}
|
||||
|
||||
public Map<Volume, StoragePool> getStorageForDisks() {
|
||||
return _storage;
|
||||
}
|
||||
|
||||
public DeployDestination() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return NumbersUtil.hash(_host.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
assert false : "Not implemented correctly yet.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.deploy;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface DeploymentDispatcher extends Adapter {
|
||||
DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan, Set<DeployDestination> avoid);
|
||||
}
|
||||
|
|
@ -12,6 +12,11 @@ import com.cloud.network.Network.TrafficType;
|
|||
* owned by an account.
|
||||
*/
|
||||
public interface NetworkConfiguration {
|
||||
enum State {
|
||||
Allocated, // Indicates the network configuration is in allocated but not setup.
|
||||
Setup, // Indicates the network configuration is setup.
|
||||
InUse; // Indicates the network configuration is in use.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of the network profile. Null means the network profile is not from the database.
|
||||
|
|
@ -28,7 +33,9 @@ public interface NetworkConfiguration {
|
|||
|
||||
String getCidr();
|
||||
|
||||
void setCidr(String cidr);
|
||||
long getDataCenterId();
|
||||
|
||||
long getNetworkOfferingId();
|
||||
|
||||
State getState();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.exception.ConflictingNetworkSettingsException;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
* NetworkProfiler takes the list of network offerings requested and figures
|
||||
* out what are the additional network profiles that are needed to add
|
||||
* to the account in order to support this network.
|
||||
*
|
||||
*/
|
||||
public interface NetworkProfiler extends Adapter {
|
||||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.network.configuration;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.network.NetworkConfiguration;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
* NetworkProfiler takes the list of network offerings requested and figures
|
||||
* out what are the additional network profiles that are needed to add
|
||||
* to the account in order to support this network.
|
||||
*
|
||||
*/
|
||||
public interface NetworkGuru extends Adapter {
|
||||
NetworkConfiguration design(NetworkOffering offering, DeploymentPlan plan, NetworkConfiguration config, Account owner);
|
||||
NetworkConfiguration implement(NetworkConfiguration config, NetworkOffering offering, DeployDestination destination);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.network.element;
|
||||
|
||||
import com.cloud.network.NetworkConfiguration;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
/**
|
||||
* Represents one network element that exists in a network.
|
||||
*/
|
||||
public interface NetworkElement extends Adapter {
|
||||
/**
|
||||
* Implement the network configuration as specified.
|
||||
* @param config fully specified network configuration.
|
||||
* @param offering network offering that originated the network configuration.
|
||||
* @return true if network configuration is now usable; false if not.
|
||||
*/
|
||||
boolean implement(NetworkConfiguration config, NetworkOffering offering);
|
||||
|
||||
/**
|
||||
* Prepare the nic profile to be used within the network.
|
||||
* @param config
|
||||
* @param nic
|
||||
* @param offering
|
||||
* @return
|
||||
*/
|
||||
boolean prepare(NetworkConfiguration config, NicProfile nic, VirtualMachineProfile vm, NetworkOffering offering);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.org;
|
||||
|
||||
public interface RunningIn {
|
||||
long getDataCenterId();
|
||||
long getPodId();
|
||||
Long getClusterId();
|
||||
Long getHostId();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.resource;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
public interface Concierge<T extends Resource> extends Adapter {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.cloud.resource;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Indicates a resource in CloudStack.
|
||||
* Any resource that requires an reservation and release system
|
||||
* must implement this interface.
|
||||
*
|
||||
*/
|
||||
public interface Resource {
|
||||
enum State {
|
||||
Allocated, // The resource is allocated but not re
|
||||
Reserving,
|
||||
Reserved,
|
||||
Releasing,
|
||||
}
|
||||
|
||||
enum ReservationStrategy {
|
||||
UserSpecified,
|
||||
Create,
|
||||
Start
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id in the CloudStack database
|
||||
*/
|
||||
long getId();
|
||||
|
||||
/**
|
||||
* @return reservation id returned by the allocation source. This can be the
|
||||
* String version of the database id if the allocation source does not need it's
|
||||
* own implementation of the reservation id. This is passed back to the
|
||||
* allocation source to release the resource.
|
||||
*/
|
||||
String getReservationId();
|
||||
|
||||
/**
|
||||
* @return unique name for the allocation source.
|
||||
*/
|
||||
String getReserver();
|
||||
|
||||
/**
|
||||
* @return the time a reservation request was made to the allocation source.
|
||||
*/
|
||||
Date getUpdateTime();
|
||||
|
||||
/**
|
||||
* @return the expected reservation interval. -1 indicates
|
||||
*/
|
||||
int getExpectedReservationInterval();
|
||||
|
||||
/**
|
||||
* @return the expected release interval.
|
||||
*/
|
||||
int getExpectedReleaseInterval();
|
||||
|
||||
/**
|
||||
* @return the reservation state of the resource.
|
||||
*/
|
||||
State getState();
|
||||
|
||||
ReservationStrategy getReservationStrategy();
|
||||
}
|
||||
|
|
@ -42,6 +42,8 @@ public interface Volume extends PartOf, OwnedBy, BasedOn {
|
|||
enum SourceType {
|
||||
Snapshot,DiskOffering,Template,Blank
|
||||
}
|
||||
|
||||
long getId();
|
||||
/**
|
||||
* @return the volume name
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +26,7 @@ import com.cloud.storage.Volume;
|
|||
* and resources to allocate and create disks. There object is immutable once
|
||||
* it has been created.
|
||||
*/
|
||||
public class DiskCharacteristics {
|
||||
public class DiskProfile {
|
||||
private long size;
|
||||
private String[] tags;
|
||||
private Volume.VolumeType type;
|
||||
|
|
@ -35,11 +36,13 @@ public class DiskCharacteristics {
|
|||
private long diskOfferingId;
|
||||
private Long templateId;
|
||||
private long volumeId;
|
||||
private Volume vol;
|
||||
private DiskOffering offering;
|
||||
|
||||
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.name = name;
|
||||
this.size = size;
|
||||
|
|
@ -50,7 +53,13 @@ public class DiskCharacteristics {
|
|||
this.templateId = templateId;
|
||||
this.volumeId = volumeId;
|
||||
}
|
||||
|
||||
|
||||
public DiskProfile(Volume vol, DiskOffering offering) {
|
||||
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.getUseLocalStorage(), vol.getSize());
|
||||
this.vol = vol;
|
||||
this.offering = offering;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return size of the disk requested in bytes.
|
||||
*/
|
||||
|
|
@ -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,25 +3,27 @@
|
|||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
||||
import com.cloud.network.NetworkConfiguration;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.resource.Concierge;
|
||||
|
||||
/**
|
||||
* NetworkConcierge reserves network settings for a VM based
|
||||
* on the NetworkCharacteristics given. A Concierge must
|
||||
* on the NetworkCharacteristics given. A concierge must
|
||||
* return a unique name so we know to call it to release
|
||||
* the reservation.
|
||||
*
|
||||
*/
|
||||
public interface NetworkConcierge extends Adapter {
|
||||
public interface NetworkConcierge extends Concierge<Nic> {
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,19 +18,13 @@
|
|||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.network.Network.Mode;
|
||||
import com.cloud.resource.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* Nic represents one nic on the VM.
|
||||
*/
|
||||
public interface Nic {
|
||||
enum State {
|
||||
Allocated,
|
||||
AcquireIp,
|
||||
IpAcquired,
|
||||
}
|
||||
|
||||
State getState();
|
||||
public interface Nic extends Resource {
|
||||
|
||||
String getIp4Address();
|
||||
|
||||
|
|
@ -39,19 +33,14 @@ public interface Nic {
|
|||
/**
|
||||
* @return network profile id that this
|
||||
*/
|
||||
long getNetworkProfileId();
|
||||
|
||||
/**
|
||||
* @return the unique id to reference this nic.
|
||||
*/
|
||||
long getId();
|
||||
long getNetworkConfigurationId();
|
||||
|
||||
/**
|
||||
* @return the vm instance id that this nic belongs to.
|
||||
*/
|
||||
long getInstanceId();
|
||||
|
||||
long getDeviceId();
|
||||
int getDeviceId();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,10 +19,13 @@
|
|||
package com.cloud.vm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.utils.fsm.FiniteState;
|
||||
import com.cloud.utils.fsm.StateMachine;
|
||||
import com.cloud.vm.VirtualMachine.Event;
|
||||
|
||||
public enum State {
|
||||
public enum State implements FiniteState<State, Event> {
|
||||
Creating(true),
|
||||
Starting(true),
|
||||
Running(false),
|
||||
|
|
@ -44,22 +47,24 @@ public enum State {
|
|||
return _transitional;
|
||||
}
|
||||
|
||||
public static String[] toStrings(State... states) {
|
||||
String[] strs = new String[states.length];
|
||||
for (int i = 0; i < states.length; i++) {
|
||||
strs[i] = states[i].toString();
|
||||
}
|
||||
|
||||
return strs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getNextState(VirtualMachine.Event e) {
|
||||
return s_fsm.getNextState(this, e);
|
||||
}
|
||||
|
||||
public State[] getFromStates(VirtualMachine.Event e) {
|
||||
List<State> from = s_fsm.getFromStates(this, e);
|
||||
return from.toArray(new State[from.size()]);
|
||||
@Override
|
||||
public List<State> getFromStates(VirtualMachine.Event e) {
|
||||
return s_fsm.getFromStates(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Event> getPossibleEvents() {
|
||||
return s_fsm.getPossibleEvents(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateMachine<State, Event> getStateMachine() {
|
||||
return s_fsm;
|
||||
}
|
||||
|
||||
protected static final StateMachine<State, VirtualMachine.Event> s_fsm = new StateMachine<State, VirtualMachine.Event>();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* 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 List<NicProfile> getNics() {
|
||||
return _nics;
|
||||
}
|
||||
|
||||
public void setDisks(List<DiskProfile> profiles) {
|
||||
this._disks = profiles;
|
||||
}
|
||||
|
||||
public List<DiskProfile> getDisks() {
|
||||
return _disks;
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
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.component.Manager;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VmCharacteristics;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
Host findHost(VmCharacteristics vm, Set<? extends Host> avoids);
|
||||
Host findHost(VirtualMachineProfile vm, Set<? extends Host> avoids);
|
||||
|
||||
/**
|
||||
* Put the agent in maintenance mode.
|
||||
|
|
|
|||
|
|
@ -35,11 +35,12 @@ public class IPAssocCommand extends RoutingCommand {
|
|||
private String vlanGateway;
|
||||
private String vlanNetmask;
|
||||
private String vifMacAddress;
|
||||
private String guestIp;
|
||||
|
||||
protected IPAssocCommand() {
|
||||
}
|
||||
|
||||
public IPAssocCommand(String routerName, String privateIpAddress, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress) {
|
||||
public IPAssocCommand(String routerName, String privateIpAddress, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp) {
|
||||
this.setRouterName(routerName);
|
||||
this.routerIp = privateIpAddress;
|
||||
this.publicIp = ipAddress;
|
||||
|
|
@ -50,8 +51,13 @@ public class IPAssocCommand extends RoutingCommand {
|
|||
this.vlanGateway = vlanGateway;
|
||||
this.vlanNetmask = vlanNetmask;
|
||||
this.vifMacAddress = vifMacAddress;
|
||||
this.guestIp = guestIp;
|
||||
}
|
||||
|
||||
public String getGuestIp(){
|
||||
return guestIp;
|
||||
}
|
||||
|
||||
public String getRouterIp() {
|
||||
return routerIp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ import com.cloud.agent.api.Command;
|
|||
import com.cloud.agent.api.to.StoragePoolTO;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.vm.DiskCharacteristics;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
|
||||
public class CreateCommand extends Command {
|
||||
private long volId;
|
||||
private StoragePoolTO pool;
|
||||
private DiskCharacteristics diskCharacteristics;
|
||||
private DiskProfile diskCharacteristics;
|
||||
private String templateUrl;
|
||||
private long size;
|
||||
private String instanceName;
|
||||
|
|
@ -45,7 +45,7 @@ public class CreateCommand extends Command {
|
|||
* @param templateUrl
|
||||
* @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.templateUrl = templateUrl;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public class CreateCommand extends Command {
|
|||
* @param diskCharacteristics
|
||||
* @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.diskCharacteristics = diskCharacteristics;
|
||||
this.pool = new StoragePoolTO(pool);
|
||||
|
|
@ -80,7 +80,7 @@ public class CreateCommand extends Command {
|
|||
return pool;
|
||||
}
|
||||
|
||||
public DiskCharacteristics getDiskCharacteristics() {
|
||||
public DiskProfile getDiskCharacteristics() {
|
||||
return diskCharacteristics;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
|
|||
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
|
||||
}
|
||||
|
||||
List<AlertVO> alerts = listActiveBy(sc, searchFilter);
|
||||
List<AlertVO> alerts = listBy(sc, searchFilter);
|
||||
if ((alerts != null) && !alerts.isEmpty()) {
|
||||
return alerts.get(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
|
|||
sc.setParameters("instanceId", instanceId);
|
||||
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.size() > 1) {
|
||||
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();
|
||||
sc.setParameters("created", cutTime);
|
||||
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();
|
||||
sc.setParameters("syncObjType", syncObjType);
|
||||
sc.setParameters("syncObjId", syncObjId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
protected SyncQueueDaoImpl() {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long>
|
|||
sc.setParameters("queueId", queueId);
|
||||
|
||||
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)
|
||||
return l.get(0);
|
||||
|
||||
|
|
@ -105,6 +105,6 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long>
|
|||
sc.setParameters("lastProcessMsid", msid);
|
||||
|
||||
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();
|
||||
sc.setParameters("msid", msid);
|
||||
|
||||
List<ManagementServerHostVO> l = listBy(sc);
|
||||
List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
|
||||
if(l != null && l.size() > 0)
|
||||
return l.get(0);
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
|
|||
SearchCriteria<ManagementServerHostVO> sc = activeSearch.create();
|
||||
sc.setParameters("lastUpdateTime", cutTime);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public void increaseAlertCount(long id) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
|||
SearchCriteria<ConfigurationVO> sc = InstanceSearch.create();
|
||||
sc.setParameters("instance", "DEFAULT");
|
||||
|
||||
List<ConfigurationVO> configurations = listBy(sc);
|
||||
List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
|
||||
|
||||
for (ConfigurationVO config : configurations) {
|
||||
if (config.getValue() != null)
|
||||
|
|
@ -71,7 +71,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
|||
sc = InstanceSearch.create();
|
||||
sc.setParameters("instance", instance);
|
||||
|
||||
configurations = listBy(sc);
|
||||
configurations = listIncludingRemovedBy(sc);
|
||||
|
||||
for (ConfigurationVO config : configurations) {
|
||||
if (config.getValue() != null)
|
||||
|
|
@ -126,7 +126,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
|||
public String getValue(String name) {
|
||||
SearchCriteria<ConfigurationVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", name);
|
||||
List<ConfigurationVO> configurations = listBy(sc);
|
||||
List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
|
||||
|
||||
if (configurations.size() == 0) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
|
|||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("type", type);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
private ResourceCountVO findByDomainIdAndType(long domainId, ResourceType type) {
|
||||
|
|
@ -64,7 +64,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
|
|||
sc.setParameters("domainId", domainId);
|
||||
sc.setParameters("type", type);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
|||
sc.setParameters("domainId", domainId);
|
||||
sc.setParameters("type", type);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public List<ResourceLimitVO> listByDomainId(Long domainId) {
|
||||
|
|
@ -58,7 +58,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
|||
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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("type", type);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public List<ResourceLimitVO> listByAccountId(Long accountId) {
|
||||
|
|
@ -79,7 +79,7 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
|
|||
SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public boolean update(Long id, Long max) {
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ public class HostPodVO implements Pod {
|
|||
private String cidrAddress;
|
||||
|
||||
@Column(name = "cidr_size")
|
||||
private long cidrSize;
|
||||
private int cidrSize;
|
||||
|
||||
@Column(name = "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.dataCenterId = dcId;
|
||||
this.gateway = gateway;
|
||||
|
|
@ -88,7 +88,8 @@ public class HostPodVO implements Pod {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCidrAddress() {
|
||||
@Override
|
||||
public String getCidrAddress() {
|
||||
return cidrAddress;
|
||||
}
|
||||
|
||||
|
|
@ -96,15 +97,17 @@ public class HostPodVO implements Pod {
|
|||
this.cidrAddress = cidrAddress;
|
||||
}
|
||||
|
||||
public long getCidrSize() {
|
||||
@Override
|
||||
public int getCidrSize() {
|
||||
return cidrSize;
|
||||
}
|
||||
|
||||
public void setCidrSize(long cidrSize) {
|
||||
public void setCidrSize(int cidrSize) {
|
||||
this.cidrSize = cidrSize;
|
||||
}
|
||||
|
||||
public String getGateway() {
|
||||
@Override
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@ public class AccountVlanMapDaoImpl extends GenericDaoBase<AccountVlanMapVO, Long
|
|||
public List<AccountVlanMapVO> listAccountVlanMapsByAccount(long accountId) {
|
||||
SearchCriteria<AccountVlanMapVO> sc = AccountSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccountVlanMapVO> listAccountVlanMapsByVlan(long vlanDbId) {
|
||||
SearchCriteria<AccountVlanMapVO> sc = VlanSearch.create();
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -53,7 +53,7 @@ public class AccountVlanMapDaoImpl extends GenericDaoBase<AccountVlanMapVO, Long
|
|||
SearchCriteria<AccountVlanMapVO> sc = AccountVlanSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public AccountVlanMapDaoImpl() {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
SearchCriteria<ClusterVO> sc = PodSearch.create();
|
||||
sc.setParameters("pod", podId);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -54,6 +54,6 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
sc.setParameters("pod", podId);
|
||||
sc.setParameters("name", name);
|
||||
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
package com.cloud.dc.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DataCenterVnetVO;
|
||||
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 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 deleteLinkLocalPrivateIpAddressByPod(long podId);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
|||
public DataCenterVO findByName(String name) {
|
||||
SearchCriteria<DataCenterVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", name);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -84,6 +84,16 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
|||
_ipAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releasePrivateIpAddress(long nicId) {
|
||||
_ipAllocDao.releaseIpAddress(nicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseLinkLocalPrivateIpAddress(long nicId) {
|
||||
_LinkLocalIpAllocDao.releaseIpAddress(nicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseLinkLocalPrivateIpAddress(String ipAddress, long dcId, Long instanceId) {
|
||||
_LinkLocalIpAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
|
||||
|
|
|
|||
|
|
@ -136,6 +136,16 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
|||
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() {
|
||||
super();
|
||||
FreeIpSearch = createSearchBuilder();
|
||||
|
|
@ -173,7 +183,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
|||
SearchCriteria<DataCenterIpAddressVO> sc = PodDcSearch.create();
|
||||
sc.setParameters("podId", podId);
|
||||
sc.setParameters("dataCenterId", dcId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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("podId", podId);
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,17 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
|||
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() {
|
||||
super();
|
||||
FreeIpSearch = createSearchBuilder();
|
||||
|
|
@ -175,7 +186,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
|||
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = PodDcSearch.create();
|
||||
sc.setParameters("podId", podId);
|
||||
sc.setParameters("dataCenterId", dcId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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("podId", podId);
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
|
||||
sc.setParameters("dc", dcId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();;
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("vnet", vnet);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
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("account", accountId);
|
||||
|
||||
DataCenterVnetVO vo = findOneBy(sc);
|
||||
DataCenterVnetVO vo = findOneIncludingRemovedBy(sc);
|
||||
if (vo == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
|||
SearchCriteria<HostPodVO> sc = DataCenterIdSearch.create();
|
||||
sc.setParameters("dcId", id);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
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("name", name);
|
||||
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements G
|
|||
public List<PodVlanVO> listAllocatedVnets(long podId) {
|
||||
SearchCriteria<PodVlanVO> sc = PodSearchAllocated.create();
|
||||
sc.setParameters("podId", podId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
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("account", accountId);
|
||||
|
||||
PodVlanVO vo = findOneBy(sc);
|
||||
PodVlanVO vo = findOneIncludingRemovedBy(sc);
|
||||
if (vo == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@ public class PodVlanMapDaoImpl extends GenericDaoBase<PodVlanMapVO, Long> implem
|
|||
public List<PodVlanMapVO> listPodVlanMapsByPod(long podId) {
|
||||
SearchCriteria<PodVlanMapVO> sc = PodSearch.create();
|
||||
sc.setParameters("podId", podId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodVlanMapVO> listPodVlanMapsByVlan(long vlanDbId) {
|
||||
SearchCriteria<PodVlanMapVO> sc = VlanSearch.create();
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -53,7 +53,7 @@ public class PodVlanMapDaoImpl extends GenericDaoBase<PodVlanMapVO, Long> implem
|
|||
SearchCriteria<PodVlanMapVO> sc = PodVlanSearch.create();
|
||||
sc.setParameters("podId", podId);
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public PodVlanMapDaoImpl() {
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
SearchCriteria<VlanVO> sc = ZoneVlanIdSearch.create();
|
||||
sc.setParameters("zoneId", zoneId);
|
||||
sc.setParameters("vlanId", vlanId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VlanVO> findByZone(long zoneId) {
|
||||
SearchCriteria<VlanVO> sc = ZoneSearch.create();
|
||||
sc.setParameters("zoneId", zoneId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public VlanDaoImpl() {
|
||||
|
|
@ -105,7 +105,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
SearchCriteria<VlanVO> sc = ZoneTypeSearch.create();
|
||||
sc.setParameters("zoneId", zoneId);
|
||||
sc.setParameters("vlanType", vlanType);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -248,7 +248,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
sc.setParameters("zoneId", zoneId);
|
||||
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.setJoinParameters("vlan", "podId", podId);
|
||||
|
||||
VlanVO vlan = findOneBy(sc);
|
||||
VlanVO vlan = findOneIncludingRemovedBy(sc);
|
||||
if (vlan == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
|||
public DomainVO findDomainByPath(String domainPath) {
|
||||
SearchCriteria<DomainVO> sc = createSearchCriteria();
|
||||
sc.addAnd("path", SearchCriteria.Op.EQ, domainPath);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -205,7 +205,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
|||
SearchCriteria<DomainVO> sc = DomainPairSearch.create();
|
||||
sc.setParameters("id", parentId, childId);
|
||||
|
||||
List<DomainVO> domainPair = listActiveBy(sc);
|
||||
List<DomainVO> domainPair = listBy(sc);
|
||||
|
||||
if ((domainPair != null) && (domainPair.size() == 2)) {
|
||||
DomainVO d1 = domainPair.get(0);
|
||||
|
|
|
|||
|
|
@ -74,23 +74,19 @@ public class EventTypes {
|
|||
//Template Events
|
||||
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";
|
||||
public static final String EVENT_TEMPLATE_DELETE = "TEMPLATE.DELETE";
|
||||
public static final String EVENT_TEMPLATE_UPDATE = "TEMPLATE.UPDATE";
|
||||
public static final String EVENT_TEMPLATE_COPY = "TEMPLATE.COPY";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_START = "TEMPLATE.DOWNLOAD.START";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_SUCCESS = "TEMPLATE.DOWNLOAD.SUCCESS";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_FAILED = "TEMPLATE.DOWNLOAD.FAILED";
|
||||
public static final String EVENT_TEMPLATE_UPLOAD_FAILED = "TEMPLATE.UPLOAD.FAILED";
|
||||
public static final String EVENT_TEMPLATE_UPLOAD_START = "TEMPLATE.UPLOAD.START";
|
||||
public static final String EVENT_TEMPLATE_UPLOAD_SUCCESS = "TEMPLATE.UPLOAD.SUCCESS";
|
||||
public static final String EVENT_TEMPLATE_UPDATE = "TEMPLATE.UPDATE";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_START = "TEMPLATE.DOWNLOAD.START";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_SUCCESS = "TEMPLATE.DOWNLOAD.SUCCESS";
|
||||
public static final String EVENT_TEMPLATE_DOWNLOAD_FAILED = "TEMPLATE.DOWNLOAD.FAILED";
|
||||
public static final String EVENT_TEMPLATE_COPY = "TEMPLATE.COPY";
|
||||
public static final String EVENT_TEMPLATE_UPLOAD = "TEMPLATE.UPLOAD";
|
||||
|
||||
// Volume Events
|
||||
public static final String EVENT_VOLUME_CREATE = "VOLUME.CREATE";
|
||||
public static final String EVENT_VOLUME_DELETE = "VOLUME.DELETE";
|
||||
public static final String EVENT_VOLUME_ATTACH = "VOLUME.ATTACH";
|
||||
public static final String EVENT_VOLUME_DETACH = "VOLUME.DETACH";
|
||||
public static final String EVENT_VOLUME_UPLOAD_START = "VOLUME.UPLOAD.START";
|
||||
public static final String EVENT_VOLUME_UPLOAD_SUCCESS = "VOLUME.UPLOAD.SUCCESS";
|
||||
public static final String EVENT_VOLUME_UPLOAD_FAILED = "VOLUME.UPLOAD.FAILED";
|
||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
|
|
@ -110,9 +106,7 @@ public class EventTypes {
|
|||
public static final String EVENT_ISO_COPY = "ISO.COPY";
|
||||
public static final String EVENT_ISO_ATTACH = "ISO.ATTACH";
|
||||
public static final String EVENT_ISO_DETACH = "ISO.DETACH";
|
||||
public static final String EVENT_ISO_UPLOAD_FAILED = "ISO.UPLOAD.FAILED";
|
||||
public static final String EVENT_ISO_UPLOAD_START = "ISO.UPLOAD.START";
|
||||
public static final String EVENT_ISO_UPLOAD_SUCCESS = "ISO.UPLOAD.SUCCESS";
|
||||
public static final String EVENT_ISO_UPLOAD = "ISO.UPLOAD";
|
||||
|
||||
//SSVM
|
||||
public static final String EVENT_SSVM_CREATE = "SSVM.CREATE";
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
|||
|
||||
@Override
|
||||
public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter) {
|
||||
return listBy(sc, filter);
|
||||
return listIncludingRemovedBy(sc, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -61,7 +61,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
|||
if (oldTime == null) return null;
|
||||
SearchCriteria<EventVO> sc = createSearchCriteria();
|
||||
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("startId", 0);
|
||||
sc.setParameters("createDate", minTime, maxTime);
|
||||
return listBy(sc, null);
|
||||
return listIncludingRemovedBy(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -80,6 +80,6 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
|
|||
SearchCriteria<EventVO> sc = CompletedEventSearch.create();
|
||||
sc.setParameters("state", EventState.Completed);
|
||||
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) {
|
||||
final SearchCriteria<WorkVO> sc = PreviousInstanceSearch.create();
|
||||
sc.setParameters("instance", instanceId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -152,7 +152,7 @@ public class HighAvailabilityDaoImpl extends GenericDaoBase<WorkVO, Long> implem
|
|||
sc.setParameters("type", type);
|
||||
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();
|
||||
sc.setParameters("instance", instanceId);
|
||||
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("name", name);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
SearchCriteria<HostVO> sc = TypeDcSearch.create();
|
||||
sc.setParameters("type", Host.Type.SecondaryStorage);
|
||||
sc.setParameters("dc", dcId);
|
||||
List<HostVO> storageHosts = listActiveBy(sc);
|
||||
List<HostVO> storageHosts = listBy(sc);
|
||||
|
||||
if (storageHosts == null || storageHosts.size() != 1) {
|
||||
return null;
|
||||
|
|
@ -232,7 +232,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
public List<HostVO> listSecondaryStorageHosts() {
|
||||
SearchCriteria<HostVO> sc = TypeSearch.create();
|
||||
sc.setParameters("type", Host.Type.SecondaryStorage);
|
||||
List<HostVO> secondaryStorageHosts = listBy(sc);
|
||||
List<HostVO> secondaryStorageHosts = listIncludingRemovedBy(sc);
|
||||
|
||||
return secondaryStorageHosts;
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("status", Status.Up.toString());
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -290,7 +290,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
|
||||
sc.setParameters("cluster", clusterId);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -300,7 +300,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("status", Status.Up.toString());
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -309,7 +309,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("privateIpAddress", privateIpAddress);
|
||||
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -318,7 +318,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("storageIpAddress", privateIpAddress);
|
||||
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -416,7 +416,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
@Override
|
||||
public HostVO findByGuid(String guid) {
|
||||
SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -425,13 +425,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("ping", timeout);
|
||||
sc.setParameters("state", Status.Up.toString(), Status.Updating.toString(),
|
||||
Status.Disconnected.toString(), Status.Down.toString());
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<HostVO> findHostsLike(String hostName) {
|
||||
SearchCriteria<HostVO> sc = NameLikeSearch.create();
|
||||
sc.setParameters("name", "%" + hostName + "%");
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -439,25 +439,25 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
SearchCriteria<HostVO> sc = LastPingedSearch2.create();
|
||||
sc.setParameters("ping", timeout);
|
||||
sc.setParameters("type", type.toString());
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> listByDataCenter(long dcId) {
|
||||
SearchCriteria<HostVO> sc = DcSearch.create("dc", dcId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<HostVO> listByHostPod(long podId) {
|
||||
SearchCriteria<HostVO> sc = PodSearch.create("pod", podId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> listByStatus(Status... status) {
|
||||
SearchCriteria<HostVO> sc = StatusSearch.create();
|
||||
sc.setParameters("status", (Object[])status);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -466,7 +466,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.setParameters("type", type.toString());
|
||||
sc.setParameters("dc", dcId);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -478,7 +478,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
sc.addAnd("routing_capbable", SearchCriteria.Op.EQ, Integer.valueOf(1));
|
||||
}
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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.script.Script;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.DiskCharacteristics;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.DomainRouter;
|
||||
import com.cloud.vm.SecondaryStorageVmVO;
|
||||
import com.cloud.vm.State;
|
||||
|
|
@ -1288,7 +1288,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
}
|
||||
|
||||
protected void assignPublicIpAddress(final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP,
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) throws InternalErrorException {
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress, String guestIp) throws InternalErrorException {
|
||||
|
||||
try {
|
||||
Connection conn = getConnection();
|
||||
|
|
@ -1317,25 +1317,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
if (vifDeviceNum == null) {
|
||||
throw new InternalErrorException("There were no more available slots for a new VIF on router: " + router.getNameLabel(conn));
|
||||
}
|
||||
|
||||
VIF.Record vifr = new VIF.Record();
|
||||
vifr.VM = router;
|
||||
vifr.device = vifDeviceNum;
|
||||
vifr.MAC = vifMacAddress;
|
||||
|
||||
if ("untagged".equalsIgnoreCase(vlanId)) {
|
||||
vifr.network = Network.getByUuid(conn, _host.publicNetwork);
|
||||
} else {
|
||||
Network vlanNetwork = enableVlanNetwork(Long.valueOf(vlanId), _host.publicPif);
|
||||
|
||||
if (vlanNetwork == null) {
|
||||
throw new InternalErrorException("Failed to enable VLAN network with tag: " + vlanId);
|
||||
}
|
||||
|
||||
vifr.network = vlanNetwork;
|
||||
}
|
||||
|
||||
correctVif = VIF.create(conn, vifr);
|
||||
|
||||
correctVif = createVIF(conn, router, vifMacAddress, vlanId, 0, vifDeviceNum, true);
|
||||
correctVif.plug(conn);
|
||||
// Add iptables rule for network usage
|
||||
networkUsage(privateIpAddress, "addVif", "eth" + correctVif.getDevice(conn));
|
||||
|
|
@ -1345,7 +1328,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with.");
|
||||
}
|
||||
|
||||
String args;
|
||||
String args = null;
|
||||
|
||||
if (add) {
|
||||
args = "-A";
|
||||
} else {
|
||||
|
|
@ -1363,6 +1347,11 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
args += " -g ";
|
||||
args += vlanGateway;
|
||||
|
||||
if(guestIp!=null){
|
||||
args += " -G ";
|
||||
args += guestIp;
|
||||
}
|
||||
|
||||
String result = callHostPlugin("vmops", "ipassoc", "args", args);
|
||||
if (result == null || result.isEmpty()) {
|
||||
throw new InternalErrorException("Xen plugin \"ipassoc\" failed.");
|
||||
|
|
@ -1405,7 +1394,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
protected Answer execute(final IPAssocCommand cmd) {
|
||||
try {
|
||||
assignPublicIpAddress(cmd.getRouterName(), cmd.getRouterIp(), cmd.getPublicIp(), cmd.isAdd(), cmd.isFirstIP(), cmd.isSourceNat(), cmd.getVlanId(),
|
||||
cmd.getVlanGateway(), cmd.getVlanNetmask(), cmd.getVifMacAddress());
|
||||
cmd.getVlanGateway(), cmd.getVlanNetmask(), cmd.getVifMacAddress(), cmd.getGuestIp());
|
||||
} catch (InternalErrorException e) {
|
||||
return new Answer(cmd, false, e.getMessage());
|
||||
}
|
||||
|
|
@ -1685,8 +1674,15 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
try {
|
||||
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(statsSource);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Exception caught whilst processing the document via document factory:"+e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(doc==null){
|
||||
s_logger.warn("Null document found after tryinh to parse the stats source");
|
||||
return null;
|
||||
}
|
||||
|
||||
NodeList firstLevelChildren = doc.getChildNodes();
|
||||
NodeList secondLevelChildren = (firstLevelChildren.item(0)).getChildNodes();
|
||||
Node metaNode = secondLevelChildren.item(0);
|
||||
|
|
@ -1729,7 +1725,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
|
||||
if(numRowsUsed == 0)
|
||||
{
|
||||
if((!Double.isInfinite(value))&&(!Double.isInfinite(value)))
|
||||
if((!Double.isInfinite(value))&&(!Double.isNaN(value)))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
|
@ -1741,7 +1737,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
}
|
||||
else
|
||||
{
|
||||
if((!Double.isInfinite(value/numRowsUsed))&&(!Double.isInfinite(value/numRowsUsed)))
|
||||
if((!Double.isInfinite(value/numRowsUsed))&&(!Double.isNaN(value/numRowsUsed)))
|
||||
{
|
||||
return (value/numRowsUsed);
|
||||
}
|
||||
|
|
@ -2857,13 +2853,23 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
String msg = "Start VM failed";
|
||||
return new StartAnswer(cmd, msg);
|
||||
}
|
||||
|
||||
protected void createVIF(Connection conn, VM vm, String mac, String vlanTag, int rate, String devNum, boolean isPub) throws XenAPIException, XmlRpcException,
|
||||
InternalErrorException {
|
||||
|
||||
protected VIF createVIF(Connection conn, VM vm, String mac, int rate, String devNum, Network network) throws XenAPIException, XmlRpcException,
|
||||
InternalErrorException {
|
||||
VIF.Record vifr = new VIF.Record();
|
||||
vifr.VM = vm;
|
||||
vifr.device = devNum;
|
||||
vifr.MAC = mac;
|
||||
vifr.network = network;
|
||||
if ( rate == 0 ) rate = 200;
|
||||
vifr.qosAlgorithmType = "ratelimit";
|
||||
vifr.qosAlgorithmParams = new HashMap<String, String>();
|
||||
vifr.qosAlgorithmParams.put("kbps", Integer.toString(rate * 1000));
|
||||
return VIF.create(conn, vifr);
|
||||
}
|
||||
|
||||
protected VIF createVIF(Connection conn, VM vm, String mac, String vlanTag, int rate, String devNum, boolean isPub) throws XenAPIException, XmlRpcException,
|
||||
InternalErrorException {
|
||||
|
||||
String nwUuid = (isPub ? _host.publicNetwork : _host.guestNetwork);
|
||||
String pifUuid = (isPub ? _host.publicPif : _host.guestPif);
|
||||
|
|
@ -2877,15 +2883,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
if (vlanNetwork == null) {
|
||||
throw new InternalErrorException("Failed to enable VLAN network with tag: " + vlanTag);
|
||||
}
|
||||
|
||||
vifr.network = vlanNetwork;
|
||||
if (rate != 0) {
|
||||
vifr.qosAlgorithmType = "ratelimit";
|
||||
vifr.qosAlgorithmParams = new HashMap<String, String>();
|
||||
vifr.qosAlgorithmParams.put("kbps", Integer.toString(rate * 1000));
|
||||
}
|
||||
|
||||
VIF.create(conn, vifr);
|
||||
return createVIF(conn, vm, mac, rate, devNum, vlanNetwork);
|
||||
}
|
||||
|
||||
protected StopAnswer execute(final StopCommand cmd) {
|
||||
|
|
@ -3187,44 +3185,35 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
cdromVBD.insert(conn, VDI.getByUuid(conn, _host.systemvmisouuid));
|
||||
|
||||
/* create VIF0 */
|
||||
VIF.Record vifr = new VIF.Record();
|
||||
vifr.VM = vm;
|
||||
vifr.device = "0";
|
||||
vifr.MAC = guestMacAddr;
|
||||
Network network = null;
|
||||
if (VirtualMachineName.isValidConsoleProxyName(vmName) || VirtualMachineName.isValidSecStorageVmName(vmName, null)) {
|
||||
vifr.network = Network.getByUuid(conn, _host.linkLocalNetwork);
|
||||
} else
|
||||
vifr.network = nw0;
|
||||
VIF.create(conn, vifr);
|
||||
network = Network.getByUuid(conn, _host.linkLocalNetwork);
|
||||
} else {
|
||||
network = nw0;
|
||||
}
|
||||
createVIF(conn, vm, guestMacAddr, 0, "0", network);
|
||||
|
||||
/* create VIF1 */
|
||||
/* For routing vm, set its network as link local bridge */
|
||||
vifr.VM = vm;
|
||||
vifr.device = "1";
|
||||
vifr.MAC = privateMacAddr;
|
||||
if (VirtualMachineName.isValidRouterName(vmName) && privateIp.startsWith("169.254")) {
|
||||
vifr.network = Network.getByUuid(conn, _host.linkLocalNetwork);
|
||||
network = Network.getByUuid(conn, _host.linkLocalNetwork);
|
||||
} else {
|
||||
vifr.network = Network.getByUuid(conn, _host.privateNetwork);
|
||||
network = Network.getByUuid(conn, _host.privateNetwork);
|
||||
}
|
||||
VIF.create(conn, vifr);
|
||||
createVIF(conn, vm, privateMacAddr, 0, "1", network);
|
||||
|
||||
/* create VIF2 */
|
||||
if( !publicMacAddr.equalsIgnoreCase("FE:FF:FF:FF:FF:FF") ) {
|
||||
/* create VIF2 */
|
||||
vifr.VM = vm;
|
||||
vifr.device = "2";
|
||||
vifr.MAC = publicMacAddr;
|
||||
vifr.network = Network.getByUuid(conn, _host.publicNetwork);
|
||||
network = null;
|
||||
if ("untagged".equalsIgnoreCase(vlanId)) {
|
||||
vifr.network = Network.getByUuid(conn, _host.publicNetwork);
|
||||
network = Network.getByUuid(conn, _host.publicNetwork);
|
||||
} else {
|
||||
Network vlanNetwork = enableVlanNetwork(Long.valueOf(vlanId), _host.publicPif);
|
||||
|
||||
if (vlanNetwork == null) {
|
||||
network = enableVlanNetwork(Long.valueOf(vlanId), _host.publicPif);
|
||||
if (network == null) {
|
||||
throw new InternalErrorException("Failed to enable VLAN network with tag: " + vlanId);
|
||||
}
|
||||
|
||||
vifr.network = vlanNetwork;
|
||||
}
|
||||
}
|
||||
VIF.create(conn, vifr);
|
||||
createVIF(conn, vm, publicMacAddr, 0, "2", network);
|
||||
}
|
||||
/* set up PV dom argument */
|
||||
String pvargs = vm.getPVArgs(conn);
|
||||
|
|
@ -4729,7 +4718,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
@Override
|
||||
public CreateAnswer execute(CreateCommand cmd) {
|
||||
StoragePoolTO pool = cmd.getPool();
|
||||
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
||||
DiskProfile dskch = cmd.getDiskCharacteristics();
|
||||
|
||||
VDI vdi = null;
|
||||
Connection conn = getConnection();
|
||||
|
|
|
|||
|
|
@ -159,10 +159,11 @@ public class XenServerConnectionPool {
|
|||
}
|
||||
|
||||
protected synchronized void cleanup(String poolUuid) {
|
||||
if( poolUuid == null ) {
|
||||
return;
|
||||
}
|
||||
ConnectionInfo info = _infos.remove(poolUuid);
|
||||
if (info == null) {
|
||||
s_logger.debug("Unable to find any information for pool "
|
||||
+ poolUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -189,8 +190,10 @@ public class XenServerConnectionPool {
|
|||
|
||||
protected synchronized void cleanup(String poolUuid, ConnectionInfo info) {
|
||||
ConnectionInfo info2 = _infos.get(poolUuid);
|
||||
s_logger
|
||||
.debug("Cleanup for Session " + info.conn.getSessionReference());
|
||||
if( info2 == null ) {
|
||||
return;
|
||||
}
|
||||
s_logger.debug("Cleanup for Session " + info.conn.getSessionReference());
|
||||
if (info != info2) {
|
||||
s_logger.debug("Session " + info.conn.getSessionReference()
|
||||
+ " is already logged out.");
|
||||
|
|
@ -573,6 +576,22 @@ public class XenServerConnectionPool {
|
|||
masterConn = null;
|
||||
masterIp = null;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Pool.Record pr = getPoolRecord(slaveConn);
|
||||
masterIp = pr.master.getAddress(slaveConn);
|
||||
masterUrl = new URL("http://" + masterIp);;
|
||||
masterConn = new XenServerConnection(masterUrl, username,
|
||||
password, _retries, _interval, wait);
|
||||
Session.loginWithPassword(masterConn, username, password,
|
||||
APIVersion.latest().toString());
|
||||
create_new_session = false;
|
||||
|
||||
} catch (Exception e) {
|
||||
cleanup(poolUuid);
|
||||
masterConn = null;
|
||||
masterIp = null;
|
||||
}
|
||||
}
|
||||
if (create_new_session) {
|
||||
try{
|
||||
|
|
@ -782,18 +801,20 @@ public class XenServerConnectionPool {
|
|||
try {
|
||||
return super.dispatch(method_call, method_params);
|
||||
} catch (Types.SessionInvalid e) {
|
||||
s_logger.debug("Session is invalid for method: " + method_call + " due to " + e.getMessage() + ". Reconnecting...retry="
|
||||
+ retries);
|
||||
if (retries >= _retries) {
|
||||
if (_poolUuid != null) {
|
||||
cleanup(_poolUuid, _info);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
s_logger.debug("Session is invalid. Reconnecting...retry="
|
||||
+ retries);
|
||||
Session.loginWithPassword(this, _username,
|
||||
_password, APIVersion.latest().toString());
|
||||
method_params[0] = getSessionReference();
|
||||
} catch (XmlRpcException e) {
|
||||
s_logger.debug("XmlRpcException for method: " + method_call + " due to " + e.getMessage() + ". Reconnecting...retry="
|
||||
+ retries);
|
||||
if (retries >= _retries) {
|
||||
if (_poolUuid != null) {
|
||||
cleanup(_poolUuid, _info);
|
||||
|
|
@ -807,9 +828,9 @@ public class XenServerConnectionPool {
|
|||
}
|
||||
throw e;
|
||||
}
|
||||
s_logger.debug("Connection couldn't be made for method " + method_call
|
||||
+ " Reconnecting....retry=" + retries);
|
||||
} catch (Types.HostIsSlave e) {
|
||||
s_logger.debug("HostIsSlave Exception for method: " + method_call + " due to " + e.getMessage() + ". Reconnecting...retry="
|
||||
+ retries);
|
||||
if (_poolUuid != null) {
|
||||
cleanup(_poolUuid, _info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class StackMaidDaoImpl extends GenericDaoBase<StackMaidVO, Long> implemen
|
|||
sc.setParameters("threadId", Thread.currentThread().getId());
|
||||
|
||||
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) {
|
||||
expunge(l.get(0).getId());
|
||||
return l.get(0);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
SearchCriteria<FirewallRuleVO> sc = FWByIPAndForwardingSearch.create();
|
||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||
sc.setParameters("forwarding", forwarding);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -199,14 +199,14 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
public List<FirewallRuleVO> listIPForwarding(String publicIPAddress) {
|
||||
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FirewallRuleVO> listIPForwardingForUpdate(String publicIPAddress) {
|
||||
SearchCriteria<FirewallRuleVO> sc = FWByIPSearch.create();
|
||||
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||
return listActiveBy(sc, null);
|
||||
return listBy(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -234,7 +234,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
sc.setParameters("publicIpAddress", publicIp);
|
||||
sc.setParameters("publicPort", publicPort);
|
||||
sc.setParameters("algorithm", algo);
|
||||
return listActiveBy(sc, null);
|
||||
return listBy(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -245,7 +245,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
sc.setParameters("publicPort", port);
|
||||
sc.setParameters("forwarding", forwarding);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -270,7 +270,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
sc.setParameters("publicIpAddress", publicIpAddress);
|
||||
sc.setParameters("groupId", securityGroupId);
|
||||
sc.setParameters("forwarding", false);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -278,7 +278,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
||||
sc.setParameters("groupId", securityGroupId);
|
||||
sc.setParameters("forwarding", Boolean.TRUE);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -287,7 +287,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
sc.setParameters("publicIpAddress", publicIPAddress);
|
||||
sc.setParameters("forwarding", forwarding);
|
||||
sc.addAnd("privateIpAddress", SearchCriteria.Op.EQ, privateIp);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -295,7 +295,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
SearchCriteria<FirewallRuleVO> sc = FWByGroupId.create();
|
||||
sc.setParameters("groupId", loadBalancerId);
|
||||
sc.setParameters("forwarding", Boolean.FALSE);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -304,7 +304,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
|||
sc.setParameters("groupId", groupId);
|
||||
sc.setParameters("privateIpAddress", privateIp);
|
||||
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) {
|
||||
SearchCriteria<IPAddressVO> sc = AccountSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public List<IPAddressVO> listByDcIdIpAddress(long dcId, String ipAddress) {
|
||||
SearchCriteria<IPAddressVO> sc = DcIpSearch.create();
|
||||
sc.setParameters("dataCenterId", dcId);
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
|||
public List<LoadBalancerVO> listByIpAddress(String ipAddress) {
|
||||
SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -97,7 +97,7 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
|||
SearchCriteria<LoadBalancerVO> sc = IpAndPublicPortSearch.create();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
sc.setParameters("publicPort", publicPort);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -105,6 +105,6 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
|||
SearchCriteria<LoadBalancerVO> sc = AccountAndNameSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("name", name);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||
sc.addAnd("instanceId", SearchCriteria.Op.EQ, instanceId);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,7 +62,7 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||
SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
|
||||
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -71,6 +71,6 @@ public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO
|
|||
sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
|
||||
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) {
|
||||
SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
|
||||
sc.setParameters("securityGroupId", securityGroupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public void deleteBySecurityGroup(long securityGroupId) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
|||
public List<SecurityGroupVO> listByAccountId(long accountId) {
|
||||
SearchCriteria<SecurityGroupVO> sc = AccountIdSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,7 +63,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
|||
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
||||
}
|
||||
|
||||
List<SecurityGroupVO> securityGroups = listActiveBy(sc);
|
||||
List<SecurityGroupVO> securityGroups = listBy(sc);
|
||||
return ((securityGroups != null) && !securityGroups.isEmpty());
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
|||
if (accountId != null) {
|
||||
SearchCriteria<SecurityGroupVO> sc = createSearchCriteria();
|
||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||
List<SecurityGroupVO> accountGroups = listActiveBy(sc);
|
||||
List<SecurityGroupVO> accountGroups = listBy(sc);
|
||||
availableGroups.addAll(accountGroups);
|
||||
} else if (domainId != null) {
|
||||
while (domainId != null) {
|
||||
|
|
@ -83,7 +83,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
|||
if (accountId != null) {
|
||||
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);
|
||||
|
||||
// get the parent domain, repeat the loop
|
||||
|
|
|
|||
|
|
@ -57,28 +57,28 @@ public class SecurityGroupVMMapDaoImpl extends GenericDaoBase<SecurityGroupVMMap
|
|||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIpAndVmId.create();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
sc.setParameters("instanceId", vmId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId) {
|
||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroup.create();
|
||||
sc.setParameters("securityGroupId", securityGroupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecurityGroupVMMapVO> listByIp(String ipAddress) {
|
||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByIp.create();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecurityGroupVMMapVO> listByInstanceId(long vmId) {
|
||||
SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
|
||||
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) {
|
||||
SearchCriteria<IngressRuleVO> sc = networkGroupIdSearch.create();
|
||||
sc.setParameters("networkGroupId", networkGroupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public int deleteByNetworkGroup(long networkGroupId) {
|
||||
|
|
@ -86,7 +86,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||
public List<IngressRuleVO> listByAllowedNetworkGroupId(long networkGroupId) {
|
||||
SearchCriteria<IngressRuleVO> sc = allowedNetworkGroupIdSearch.create();
|
||||
sc.setParameters("allowedNetworkId", networkGroupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -98,7 +98,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||
sc.setParameters("startPort", startPort);
|
||||
sc.setParameters("endPort", endPort);
|
||||
sc.setParameters("cidr", cidr);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -109,7 +109,7 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||
sc.setParameters("startPort", startPort);
|
||||
sc.setParameters("endPort", endPort);
|
||||
sc.setJoinParameters("groupName", "groupName", networkGroup);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -161,6 +161,6 @@ public class IngressRuleDaoImpl extends GenericDaoBase<IngressRuleVO, Long> impl
|
|||
sc.setParameters("endPort", endPort);
|
||||
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) {
|
||||
SearchCriteria<NetworkGroupVO> sc = AccountIdSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -76,7 +76,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
|||
sc.addAnd("accountId", SearchCriteria.Op.NULL);
|
||||
}
|
||||
|
||||
List<NetworkGroupVO> securityGroups = listActiveBy(sc);
|
||||
List<NetworkGroupVO> securityGroups = listBy(sc);
|
||||
return ((securityGroups != null) && !securityGroups.isEmpty());
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
|||
if (accountId != null) {
|
||||
SearchCriteria<NetworkGroupVO> sc = createSearchCriteria();
|
||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||
List<NetworkGroupVO> accountGroups = listActiveBy(sc);
|
||||
List<NetworkGroupVO> accountGroups = listBy(sc);
|
||||
availableGroups.addAll(accountGroups);
|
||||
} else if (domainId != null) {
|
||||
while (domainId != null) {
|
||||
|
|
@ -96,7 +96,7 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
|||
if (accountId != null) {
|
||||
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);
|
||||
|
||||
// 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("groupName", name);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -124,6 +124,6 @@ public class NetworkGroupDaoImpl extends GenericDaoBase<NetworkGroupVO, Long> im
|
|||
|
||||
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("name", groupName);
|
||||
|
||||
return listActiveBy(sc, searchFilter);
|
||||
return listBy(sc, searchFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -56,7 +56,7 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||
SearchCriteria<NetworkGroupRulesVO> sc = AccountSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
|
||||
return listActiveBy(sc, searchFilter);
|
||||
return listBy(sc, searchFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -86,6 +86,6 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||
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();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
sc.setParameters("instanceId", vmId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkGroupVMMapVO> listByNetworkGroup(long networkGroupId) {
|
||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroup.create();
|
||||
sc.setParameters("networkGroupId", networkGroupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkGroupVMMapVO> listByIp(String ipAddress) {
|
||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByIp.create();
|
||||
sc.setParameters("ipAddress", ipAddress);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkGroupVMMapVO> listByInstanceId(long vmId) {
|
||||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmId.create();
|
||||
sc.setParameters("instanceId", vmId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -115,7 +115,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
|||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByNetworkGroupAndStates.create();
|
||||
sc.setParameters("networkGroupId", networkGroupId);
|
||||
sc.setParameters("states", (Object[])vmStates);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -130,7 +130,7 @@ public class NetworkGroupVMMapDaoImpl extends GenericDaoBase<NetworkGroupVMMapVO
|
|||
SearchCriteria<NetworkGroupVMMapVO> sc = ListByVmIdGroupId.create();
|
||||
sc.setParameters("networkGroupId", networkGroupId);
|
||||
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) {
|
||||
SearchCriteria<NetworkGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
|
||||
sc.setParameters("vmId", vmId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -161,7 +161,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
|||
SearchCriteria<NetworkGroupWorkVO> sc = VmIdStepSearch.create();
|
||||
sc.setParameters("vmId", vmId);
|
||||
sc.setParameters("step", step);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,7 +196,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
|
|||
sc.setParameters("taken", timeBefore);
|
||||
sc.setParameters("step", Step.Processing);
|
||||
|
||||
List<NetworkGroupWorkVO> result = listBy(sc);
|
||||
List<NetworkGroupWorkVO> result = listIncludingRemovedBy(sc);
|
||||
|
||||
NetworkGroupWorkVO work = createForUpdate();
|
||||
work.setStep(Step.Error);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> im
|
|||
public VmRulesetLogVO findByVmId(long vmId) {
|
||||
SearchCriteria<VmRulesetLogVO> sc = VmIdSearch.create();
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,12 +409,13 @@ public interface ManagementServer {
|
|||
* @param accountId
|
||||
* @param domainId
|
||||
* @param zoneId
|
||||
* @param vmId
|
||||
* @return allocated IP address in the zone specified
|
||||
* @throws InsufficientAddressCapacityException if no more addresses are available
|
||||
* @throws InvalidParameterValueException if no router for that user exists in the zone specified
|
||||
* @throws InternalErrorException if the new address could not be sent down to the router
|
||||
*/
|
||||
String associateIpAddress(long userId, long accountId, long domainId, long zoneId) throws ResourceAllocationException, InsufficientAddressCapacityException, InvalidParameterValueException, InternalErrorException;
|
||||
String associateIpAddress(long userId, long accountId, long domainId, long zoneId, long vmId) throws ResourceAllocationException, InsufficientAddressCapacityException, InvalidParameterValueException, InternalErrorException;
|
||||
long associateIpAddressAsync(long userId, long accountId, long domainId, long zoneId);
|
||||
|
||||
|
||||
|
|
@ -1836,8 +1837,9 @@ public interface ManagementServer {
|
|||
* @param mirrored boolean value of whether or not the offering provides disk mirroring
|
||||
* @param tags Comma separated string to indicate special tags for the disk offering.
|
||||
* @return the created disk offering, null if failed to create
|
||||
* @throws InternalErrorException
|
||||
*/
|
||||
DiskOfferingVO createDiskOffering(long userId, long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException;
|
||||
DiskOfferingVO createDiskOffering(long userId, long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
/**
|
||||
* Delete a disk offering
|
||||
|
|
@ -2194,7 +2196,7 @@ public interface ManagementServer {
|
|||
* @param template id - the id of the template
|
||||
*
|
||||
*/
|
||||
void extractTemplate(String url, Long templateId, Long zoneId) throws URISyntaxException;
|
||||
void extractTemplate(String url, Long templateId, Long zoneId, long eventId, long asyncJobId) throws URISyntaxException;
|
||||
|
||||
Map<String, String> listCapabilities();
|
||||
GuestOSVO getGuestOs(Long guestOsId);
|
||||
|
|
@ -2241,13 +2243,21 @@ public interface ManagementServer {
|
|||
* Extracts the volume to a particular location.
|
||||
* @param url - the url where the volume needs to be extracted to
|
||||
* @param zoneId - zone id of the volume
|
||||
* @param asyncJobId
|
||||
* @param eventId
|
||||
* @param volume id - the id of the volume
|
||||
* @throws URISyntaxException
|
||||
* @throws InternalErrorException
|
||||
*
|
||||
*/
|
||||
void extractVolume(String url, Long volumeId, Long zoneId) throws
|
||||
void extractVolume(String url, Long volumeId, Long zoneId, long eventId, Long asyncJobId) throws
|
||||
URISyntaxException, InternalErrorException;
|
||||
|
||||
long extractTemplateAsync(String url, Long templateId, Long zoneId) throws URISyntaxException;
|
||||
long extractVolumeAsync(String url, Long volumeId, Long zoneId) throws URISyntaxException;
|
||||
|
||||
/*
|
||||
* Fetches the version of cloud stack
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,31 +39,10 @@ import com.cloud.user.AccountVO;
|
|||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.exception.ExecutionException;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
|
||||
public interface StorageManager extends Manager {
|
||||
/**
|
||||
* Convenience method for creating a VM with a data disk based on a template.
|
||||
* @param vm VM to create disks for.
|
||||
* @param template Template to based the root disk on.
|
||||
* @param rootOffering Disk offering for the root disk.
|
||||
* @param dataOffering Disk offering for the data disk.
|
||||
* @param size size of the data disk if the data disk offering has variable size.
|
||||
* @param dc data center to deploy in.
|
||||
* @param account owner.
|
||||
* @return List<VolumeVO> where the first disk is the root disk.
|
||||
*/
|
||||
List<VolumeVO> allocateTemplatedVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DiskOfferingVO dataOffering, Long size, DataCenterVO dc, AccountVO account);
|
||||
|
||||
/**
|
||||
* Convenience method for allocating system VMs in the database.
|
||||
* @param vm VM to create disks for.
|
||||
* @param template template the root disk should be based on.
|
||||
* @param rootOffering Disk offering for the root disk.
|
||||
* @param dc data center to deploy in.
|
||||
* @return VolumeVO volume allocated.
|
||||
*/
|
||||
VolumeVO allocateSystemVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DataCenterVO dc);
|
||||
|
||||
|
||||
VolumeVO allocateIsoInstalledVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, Long size, DataCenterVO dc, AccountVO account);
|
||||
|
|
@ -328,7 +307,8 @@ public interface StorageManager extends Manager {
|
|||
* @param account
|
||||
* @return VolumeVO a persisted volume.
|
||||
*/
|
||||
<T extends VMInstanceVO> VolumeVO allocate(VolumeType type, DiskOfferingVO offering, String name, Long size, VMTemplateVO template, T vm, AccountVO account);
|
||||
<T extends VMInstanceVO> DiskProfile allocateRawVolume(VolumeType type, String name, DiskOfferingVO offering, Long size, T vm, AccountVO owner);
|
||||
<T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(VolumeType type, String name, DiskOfferingVO offering, VMTemplateVO template, T vm, AccountVO owner);
|
||||
|
||||
<T extends VMInstanceVO> void create(T vm);
|
||||
Long findHostIdForStoragePool(StoragePoolVO pool);
|
||||
|
|
|
|||
|
|
@ -553,5 +553,5 @@ public class VolumeVO implements Volume {
|
|||
public void setAttached(Date attached){
|
||||
this.attached = attached;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||
SearchCriteria<DiskOfferingVO> sc = DomainIdSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
// 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
|
||||
public List<DiskOfferingVO> findPrivateDiskOffering() {
|
||||
SearchCriteria<DiskOfferingVO> sc = PrivateDiskOfferingSearch.create();
|
||||
sc.setParameters("diskSize", 0);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DiskTemplateDaoImpl extends GenericDaoBase<DiskTemplateVO, Long> im
|
|||
sc.setParameters("type", type);
|
||||
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.
|
||||
return vos.size() == 0 ? null : vos.get(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
|||
SearchCriteria<LaunchPermissionVO> sc = TemplateAndAccountSearch.create();
|
||||
sc.setParameters("templateId", templateId);
|
||||
sc.setParameters("accountId", accountId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -153,6 +153,6 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
|||
public List<LaunchPermissionVO> findByTemplate(long templateId) {
|
||||
SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
|
||||
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) {
|
||||
SearchCriteria<SnapshotVO> sc = ParentIdSearch.create();
|
||||
sc.setParameters("prevSnapshotId", snapshotId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,7 +52,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
|||
public List<SnapshotVO> listByVolumeId(Filter filter, long volumeId ) {
|
||||
SearchCriteria<SnapshotVO> sc = VolumeIdSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
return listActiveBy(sc, filter);
|
||||
return listBy(sc, filter);
|
||||
}
|
||||
|
||||
protected SnapshotDaoImpl() {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
|||
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdIntervalSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
sc.setParameters("interval", interval);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -53,7 +53,7 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
|||
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
sc.setParameters("active", true);
|
||||
return listActiveBy(sc, filter);
|
||||
return listBy(sc, filter);
|
||||
}
|
||||
|
||||
protected SnapshotPolicyDaoImpl() {
|
||||
|
|
@ -76,6 +76,6 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
|||
public List<SnapshotPolicyVO> listActivePolicies() {
|
||||
SearchCriteria<SnapshotPolicyVO> sc = ActivePolicySearch.create();
|
||||
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();
|
||||
sc.setParameters("snapshotId", snapshotId);
|
||||
sc.setParameters("policyId", policyId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -70,7 +70,7 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
|||
public List<SnapshotPolicyRefVO> listBySnapshotId(long snapshotId) {
|
||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapSearch.create();
|
||||
sc.setParameters("snapshotId", snapshotId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -78,6 +78,6 @@ public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO
|
|||
SearchCriteria<SnapshotPolicyRefVO> sc = policySearch.create();
|
||||
sc.setParameters("policyId", policyId);
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
|||
sc.setParameters("scheduledTimestamp", date);
|
||||
// Don't return manual snapshots. They will be executed through another code path.
|
||||
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);
|
||||
// Don't return manual snapshots. They will be executed through another code path.
|
||||
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;
|
||||
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.
|
||||
assert (snapshotSchedules.size() <= 1);
|
||||
if (snapshotSchedules.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
public List<StoragePoolVO> findPoolByName(String name) {
|
||||
SearchCriteria<StoragePoolVO> sc = NameSearch.create();
|
||||
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) {
|
||||
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
||||
sc.setParameters("uuid", uuid);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
|
||||
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
||||
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) {
|
||||
SearchCriteria<StoragePoolVO> sc = DatacenterSearch.create();
|
||||
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) {
|
||||
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
||||
sc.setParameters("host", hostFqdnOrIp);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -204,7 +204,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
sc.setParameters("datacenterId", datacenterId);
|
||||
sc.setParameters("podId", podId);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -215,12 +215,12 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
sc.setParameters("podId", podId);
|
||||
|
||||
sc.setParameters("cluster", clusterId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
} else {
|
||||
SearchCriteria<StoragePoolVO> sc = DcPodAnyClusterSearch.create();
|
||||
sc.setParameters("datacenterId", datacenterId);
|
||||
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("path", path);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public StoragePoolVO listById(Integer id)
|
||||
|
|
@ -238,7 +238,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
SearchCriteria<StoragePoolVO> sc = HostSearch.create();
|
||||
sc.setParameters("id", id);
|
||||
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailV
|
|||
SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
|
||||
sc.setParameters("pool", poolId);
|
||||
|
||||
List<StoragePoolDetailVO> details = listActiveBy(sc);
|
||||
List<StoragePoolDetailVO> details = listBy(sc);
|
||||
Map<String, String> detailsMap = new HashMap<String, String>();
|
||||
for (StoragePoolDetailVO detail : details) {
|
||||
detailsMap.put(detail.getName(), detail.getValue());
|
||||
|
|
|
|||
|
|
@ -91,14 +91,14 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo
|
|||
public List<StoragePoolHostVO> listByPoolId(long id) {
|
||||
SearchCriteria<StoragePoolHostVO> sc = PoolSearch.create();
|
||||
sc.setParameters("pool_id", id);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoragePoolHostVO> listByHostId(long hostId) {
|
||||
SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
|
||||
sc.setParameters("host_id", hostId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -106,7 +106,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo
|
|||
SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create();
|
||||
sc.setParameters("pool_id", poolId);
|
||||
sc.setParameters("host_id", hostId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -74,35 +74,35 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
public List<VMTemplateVO> listByPublic() {
|
||||
SearchCriteria<VMTemplateVO> sc = PublicSearch.create();
|
||||
sc.setParameters("public", 1);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findByName(String templateName) {
|
||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||
sc.setParameters("uniqueName", templateName);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findByTemplateName(String templateName) {
|
||||
SearchCriteria<VMTemplateVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", templateName);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findRoutingTemplate() {
|
||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||
sc.setParameters("uniqueName", routerTmpltName);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findConsoleProxyTemplate() {
|
||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
||||
sc.setParameters("uniqueName", consoleProxyTmpltName);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -110,7 +110,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
|
||||
sc.addAnd("ready", SearchCriteria.Op.EQ, true);
|
||||
sc.addAnd("format", SearchCriteria.Op.NEQ, Storage.ImageFormat.ISO);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -123,14 +123,14 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||
if (path != null)
|
||||
sc.addAnd("path", SearchCriteria.Op.EQ, path);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateVO> listByAccountId(long accountId) {
|
||||
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
PoolTemplateSearch.done();
|
||||
}
|
||||
|
||||
public void update(VMTemplateHostVO instance) {
|
||||
@Override
|
||||
public void update(VMTemplateHostVO instance) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
|
|
@ -138,7 +139,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
public List<VMTemplateHostVO> listByHostId(long id) {
|
||||
SearchCriteria<VMTemplateHostVO> sc = HostSearch.create();
|
||||
sc.setParameters("host_id", id);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -146,14 +147,14 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
sc.setParameters("destroyed", false);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateHostVO> listByOnlyTemplateId(long templateId) {
|
||||
SearchCriteria<VMTemplateHostVO> sc = TemplateSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -161,17 +162,15 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
||||
sc.setParameters("host_id", hostId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<VMTemplateHostVO> listByTemplateStatus(long templateId, VMTemplateHostVO.Status downloadState) {
|
||||
SearchCriteria<VMTemplateHostVO> sc = TemplateStatusSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
sc.setParameters("download_state", downloadState.toString());
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -257,7 +256,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
sc.setParameters("host_id", hostId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
sc.setParameters("pool_id", poolId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -265,7 +264,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
SearchCriteria<VMTemplateHostVO> sc = HostTemplateSearch.create();
|
||||
sc.setParameters("host_id", hostId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -273,7 +272,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
SearchCriteria<VMTemplateHostVO> sc = PoolTemplateSearch.create();
|
||||
sc.setParameters("pool_id", poolId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -281,7 +280,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
SearchCriteria<VMTemplateHostVO> sc = HostDestroyedSearch.create();
|
||||
sc.setParameters("host_id", hostId);
|
||||
sc.setParameters("destroyed", true);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -290,7 +289,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long
|
|||
sc.setParameters("host_id", hostId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
if (!lock)
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
else
|
||||
return lock(sc, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,14 +100,14 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
|||
public List<VMTemplateStoragePoolVO> listByPoolId(long id) {
|
||||
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolSearch.create();
|
||||
sc.setParameters("pool_id", id);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateStoragePoolVO> listByTemplateId(long templateId) {
|
||||
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -115,7 +115,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
|||
SearchCriteria<VMTemplateStoragePoolVO> sc = PoolTemplateSearch.create();
|
||||
sc.setParameters("pool_id", hostId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -123,7 +123,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
|||
SearchCriteria<VMTemplateStoragePoolVO> sc = TemplateStatusSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
sc.setParameters("download_state", downloadState.toString());
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -132,7 +132,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV
|
|||
sc.setParameters("pool_id", poolId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
sc.setParameters("download_state", downloadState.toString());
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
|||
public List<VMTemplateZoneVO> listByZoneId(long id) {
|
||||
SearchCriteria<VMTemplateZoneVO> sc = ZoneSearch.create();
|
||||
sc.setParameters("zone_id", id);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateZoneVO> listByTemplateId(long templateId) {
|
||||
SearchCriteria<VMTemplateZoneVO> sc = TemplateSearch.create();
|
||||
sc.setParameters("template_id", templateId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -73,7 +73,7 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
|||
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
||||
sc.setParameters("zone_id", zoneId);
|
||||
sc.setParameters("template_id", templateId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -81,7 +81,7 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long
|
|||
SearchCriteria<VMTemplateZoneVO> sc = ZoneTemplateSearch.create();
|
||||
sc.setParameters("zone_id", zoneId);
|
||||
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();
|
||||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("destroyed", false);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -109,14 +109,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
SearchCriteria<VolumeVO> sc = AccountIdSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("destroyed", false);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByInstance(long id) {
|
||||
SearchCriteria<VolumeVO> sc = InstanceIdSearch.create();
|
||||
sc.setParameters("instanceId", id);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -124,14 +124,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
SearchCriteria<VolumeVO> sc = InstanceAndDeviceIdSearch.create();
|
||||
sc.setParameters("instanceId", instanceId);
|
||||
sc.setParameters("deviceId", deviceId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByPoolId(long poolId) {
|
||||
SearchCriteria<VolumeVO> sc = PoolIdSearch.create();
|
||||
sc.setParameters("poolId", poolId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -140,7 +140,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
sc.setParameters("instanceId", id);
|
||||
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
||||
sc.setParameters("destroyed", false);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -148,7 +148,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
SearchCriteria<VolumeVO> sc = InstanceAndTypeSearch.create();
|
||||
sc.setParameters("instanceId", id);
|
||||
sc.setParameters("vType", vType.toString());
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -156,14 +156,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
SearchCriteria<VolumeVO> sc = InstanceIdDestroyedSearch.create();
|
||||
sc.setParameters("instanceId", vmId);
|
||||
sc.setParameters("destroyed", true);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByDetachedDestroyed() {
|
||||
SearchCriteria<VolumeVO> sc = DetachedDestroyedSearch.create();
|
||||
sc.setParameters("destroyed", true);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -174,7 +174,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
sc.setParameters("destroyed", false);
|
||||
sc.setParameters("status", AsyncInstanceCreateStatus.Created);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -183,7 +183,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
sc.setParameters("template", templateId);
|
||||
sc.setParameters("zone", zoneId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
|
|
@ -215,7 +215,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
SearchCriteria<VolumeVO> sc = MirrorSearch.create();
|
||||
sc.setParameters("mirrorState", MirrorState.ACTIVE.toString());
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
public TemplateUploader.Status status = TemplateUploader.Status.NOT_STARTED;
|
||||
public String errorString = "";
|
||||
public long totalBytes = 0;
|
||||
public long templateSizeinBytes;
|
||||
public long entitySizeinBytes;
|
||||
private String sourcePath;
|
||||
private String ftpUrl;
|
||||
private UploadCompleteCallback completionCallback;
|
||||
|
|
@ -28,12 +28,12 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
private BufferedOutputStream outputStream = null;
|
||||
private static final int CHUNK_SIZE = 1024*1024; //1M
|
||||
|
||||
public FtpTemplateUploader(String sourcePath, String url, UploadCompleteCallback callback, long templateSizeinBytes){
|
||||
public FtpTemplateUploader(String sourcePath, String url, UploadCompleteCallback callback, long entitySizeinBytes){
|
||||
|
||||
this.sourcePath = sourcePath;
|
||||
this.ftpUrl = url;
|
||||
this.completionCallback = callback;
|
||||
this.templateSizeinBytes = templateSizeinBytes;
|
||||
this.entitySizeinBytes = entitySizeinBytes;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
|
||||
Date start = new Date();
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sb = new StringBuffer(ftpUrl);
|
||||
// check for authentication else assume its anonymous access.
|
||||
/* if (user != null && password != null)
|
||||
{
|
||||
|
|
@ -59,11 +59,8 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
sb.append( ':' );
|
||||
sb.append( password );
|
||||
sb.append( '@' );
|
||||
}*/
|
||||
sb.append( ftpUrl );
|
||||
/*sb.append( '/' );
|
||||
sb.append( fileName ); filename where u want to dld it */
|
||||
/*ftp://10.91.18.14/
|
||||
}*/
|
||||
/*
|
||||
* type ==> a=ASCII mode, i=image (binary) mode, d= file directory
|
||||
* listing
|
||||
*/
|
||||
|
|
@ -73,9 +70,11 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
{
|
||||
URL url = new URL( sb.toString() );
|
||||
URLConnection urlc = url.openConnection();
|
||||
File sourceFile = new File(sourcePath);
|
||||
entitySizeinBytes = sourceFile.length();
|
||||
|
||||
outputStream = new BufferedOutputStream( urlc.getOutputStream() );
|
||||
inputStream = new BufferedInputStream( new FileInputStream( new File(sourcePath) ) );
|
||||
inputStream = new BufferedInputStream( new FileInputStream(sourceFile) );
|
||||
|
||||
status = TemplateUploader.Status.IN_PROGRESS;
|
||||
|
||||
|
|
@ -146,20 +145,20 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
|
||||
@Override
|
||||
public String getUploadLocalPath() {
|
||||
return null;
|
||||
return sourcePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUploadPercent() {
|
||||
if (templateSizeinBytes == 0) {
|
||||
if (entitySizeinBytes == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int)(100.0*totalBytes/templateSizeinBytes);
|
||||
return (int)(100.0*totalBytes/entitySizeinBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUploadTime() {
|
||||
// TODO Auto-generated method stub
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -168,11 +167,6 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
return totalBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInited() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResume(boolean resume) {
|
||||
this.resume = resume;
|
||||
|
|
@ -217,7 +211,6 @@ public class FtpTemplateUploader implements TemplateUploader {
|
|||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,9 +69,6 @@ public interface TemplateUploader extends Runnable{
|
|||
|
||||
public void setUploadError(String string);
|
||||
|
||||
public void setResume(boolean resume);
|
||||
|
||||
public boolean isInited();
|
||||
|
||||
public void setResume(boolean resume);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ public class UploadManagerImpl implements UploadManager {
|
|||
}
|
||||
|
||||
private static class UploadJob {
|
||||
private final TemplateUploader td;
|
||||
private final TemplateUploader tu;
|
||||
private final String jobId;
|
||||
private final String tmpltName;
|
||||
private final String name;
|
||||
private final ImageFormat format;
|
||||
private String tmpltPath;
|
||||
private String description;
|
||||
|
|
@ -65,11 +65,11 @@ public class UploadManagerImpl implements UploadManager {
|
|||
private long templatesize;
|
||||
private long id;
|
||||
|
||||
public UploadJob(TemplateUploader td, String jobId, long id, String tmpltName, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix) {
|
||||
public UploadJob(TemplateUploader tu, String jobId, long id, String name, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix) {
|
||||
super();
|
||||
this.td = td;
|
||||
this.tu = tu;
|
||||
this.jobId = jobId;
|
||||
this.tmpltName = tmpltName;
|
||||
this.name = name;
|
||||
this.format = format;
|
||||
this.accountId = accountId;
|
||||
this.description = descr;
|
||||
|
|
@ -80,7 +80,7 @@ public class UploadManagerImpl implements UploadManager {
|
|||
}
|
||||
|
||||
public TemplateUploader getTd() {
|
||||
return td;
|
||||
return tu;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
@ -92,14 +92,14 @@ public class UploadManagerImpl implements UploadManager {
|
|||
}
|
||||
|
||||
public UploadJob(TemplateUploader td, String jobId, UploadCommand cmd) {
|
||||
this.td = td;
|
||||
this.tu = td;
|
||||
this.jobId = jobId;
|
||||
this.tmpltName = cmd.getName();
|
||||
this.name = cmd.getName();
|
||||
this.format = cmd.getFormat();
|
||||
}
|
||||
|
||||
public TemplateUploader getTemplateUploader() {
|
||||
return td;
|
||||
return tu;
|
||||
}
|
||||
|
||||
public String getJobId() {
|
||||
|
|
@ -107,7 +107,7 @@ public class UploadManagerImpl implements UploadManager {
|
|||
}
|
||||
|
||||
public String getTmpltName() {
|
||||
return tmpltName;
|
||||
return name;
|
||||
}
|
||||
|
||||
public ImageFormat getFormat() {
|
||||
|
|
@ -135,6 +135,13 @@ public class UploadManagerImpl implements UploadManager {
|
|||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (tu != null) {
|
||||
String upldPath = tu.getUploadLocalPath();
|
||||
if (upldPath != null) {
|
||||
File f = new File(upldPath);
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTemplatesize(long templatesize) {
|
||||
|
|
|
|||
|
|
@ -112,26 +112,26 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||
public List<AccountVO> findAccountsLike(String accountName) {
|
||||
SearchCriteria<AccountVO> sc = createSearchCriteria();
|
||||
sc.addAnd("accountName", SearchCriteria.Op.LIKE, "%"+accountName+"%");
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Account findActiveAccount(String accountName, Long domainId) {
|
||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Account findAccount(String accountName, Long domainId) {
|
||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
public Account findActiveAccountByName(String accountName) {
|
||||
SearchCriteria<AccountVO> sc = AccountNameSearch.create("accountName", accountName);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
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();
|
||||
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) {
|
||||
|
|
@ -152,7 +152,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||
sc.addAnd("removed", SearchCriteria.Op.NNULL);
|
||||
sc.addAnd("removed", SearchCriteria.Op.GTEQ, earliestRemovedDate);
|
||||
|
||||
return listBy(sc, filter);
|
||||
return listIncludingRemovedBy(sc, 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();
|
||||
sc.addAnd("id", SearchCriteria.Op.GT, minAccountId);
|
||||
|
||||
return listBy(sc, filter);
|
||||
return listIncludingRemovedBy(sc, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class UserAccountDaoImpl extends GenericDaoBase<UserAccountVO, Long> impl
|
|||
SearchCriteria<UserAccountVO> sc = createSearchCriteria();
|
||||
sc.addAnd("username", SearchCriteria.Op.EQ, username);
|
||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -75,41 +75,41 @@ public class UserDaoImpl extends GenericDaoBase<UserVO, Long> implements UserDao
|
|||
SearchCriteria<UserVO> sc = UsernamePasswordSearch.create();
|
||||
sc.setParameters("username", username);
|
||||
sc.setParameters("password", password);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
public List<UserVO> listByAccount(long accountId) {
|
||||
SearchCriteria<UserVO> sc = AccountIdSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
return listActiveBy(sc, null);
|
||||
return listBy(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVO getUser(String username) {
|
||||
SearchCriteria<UserVO> sc = UsernameSearch.create();
|
||||
sc.setParameters("username", username);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVO getUser(long userId) {
|
||||
SearchCriteria<UserVO> sc = UserIdSearch.create();
|
||||
sc.setParameters("id", userId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserVO> findUsersLike(String username) {
|
||||
SearchCriteria<UserVO> sc = UsernameLikeSearch.create();
|
||||
sc.setParameters("username", "%" + username + "%");
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVO findUserBySecretKey(String secretKey) {
|
||||
SearchCriteria<UserVO> sc = SecretKeySearch.create();
|
||||
sc.setParameters("secretKey", secretKey);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class UserStatisticsDaoImpl extends GenericDaoBase<UserStatisticsVO, Long
|
|||
SearchCriteria<UserStatisticsVO> sc = UserDcSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -36,12 +36,14 @@ import javax.persistence.Temporal;
|
|||
import javax.persistence.TemporalType;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.db.StateMachine;
|
||||
import com.cloud.utils.fsm.FiniteStateObject;
|
||||
|
||||
@Entity
|
||||
@Table(name="vm_instance")
|
||||
@Inheritance(strategy=InheritanceType.JOINED)
|
||||
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class VMInstanceVO implements VirtualMachine {
|
||||
public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> {
|
||||
@Id
|
||||
@TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1)
|
||||
@Column(name="id", updatable=false, nullable = false)
|
||||
|
|
@ -65,7 +67,8 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
* the state machine needs to go through the DAO object because someone
|
||||
* else could be updating it as well.
|
||||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@StateMachine(state=State.class, event=Event.class)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
private State state = null;
|
||||
|
||||
|
|
@ -128,6 +131,7 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
Type type,
|
||||
Long vmTemplateId,
|
||||
long guestOSId,
|
||||
|
||||
boolean haEnabled) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
|
@ -138,6 +142,9 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
this.type = type;
|
||||
this.guestOSId = guestOSId;
|
||||
this.haEnabled = haEnabled;
|
||||
this.mirroredVols = false;
|
||||
this.vncPassword = Long.toHexString(new Random().nextLong());
|
||||
this.state = State.Creating;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -193,11 +200,13 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
return updated;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
@Override
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +214,8 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
return updateTime;
|
||||
}
|
||||
|
||||
public long getDataCenterId() {
|
||||
@Override
|
||||
public long getDataCenterId() {
|
||||
return dataCenterId;
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +252,8 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
}
|
||||
|
||||
// don't use this directly, use VM state machine instead, this method is added for migration tool only
|
||||
public void setState(State state) {
|
||||
@Override
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +303,8 @@ public class VMInstanceVO implements VirtualMachine {
|
|||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public long getGuestOSId() {
|
||||
@Override
|
||||
public long getGuestOSId() {
|
||||
return guestOSId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,21 +231,21 @@ public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> im
|
|||
SearchCriteria<ConsoleProxyVO> sc = DataCenterStatusSearch.create();
|
||||
sc.setParameters("states", (Object[])states);
|
||||
sc.setParameters("dc", dataCenterId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConsoleProxyVO> getProxyListInStates(State... states) {
|
||||
SearchCriteria<ConsoleProxyVO> sc = StateSearch.create();
|
||||
sc.setParameters("states", (Object[])states);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConsoleProxyVO> listByHostId(long hostId) {
|
||||
SearchCriteria<ConsoleProxyVO> sc = HostSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -253,7 +253,7 @@ public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> im
|
|||
SearchCriteria<ConsoleProxyVO> sc = HostUpSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
public DomainRouterVO findByPublicIpAddress(String ipAddress) {
|
||||
SearchCriteria<DomainRouterVO> sc = IpSearch.create();
|
||||
sc.setParameters("ip", ipAddress);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,7 +196,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
public List<DomainRouterVO> listByDataCenter(long dcId) {
|
||||
SearchCriteria<DomainRouterVO> sc = DcSearch.create();
|
||||
sc.setParameters("dc", dcId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -205,7 +205,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("role", Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -214,21 +214,21 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("role", role);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> listBy(long accountId) {
|
||||
SearchCriteria<DomainRouterVO> sc = AccountSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> listByHostId(Long hostId) {
|
||||
SearchCriteria<DomainRouterVO> sc = HostSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -238,7 +238,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
sc.setParameters("host", hostId);
|
||||
}
|
||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -287,13 +287,13 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
|||
public List<DomainRouterVO> listByDomain(Long domainId) {
|
||||
SearchCriteria<DomainRouterVO> sc = DomainIdSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> listByVlanDbId(Long vlanDbId) {
|
||||
SearchCriteria<DomainRouterVO> sc = VlanDbIdSearch.create();
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class InstanceGroupDaoImpl extends GenericDaoBase<InstanceGroupVO, Long>
|
|||
if (accountId != null) {
|
||||
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
|
||||
}
|
||||
List<InstanceGroupVO> vmGroups = listActiveBy(sc);
|
||||
List<InstanceGroupVO> vmGroups = listBy(sc);
|
||||
return ((vmGroups != null) && !vmGroups.isEmpty());
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ public class InstanceGroupDaoImpl extends GenericDaoBase<InstanceGroupVO, Long>
|
|||
SearchCriteria<InstanceGroupVO> sc = AccountIdNameSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
sc.setParameters("groupName", name);
|
||||
return findOneActiveBy(sc);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -56,6 +56,6 @@ public class InstanceGroupDaoImpl extends GenericDaoBase<InstanceGroupVO, Long>
|
|||
public List<InstanceGroupVO> listByAccountId(long id) {
|
||||
SearchCriteria<InstanceGroupVO> sc = AccountSearch.create();
|
||||
sc.setParameters("account", id);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ public class InstanceGroupVMMapDaoImpl extends GenericDaoBase<InstanceGroupVMMap
|
|||
public List<InstanceGroupVMMapVO> listByInstanceId(long vmId) {
|
||||
SearchCriteria<InstanceGroupVMMapVO> sc = ListByVmId.create();
|
||||
sc.setParameters("instanceId", vmId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InstanceGroupVMMapVO> listByGroupId(long groupId) {
|
||||
SearchCriteria<InstanceGroupVMMapVO> sc = ListByGroupId.create();
|
||||
sc.setParameters("groupId", groupId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -158,21 +158,21 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
|||
SearchCriteria<SecondaryStorageVmVO> sc = DataCenterStatusSearch.create();
|
||||
sc.setParameters("states", (Object[])states);
|
||||
sc.setParameters("dc", dataCenterId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecondaryStorageVmVO> getSecStorageVmListInStates(State... states) {
|
||||
SearchCriteria<SecondaryStorageVmVO> sc = StateSearch.create();
|
||||
sc.setParameters("states", (Object[])states);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecondaryStorageVmVO> listByHostId(long hostId) {
|
||||
SearchCriteria<SecondaryStorageVmVO> sc = HostSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -180,7 +180,7 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
|||
SearchCriteria<SecondaryStorageVmVO> sc = HostUpSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -208,6 +208,6 @@ public class SecondaryStorageVmDaoImpl extends GenericDaoBase<SecondaryStorageVm
|
|||
public List<SecondaryStorageVmVO> listByZoneId(long zoneId) {
|
||||
SearchCriteria<SecondaryStorageVmVO> sc = ZoneSearch.create();
|
||||
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("pod", podId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
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("dc", dcId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -148,7 +148,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
ssc.addOr("state", SearchCriteria.Op.EQ, state.toString());
|
||||
}
|
||||
sc.addAnd("state", SearchCriteria.Op.SC, ssc);
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -165,7 +165,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
|
||||
sc.setParameters("router", routerId);
|
||||
|
||||
return listBy(sc);
|
||||
return listIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -225,20 +225,20 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
sc.setParameters("state", State.Destroyed, State.Expunging);
|
||||
sc.setParameters("updateTime", date);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<UserVmVO> listByAccountId(long id) {
|
||||
SearchCriteria<UserVmVO> sc = AccountSearch.create();
|
||||
sc.setParameters("account", id);
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<UserVmVO> listByHostId(Long id) {
|
||||
SearchCriteria<UserVmVO> sc = HostSearch.create();
|
||||
sc.setParameters("host", id);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -246,7 +246,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
SearchCriteria<UserVmVO> sc = HostUpSearch.create();
|
||||
sc.setParameters("host", hostId);
|
||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
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("state", State.Running);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public UserVmVO findByName(String name) {
|
||||
SearchCriteria<UserVmVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", name);
|
||||
return findOneBy(sc);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -282,7 +282,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
sc.setParameters("dc", dcId);
|
||||
sc.setJoinParameters("offeringSearch", "guestIpType", NetworkOffering.GuestIpType.Virtualized);
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -292,6 +292,6 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
sc.setParameters("ip", ipAddress);
|
||||
sc.setParameters("states", new Object[] {State.Destroyed, State.Expunging});
|
||||
|
||||
return listActiveBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue