4242import org .apache .log4j .Logger ;
4343
4444import org .apache .cloudstack .context .ServerContexts ;
45- import org .apache .cloudstack .storage .datastore .db .PrimaryDataStoreDao ;
4645import org .apache .cloudstack .utils .identity .ManagementServerNode ;
4746
4847import com .cloud .agent .AgentManager ;
6968import com .cloud .agent .transport .Request ;
7069import com .cloud .agent .transport .Response ;
7170import com .cloud .alert .AlertManager ;
72- import com .cloud .capacity .dao .CapacityDao ;
7371import com .cloud .configuration .Config ;
7472import com .cloud .configuration .dao .ConfigurationDao ;
75- import com .cloud .dc .ClusterDetailsDao ;
7673import com .cloud .dc .ClusterVO ;
7774import com .cloud .dc .DataCenterVO ;
7875import com .cloud .dc .HostPodVO ;
7976import com .cloud .dc .dao .ClusterDao ;
8077import com .cloud .dc .dao .DataCenterDao ;
81- import com .cloud .dc .dao .DataCenterIpAddressDao ;
8278import com .cloud .dc .dao .HostPodDao ;
8379import com .cloud .exception .AgentUnavailableException ;
8480import com .cloud .exception .ConnectionException ;
9086import com .cloud .host .Status ;
9187import com .cloud .host .Status .Event ;
9288import com .cloud .host .dao .HostDao ;
93- import com .cloud .host .dao .HostTagsDao ;
9489import com .cloud .hypervisor .Hypervisor .HypervisorType ;
9590import com .cloud .hypervisor .HypervisorGuruManager ;
9691import com .cloud .hypervisor .kvm .discoverer .KvmDummyResourceBase ;
97- import com .cloud .network .dao .IPAddressDao ;
9892import com .cloud .resource .Discoverer ;
9993import com .cloud .resource .ResourceManager ;
10094import com .cloud .resource .ResourceState ;
10195import com .cloud .resource .ServerResource ;
102- import com .cloud .storage .StorageManager ;
103- import com .cloud .storage .StorageService ;
104- import com .cloud .storage .dao .StoragePoolHostDao ;
105- import com .cloud .storage .dao .VolumeDao ;
10696import com .cloud .storage .resource .DummySecondaryStorageResource ;
107- import com .cloud .storage .secondary .SecondaryStorageVmManager ;
108- import com .cloud .user .AccountManager ;
10997import com .cloud .utils .NumbersUtil ;
11098import com .cloud .utils .Pair ;
11199import com .cloud .utils .component .ManagerBase ;
112100import com .cloud .utils .concurrency .NamedThreadFactory ;
113101import com .cloud .utils .db .DB ;
102+ import com .cloud .utils .db .EntityManager ;
114103import com .cloud .utils .db .Transaction ;
115104import com .cloud .utils .exception .CloudRuntimeException ;
116105import com .cloud .utils .exception .HypervisorVersionChangedException ;
120109import com .cloud .utils .nio .Link ;
121110import com .cloud .utils .nio .NioServer ;
122111import com .cloud .utils .nio .Task ;
123- import com .cloud .vm .VirtualMachineManager ;
124- import com .cloud .vm .dao .VMInstanceDao ;
125112
126113/**
127114 * Implementation of the Agent Manager. This class controls the connection to the agents.
@@ -153,63 +140,33 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
153140 protected int _monitorId = 0 ;
154141 private final Lock _agentStatusLock = new ReentrantLock ();
155142
143+ @ Inject
144+ protected EntityManager _entityMgr ;
145+
156146 protected NioServer _connection ;
157147 @ Inject
158148 protected HostDao _hostDao = null ;
159149 @ Inject
160150 protected DataCenterDao _dcDao = null ;
161151 @ Inject
162- protected DataCenterIpAddressDao _privateIPAddressDao = null ;
163- @ Inject
164- protected IPAddressDao _publicIPAddressDao = null ;
165- @ Inject
166152 protected HostPodDao _podDao = null ;
167153 @ Inject
168- protected VMInstanceDao _vmDao = null ;
169- @ Inject
170- protected CapacityDao _capacityDao = null ;
171- @ Inject
172154 protected ConfigurationDao _configDao = null ;
173155 @ Inject
174- protected PrimaryDataStoreDao _storagePoolDao = null ;
175- @ Inject
176- protected StoragePoolHostDao _storagePoolHostDao = null ;
177- @ Inject
178156 protected ClusterDao _clusterDao = null ;
179- @ Inject
180- protected ClusterDetailsDao _clusterDetailsDao = null ;
181- @ Inject
182- protected HostTagsDao _hostTagsDao = null ;
183- @ Inject
184- protected VolumeDao _volumeDao = null ;
185-
186157 protected int _port ;
187158
188159 @ Inject
189160 protected HighAvailabilityManager _haMgr = null ;
190161 @ Inject
191162 protected AlertManager _alertMgr = null ;
192163
193- @ Inject
194- protected AccountManager _accountMgr = null ;
195-
196- @ Inject
197- protected VirtualMachineManager _vmMgr = null ;
198-
199- @ Inject StorageService _storageSvr = null ;
200- @ Inject StorageManager _storageMgr = null ;
201-
202164 @ Inject
203165 protected HypervisorGuruManager _hvGuruMgr ;
204166
205- @ Inject SecondaryStorageVmManager _ssvmMgr ;
206-
207167 protected int _retry = 2 ;
208168
209- protected String _instance ;
210-
211169 protected int _wait ;
212- protected int _updateWait ;
213170 protected int _alertWait ;
214171 protected long _nodeId = -1 ;
215172
@@ -243,9 +200,6 @@ public boolean configure(final String name, final Map<String, Object> params) th
243200 value = configs .get (Config .AlertWait .toString ());
244201 _alertWait = NumbersUtil .parseInt (value , 1800 );
245202
246- value = configs .get (Config .UpdateWait .toString ());
247- _updateWait = NumbersUtil .parseInt (value , 600 );
248-
249203 value = configs .get (Config .PingTimeout .toString ());
250204 final float multiplier = value != null ? Float .parseFloat (value ) : 2.5f ;
251205 _pingTimeout = (long ) (multiplier * _pingInterval );
@@ -255,11 +209,6 @@ public boolean configure(final String name, final Map<String, Object> params) th
255209 value = configs .get (Config .DirectAgentLoadSize .key ());
256210 int threads = NumbersUtil .parseInt (value , 16 );
257211
258- _instance = configs .get ("instance.name" );
259- if (_instance == null ) {
260- _instance = "DEFAULT" ;
261- }
262-
263212 _nodeId = ManagementServerNode .getManagementServerId ();
264213 s_logger .info ("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId );
265214
@@ -641,7 +590,7 @@ private ServerResource loadResourcesWithoutHypervisor(HostVO host){
641590 ServerResource resource = null ;
642591 try {
643592 Class <?> clazz = Class .forName (resourceName );
644- Constructor constructor = clazz .getConstructor ();
593+ Constructor <?> constructor = clazz .getConstructor ();
645594 resource = (ServerResource ) constructor .newInstance ();
646595 } catch (ClassNotFoundException e ) {
647596 s_logger .warn ("Unable to find class " + host .getResource (), e );
@@ -705,7 +654,6 @@ private ServerResource loadResourcesWithoutHypervisor(HostVO host){
705654 }
706655
707656
708- @ SuppressWarnings ("rawtypes" )
709657 protected boolean loadDirectlyConnectedHost (HostVO host , boolean forRebalance ) {
710658 boolean initialized = false ;
711659 ServerResource resource = null ;
0 commit comments