Build fixes after first pass at merge

This commit is contained in:
Chiradeep Vittal 2011-05-02 18:57:42 -07:00
parent 303e2a7481
commit b42ebf4872
12 changed files with 667 additions and 593 deletions

View File

@ -556,7 +556,6 @@ public class FakeComputingResource extends ServerResourceBase implements ServerR
VolumeTO vol = new VolumeTO(cmd.getVolumeId(), VolumeTO vol = new VolumeTO(cmd.getVolumeId(),
Volume.Type.ROOT, Volume.Type.ROOT,
Storage.StorageResourceType.STORAGE_POOL,
com.cloud.storage.Storage.StoragePoolType.LVM, cmd com.cloud.storage.Storage.StoragePoolType.LVM, cmd
.getPool().getUuid(), "dummy", "/mountpoint", .getPool().getUuid(), "dummy", "/mountpoint",
"dummyPath", 1000L, null); "dummyPath", 1000L, null);

View File

@ -78,6 +78,7 @@ import com.cloud.agent.api.CleanupNetworkRulesCmd;
import com.cloud.agent.api.Command; import com.cloud.agent.api.Command;
import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
import com.cloud.agent.api.CreateStoragePoolCommand;
import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
import com.cloud.agent.api.DeleteSnapshotBackupAnswer; import com.cloud.agent.api.DeleteSnapshotBackupAnswer;

View File

