1414 * You should have received a copy of the GNU General Public License
1515 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1616 *
17- */
18- package com.cloud.host.dao;
19-
17+ */
18+ package com.cloud.host.dao;
19+
2020import java.util.Date;
2121import java.util.List;
22- import java.util.Map;
2322
2423import com.cloud.host.Host;
2524import com.cloud.host.Host.Type;
2928import com.cloud.hypervisor.Hypervisor.HypervisorType;
3029import com.cloud.info.RunningHostCountInfo;
3130import com.cloud.utils.db.GenericDao;
32-
33- /**
34- * Data Access Object for server
35- *
36- */
37- public interface HostDao extends GenericDao<HostVO, Long> {
31+
32+ /**
33+ * Data Access Object for server
34+ *
35+ */
36+ public interface HostDao extends GenericDao<HostVO, Long> {
3837 List<HostVO> listBy(Host.Type type, Long clusterId, Long podId, long dcId);
3938
4039 long countBy(long clusterId, Status... statuses);
41-
42- List<HostVO> listByDataCenter(long dcId);
43- List<HostVO> listByHostPod(long podId);
44- List<HostVO> listByStatus(Status... status);
40+
41+ List<HostVO> listByDataCenter(long dcId);
42+ List<HostVO> listByHostPod(long podId);
43+ List<HostVO> listByStatus(Status... status);
4544 List<HostVO> listBy(Host.Type type, long dcId);
46- List<HostVO> listAllBy(Host.Type type, long dcId);
47- HostVO findSecondaryStorageHost(long dcId);
48- List<HostVO> listByCluster(long clusterId);
49- /**
50- * Lists all secondary storage hosts, across all zones
51- * @return list of Hosts
52- */
53- List<HostVO> listSecondaryStorageHosts();
54-
55- /**
56- * Mark all hosts in Up or Orphaned state as disconnected. This method
57- * is used at AgentManager startup to reset all of the connections.
58- *
59- * @param msId management server id.
60- * @param statuses states of the host.
61- */
62- void markHostsAsDisconnected(long msId, Status... states);
63-
64- List<HostVO> findLostHosts(long timeout);
65-
66- List<HostVO> findHostsLike(String hostName);
67-
68- /**
69- * Find hosts that are directly connected.
70- */
71- List<HostVO> findDirectlyConnectedHosts();
72-
73- List<HostVO> findDirectAgentToLoad(long msid, long lastPingSecondsAfter, Long limit);
74-
75- /**
76- * Mark the host as disconnected if it is in one of these states.
77- * The management server id is set to null.
78- * The lastPinged timestamp is set to current.
79- * The state is set to the state passed in.
80- * The disconnectedOn timestamp is set to current.
81- *
82- * @param host host to be marked
83- * @param state state to be set to.
84- * @param ifStates only if it is one of these states.
85- * @return true if it's updated; false if not.
86- */
87- boolean disconnect(HostVO host, Event event, long msId);
88-
89- boolean connect(HostVO host, long msId);
90-
91- HostVO findByStorageIpAddressInDataCenter(long dcId, String privateIpAddress);
92- HostVO findByPrivateIpAddressInDataCenter(long dcId, String privateIpAddress);
93-
94- /**
95- * find a host by its mac address
96- * @param macAddress
97- * @return HostVO or null if not found.
98- */
45+ List<HostVO> listAllBy(Host.Type type, long dcId);
46+ HostVO findSecondaryStorageHost(long dcId);
47+ List<HostVO> listByCluster(long clusterId);
48+ /**
49+ * Lists all secondary storage hosts, across all zones
50+ * @return list of Hosts
51+ */
52+ List<HostVO> listSecondaryStorageHosts();
53+
54+ /**
55+ * Mark all hosts in Up or Orphaned state as disconnected. This method
56+ * is used at AgentManager startup to reset all of the connections.
57+ *
58+ * @param msId management server id.
59+ * @param statuses states of the host.
60+ */
61+ void markHostsAsDisconnected(long msId, Status... states);
62+
63+ List<HostVO> findLostHosts(long timeout);
64+
65+ List<HostVO> findHostsLike(String hostName);
66+
67+ /**
68+ * Find hosts that are directly connected.
69+ */
70+ List<HostVO> findDirectlyConnectedHosts();
71+
72+ List<HostVO> findDirectAgentToLoad(long msid, long lastPingSecondsAfter, Long limit);
73+
74+ /**
75+ * Mark the host as disconnected if it is in one of these states.
76+ * The management server id is set to null.
77+ * The lastPinged timestamp is set to current.
78+ * The state is set to the state passed in.
79+ * The disconnectedOn timestamp is set to current.
80+ *
81+ * @param host host to be marked
82+ * @param state state to be set to.
83+ * @param ifStates only if it is one of these states.
84+ * @return true if it's updated; false if not.
85+ */
86+ boolean disconnect(HostVO host, Event event, long msId);
87+
88+ boolean connect(HostVO host, long msId);
89+
90+ HostVO findByStorageIpAddressInDataCenter(long dcId, String privateIpAddress);
91+ HostVO findByPrivateIpAddressInDataCenter(long dcId, String privateIpAddress);
92+
93+ /**
94+ * find a host by its mac address
95+ * @param macAddress
96+ * @return HostVO or null if not found.
97+ */
9998 public HostVO findByGuid(String macAddress);
100-
101-
102- /**
103- * find all hosts of a certain type in a data center
104- * @param type
105- * @param routingCapable
106- * @param dcId
107- * @return
108- */
109- List<HostVO> listByTypeDataCenter(Host.Type type, long dcId);
110-
111- /**
112- * find all hosts of a particular type
113- * @param type
114- * @return
115- */
116- List<HostVO> listByType(Type type);
117-
118- /**
119- * Find hosts that have not responded to a ping regardless of state
120- * @param timeout
121- * @param type
122- * @return
123- */
124- List<HostVO> findLostHosts2(long timeout, Type type);
125-
126- /**
127- * update the host and changes the status depending on the Event and
128- * the current status. If the status changed between
129- * @param host host object to change
130- * @param event event that happened.
131- * @param management server who's making this update
132- * @return true if updated; false if not.
133- */
134- boolean updateStatus(HostVO host, Event event, long msId);
135-
136- List<RunningHostCountInfo> getRunningHostCounts(Date cutTime);
137-
138- long getNextSequence(long hostId);
139-
99+
100+ public HostVO findByName(String name);
101+
102+
103+ /**
104+ * find all hosts of a certain type in a data center
105+ * @param type
106+ * @param routingCapable
107+ * @param dcId
108+ * @return
109+ */
110+ List<HostVO> listByTypeDataCenter(Host.Type type, long dcId);
111+
112+ /**
113+ * find all hosts of a particular type
114+ * @param type
115+ * @return
116+ */
117+ List<HostVO> listByType(Type type);
118+
119+ /**
120+ * Find hosts that have not responded to a ping regardless of state
121+ * @param timeout
122+ * @param type
123+ * @return
124+ */
125+ List<HostVO> findLostHosts2(long timeout, Type type);
126+
127+ /**
128+ * update the host and changes the status depending on the Event and
129+ * the current status. If the status changed between
130+ * @param host host object to change
131+ * @param event event that happened.
132+ * @param management server who's making this update
133+ * @return true if updated; false if not.
134+ */
135+ boolean updateStatus(HostVO host, Event event, long msId);
136+
137+ List<RunningHostCountInfo> getRunningHostCounts(Date cutTime);
138+
139+ long getNextSequence(long hostId);
140+
140141 void loadDetails(HostVO host);
142+
143+ void saveDetails(HostVO host);
141144
142145 HostVO findConsoleProxyHost(String name, Type type);
143146
@@ -159,9 +162,8 @@ public interface HostDao extends GenericDao<HostVO, Long> {
159162 void loadHostTags(HostVO host);
160163
161164 List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag);
162-
165+
163166 long countRoutingHostsByDataCenter(long dcId);
164167
165- List<HostVO> listSecondaryStorageHosts(long dataCenterId);
166-
167- }
168+ List<HostVO> listSecondaryStorageHosts(long dataCenterId);
169+ }
0 commit comments