Skip to content

Commit 19ae5fb

Browse files
committed
Introduce new resource life cycle listener
add files
1 parent 6969d95 commit 19ae5fb

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.cloud.resource;
2+
3+
import java.net.URI;
4+
import java.util.List;
5+
import java.util.Map;
6+
7+
import com.cloud.host.HostVO;
8+
9+
public interface ResourceListener {
10+
static final Integer EVENT_DISCOVER_BEFORE = 0x1;
11+
static final Integer EVENT_DISCOVER_AFTER = 0x1 << 1;
12+
static final Integer EVENT_DELETE_HOST_BEFORE = 0x1 << 2;
13+
static final Integer EVENT_DELETE_HOST_AFTER = 0x1 << 3;
14+
static final Integer EVENT_CANCEL_MAINTENANCE_BEFORE = 0x1 << 4;
15+
static final Integer EVENT_CANCEL_MAINTENANCE_AFTER = 0x1 << 5;
16+
static final Integer EVENT_PREPARE_MAINTENANCE_BEFORE = 0x1 << 6;
17+
static final Integer EVENT_PREPARE_MAINTENANCE_AFTER = 0x1 << 7;
18+
static final Integer EVENT_ALL = (EVENT_DISCOVER_BEFORE | EVENT_DISCOVER_AFTER | EVENT_DELETE_HOST_BEFORE | EVENT_DELETE_HOST_AFTER
19+
| EVENT_CANCEL_MAINTENANCE_BEFORE | EVENT_CANCEL_MAINTENANCE_AFTER | EVENT_PREPARE_MAINTENANCE_BEFORE | EVENT_PREPARE_MAINTENANCE_AFTER);
20+
21+
String getName();
22+
23+
/**
24+
*
25+
* @param dcid
26+
* @param podId
27+
* @param clusterId
28+
* @param uri
29+
* @param username
30+
* @param password
31+
* @param hostTags
32+
*
33+
* Called before Discover.find()
34+
*/
35+
void processDiscoverEventBefore(Long dcid, Long podId, Long clusterId, URI uri, String username, String password, List<String> hostTags);
36+
37+
/**
38+
*
39+
* @param resources
40+
*
41+
* Called after Discover.find()
42+
*/
43+
void processDiscoverEventAfter(Map<? extends ServerResource, Map<String, String>> resources);
44+
45+
/**
46+
*
47+
* @param host
48+
*
49+
* Called before host delete
50+
*/
51+
void processDeleteHostEventBefore(HostVO host);
52+
53+
/**
54+
*
55+
* @param host
56+
*
57+
* Called after host delete. NOTE param host includes stale data which has been removed from database
58+
*/
59+
void processDeletHostEventAfter(HostVO host);
60+
61+
/**
62+
*
63+
* @param hostId
64+
*
65+
* Called before AgentManager.cancelMaintenance
66+
*/
67+
void processCancelMaintenaceEventBefore(Long hostId);
68+
69+
/**
70+
*
71+
* @param hostId
72+
*
73+
* Called after AgentManager.cancelMaintenance
74+
*/
75+
void processCancelMaintenaceEventAfter(Long hostId);
76+
77+
/**
78+
*
79+
* @param hostId
80+
*
81+
* Called before AgentManager.main
82+
*/
83+
void processPrepareMaintenaceEventBefore(Long hostId);
84+
85+
/**
86+
*
87+
* @param hostId
88+
*
89+
* Called after AgentManager.main
90+
*/
91+
void processPrepareMaintenaceEventAfter(Long hostId);
92+
}

0 commit comments

Comments
 (0)