@ -221,7 +221,7 @@ public class ApiConstants {
public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip"; public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
public static final String PING_DIR = "pingdir"; public static final String PING_DIR = "pingdir";
public static final String TFTP_DIR = "tftpdir"; public static final String TFTP_DIR = "tftpdir";
public static final String PZING_CIFS_USERNAME = "pingcifsusername"; public static final String PING_CIFS_USERNAME = "pingcifsusername";
public static final String PING_CIFS_PASSWORD = "pingcifspassword"; public static final String PING_CIFS_PASSWORD = "pingcifspassword";
public static final String CHECKSUM="checksum"; public static final String CHECKSUM="checksum";
public static final String NETWORK_DEVICE_TYPE = "networkdevicetype"; public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";

View File

@ -520,35 +520,6 @@ public class VirtualRoutingResource implements Manager {
} }
} }
private void deletExitingLinkLocalRoutTable(String linkLocalBr) {
Script command = new Script("/bin/bash", _timeout);
command.add("-c");
command.add("ip route | grep " + NetUtils.getLinkLocalCIDR());
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
String result = command.execute(parser);
boolean foundLinkLocalBr = false;
if (result == null && parser.getLines() != null) {
String[] lines = parser.getLines().split("\\n");
for (String line : lines) {
String[] tokens = line.split(" ");
if (!tokens[2].equalsIgnoreCase(linkLocalBr)) {
Script.runSimpleBashScript("ip route del " + NetUtils.getLinkLocalCIDR());
} else {
foundLinkLocalBr = true;
}
}
}
if (!foundLinkLocalBr) {
Script.runSimpleBashScript("ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway());
}
}
public void createControlNetwork(String privBrName) {
deletExitingLinkLocalRoutTable(privBrName);
if (!isBridgeExists(privBrName)) {
Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up;", _timeout);
}
}
// protected Answer execute(final SetFirewallRuleCommand cmd) { // protected Answer execute(final SetFirewallRuleCommand cmd) {
// String args; // String args;

View File

@ -142,15 +142,6 @@ public interface AgentManager extends Manager {
int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority); int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority);
/**
* Register to listen for initial agent connections.
* @param creator
* @param priority in listening for events.
* @return id to unregister if needed.
*/
int registerForInitialConnects(StartupCommandProcessor creator, boolean priority);
/** /**
* Register to listen for initial agent connections. * Register to listen for initial agent connections.
* @param creator * @param creator

View File

@ -238,7 +238,6 @@ public enum Config {
DefaultMaxAccountTemplates("Account Defaults", ManagementServer.class, Long.class, "max.account.templates", "20", "The default maximum number of templates that can be deployed for an account", null), DefaultMaxAccountTemplates("Account Defaults", ManagementServer.class, Long.class, "max.account.templates", "20", "The default maximum number of templates that can be deployed for an account", null),
DefaultMaxAccountSnapshots("Account Defaults", ManagementServer.class, Long.class, "max.account.snapshots", "20", "The default maximum number of snapshots that can be created for an account", null), DefaultMaxAccountSnapshots("Account Defaults", ManagementServer.class, Long.class, "max.account.snapshots", "20", "The default maximum number of snapshots that can be created for an account", null),
DefaultMaxAccountVolumes("Account Defaults", ManagementServer.class, Long.class, "max.account.volumes", "20", "The default maximum number of volumes that can be created for an account", null); DefaultMaxAccountVolumes("Account Defaults", ManagementServer.class, Long.class, "max.account.volumes", "20", "The default maximum number of volumes that can be created for an account", null);
EndpointeUrl("Advanced", ManagementServer.class, String.class, "endpointe.url", "http://localhost:8080/client/api", "Endpointe Url", null);
private final String _category; private final String _category;
private final Class<?> _componentClass; private final Class<?> _componentClass;

View File

@ -260,10 +260,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
@Override @Override
public ConsoleProxyInfo assignProxy(final long dataCenterId, final long vmId) { public ConsoleProxyInfo assignProxy(final long dataCenterId, final long vmId) {
if (!isConsoleProxyVmRequired(dataCenterId)) {
return null;
}
final Pair<ConsoleProxyManagerImpl, ConsoleProxyVO> result = new Pair<ConsoleProxyManagerImpl, ConsoleProxyVO>(this, null); final Pair<ConsoleProxyManagerImpl, ConsoleProxyVO> result = new Pair<ConsoleProxyManagerImpl, ConsoleProxyVO>(this, null);
_requestHandlerScheduler.execute(new Runnable() { _requestHandlerScheduler.execute(new Runnable() {

View File

@ -14,12 +14,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.cloud.host.dao; package com.cloud.host.dao;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import com.cloud.host.Host; import com.cloud.host.Host;
import com.cloud.host.Host.Type; import com.cloud.host.Host.Type;
@ -29,115 +28,119 @@ import com.cloud.host.Status.Event;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.info.RunningHostCountInfo; import com.cloud.info.RunningHostCountInfo;
import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.GenericDao;
/** /**
* Data Access Object for server * Data Access Object for server
* *
*/ */
public interface HostDao extends GenericDao<HostVO, Long> { public interface HostDao extends GenericDao<HostVO, Long> {
List<HostVO> listBy(Host.Type type, Long clusterId, Long podId, long dcId); List<HostVO> listBy(Host.Type type, Long clusterId, Long podId, long dcId);
long countBy(long clusterId, Status... statuses); long countBy(long clusterId, Status... statuses);
List<HostVO> listByDataCenter(long dcId); List<HostVO> listByDataCenter(long dcId);
List<HostVO> listByHostPod(long podId); List<HostVO> listByHostPod(long podId);
List<HostVO> listByStatus(Status... status); List<HostVO> listByStatus(Status... status);
List<HostVO> listBy(Host.Type type, long dcId); List<HostVO> listBy(Host.Type type, long dcId);
List<HostVO> listAllBy(Host.Type type, long dcId); List<HostVO> listAllBy(Host.Type type, long dcId);
HostVO findSecondaryStorageHost(long dcId); HostVO findSecondaryStorageHost(long dcId);
List<HostVO> listByCluster(long clusterId); List<HostVO> listByCluster(long clusterId);
/** /**
* Lists all secondary storage hosts, across all zones * Lists all secondary storage hosts, across all zones
* @return list of Hosts * @return list of Hosts
*/ */
List<HostVO> listSecondaryStorageHosts(); List<HostVO> listSecondaryStorageHosts();
/** /**
* Mark all hosts in Up or Orphaned state as disconnected. This method * Mark all hosts in Up or Orphaned state as disconnected. This method
* is used at AgentManager startup to reset all of the connections. * is used at AgentManager startup to reset all of the connections.
* *
* @param msId management server id. * @param msId management server id.
* @param statuses states of the host. * @param statuses states of the host.
*/ */
void markHostsAsDisconnected(long msId, Status... states); void markHostsAsDisconnected(long msId, Status... states);
List<HostVO> findLostHosts(long timeout); List<HostVO> findLostHosts(long timeout);
List<HostVO> findHostsLike(String hostName); List<HostVO> findHostsLike(String hostName);
/** /**
* Find hosts that are directly connected. * Find hosts that are directly connected.
*/ */
List<HostVO> findDirectlyConnectedHosts(); List<HostVO> findDirectlyConnectedHosts();
List<HostVO> findDirectAgentToLoad(long msid, long lastPingSecondsAfter, Long limit); List<HostVO> findDirectAgentToLoad(long msid, long lastPingSecondsAfter, Long limit);
/** /**
* Mark the host as disconnected if it is in one of these states. * Mark the host as disconnected if it is in one of these states.
* The management server id is set to null. * The management server id is set to null.
* The lastPinged timestamp is set to current. * The lastPinged timestamp is set to current.
* The state is set to the state passed in. * The state is set to the state passed in.
* The disconnectedOn timestamp is set to current. * The disconnectedOn timestamp is set to current.
* *
* @param host host to be marked * @param host host to be marked
* @param state state to be set to. * @param state state to be set to.
* @param ifStates only if it is one of these states. * @param ifStates only if it is one of these states.
* @return true if it's updated; false if not. * @return true if it's updated; false if not.
*/ */
boolean disconnect(HostVO host, Event event, long msId); boolean disconnect(HostVO host, Event event, long msId);
boolean connect(HostVO host, long msId); boolean connect(HostVO host, long msId);
HostVO findByStorageIpAddressInDataCenter(long dcId, String privateIpAddress); HostVO findByStorageIpAddressInDataCenter(long dcId, String privateIpAddress);
HostVO findByPrivateIpAddressInDataCenter(long dcId, String privateIpAddress); HostVO findByPrivateIpAddressInDataCenter(long dcId, String privateIpAddress);
/** /**
* find a host by its mac address * find a host by its mac address
* @param macAddress * @param macAddress
* @return HostVO or null if not found. * @return HostVO or null if not found.
*/ */
public HostVO findByGuid(String macAddress); public HostVO findByGuid(String macAddress);
public HostVO findByName(String name);
/**
* find all hosts of a certain type in a data center
* @param type /**
* @param routingCapable * find all hosts of a certain type in a data center
* @param dcId * @param type
* @return * @param routingCapable
*/ * @param dcId
List<HostVO> listByTypeDataCenter(Host.Type type, long dcId); * @return
*/
/** List<HostVO> listByTypeDataCenter(Host.Type type, long dcId);
* find all hosts of a particular type
* @param type /**
* @return * find all hosts of a particular type
*/ * @param type
List<HostVO> listByType(Type type); * @return
*/
/** List<HostVO> listByType(Type type);
* Find hosts that have not responded to a ping regardless of state
* @param timeout /**
* @param type * Find hosts that have not responded to a ping regardless of state
* @return * @param timeout
*/ * @param type
List<HostVO> findLostHosts2(long timeout, Type type); * @return
*/
/** List<HostVO> findLostHosts2(long timeout, Type type);
* update the host and changes the status depending on the Event and
* the current status. If the status changed between /**
* @param host host object to change * update the host and changes the status depending on the Event and
* @param event event that happened. * the current status. If the status changed between
* @param management server who's making this update * @param host host object to change
* @return true if updated; false if not. * @param event event that happened.
*/ * @param management server who's making this update
boolean updateStatus(HostVO host, Event event, long msId); * @return true if updated; false if not.
*/
List<RunningHostCountInfo> getRunningHostCounts(Date cutTime); boolean updateStatus(HostVO host, Event event, long msId);
long getNextSequence(long hostId); List<RunningHostCountInfo> getRunningHostCounts(Date cutTime);
long getNextSequence(long hostId);
void loadDetails(HostVO host); void loadDetails(HostVO host);
void saveDetails(HostVO host);
HostVO findConsoleProxyHost(String name, Type type); HostVO findConsoleProxyHost(String name, Type type);
@ -159,9 +162,8 @@ public interface HostDao extends GenericDao<HostVO, Long> {
void loadHostTags(HostVO host); void loadHostTags(HostVO host);
List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag); List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag);
long countRoutingHostsByDataCenter(long dcId); long countRoutingHostsByDataCenter(long dcId);
List<HostVO> listSecondaryStorageHosts(long dataCenterId); List<HostVO> listSecondaryStorageHosts(long dataCenterId);
}
}

View File

@ -78,6 +78,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
protected final SearchBuilder<HostVO> TypeSearch; protected final SearchBuilder<HostVO> TypeSearch;
protected final SearchBuilder<HostVO> StatusSearch; protected final SearchBuilder<HostVO> StatusSearch;
protected final SearchBuilder<HostVO> NameLikeSearch; protected final SearchBuilder<HostVO> NameLikeSearch;
protected final SearchBuilder<HostVO> NameSearch;
protected final SearchBuilder<HostVO> SequenceSearch; protected final SearchBuilder<HostVO> SequenceSearch;
protected final SearchBuilder<HostVO> DirectlyConnectedSearch; protected final SearchBuilder<HostVO> DirectlyConnectedSearch;
protected final SearchBuilder<HostVO> UnmanagedDirectConnectSearch; protected final SearchBuilder<HostVO> UnmanagedDirectConnectSearch;
@ -183,6 +184,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN); StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
StatusSearch.done(); StatusSearch.done();
NameSearch = createSearchBuilder();
NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
NameSearch.done();
NameLikeSearch = createSearchBuilder(); NameLikeSearch = createSearchBuilder();
NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE); NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
NameLikeSearch.done(); NameLikeSearch.done();
@ -525,6 +530,12 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
return findOneBy(sc); return findOneBy(sc);
} }
@Override
public HostVO findByName(String name) {
SearchCriteria<HostVO> sc = NameSearch.create("name", name);
return findOneBy(sc);
}
@Override @Override
public List<HostVO> findLostHosts(long timeout) { public List<HostVO> findLostHosts(long timeout) {
SearchCriteria<HostVO> sc = LastPingedSearch.create(); SearchCriteria<HostVO> sc = LastPingedSearch.create();
@ -598,7 +609,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
return listBy(sc); return listBy(sc);
} }
protected void saveDetails(HostVO host) { public void saveDetails(HostVO host) {
Map<String, String> details = host.getDetails(); Map<String, String> details = host.getDetails();
if (details == null) { if (details == null) {
return; return;

View File

@ -24,8 +24,10 @@ import javax.ejb.Local;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.configuration.ZoneConfig;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.Pod; import com.cloud.dc.Pod;
import com.cloud.dc.Vlan; import com.cloud.dc.Vlan;
import com.cloud.dc.Vlan.VlanType; import com.cloud.dc.Vlan.VlanType;

View File

@ -42,10 +42,13 @@ import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
import com.cloud.agent.api.GetVmStatsAnswer; import com.cloud.agent.api.GetVmStatsAnswer;
import com.cloud.agent.api.GetVmStatsCommand; import com.cloud.agent.api.GetVmStatsCommand;
import com.cloud.agent.api.SnapshotCommand; import com.cloud.agent.api.SnapshotCommand;
import com.cloud.agent.api.StartAnswer;
import com.cloud.agent.api.StopAnswer; import com.cloud.agent.api.StopAnswer;
import com.cloud.agent.api.UpgradeSnapshotCommand; import com.cloud.agent.api.UpgradeSnapshotCommand;
import com.cloud.agent.api.VmStatsEntry; import com.cloud.agent.api.VmStatsEntry;
import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.agent.api.to.VolumeTO; import com.cloud.agent.api.to.VolumeTO;
import com.cloud.agent.manager.Commands; import com.cloud.agent.manager.Commands;
import com.cloud.alert.AlertManager; import com.cloud.alert.AlertManager;
@ -110,6 +113,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.IPAddressVO; import com.cloud.network.IPAddressVO;
import com.cloud.network.Network; import com.cloud.network.Network;
import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.GuestIpType;
import com.cloud.network.Network.Provider;
import com.cloud.network.NetworkManager; import com.cloud.network.NetworkManager;
import com.cloud.network.NetworkVO; import com.cloud.network.NetworkVO;
import com.cloud.network.Networks.TrafficType; import com.cloud.network.Networks.TrafficType;