@@ -144,7 +144,8 @@ public CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress,
144144 }
145145
146146 // At this stage, we have a VSM record for sure. Connect the VSM to the cluster Id.
147- ClusterVSMMapVO connectorObj = new ClusterVSMMapVO (clusterId , _ciscoNexusVSMDeviceDao .getVSMbyIpaddress (ipaddress ).getId ());
147+ long vsmId = _ciscoNexusVSMDeviceDao .getVSMbyIpaddress (ipaddress ).getId ();
148+ ClusterVSMMapVO connectorObj = new ClusterVSMMapVO (clusterId , vsmId );
148149 Transaction txn = Transaction .currentTxn ();
149150 try {
150151 txn .start ();
@@ -160,36 +161,37 @@ public CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress,
160161 // All ESXi servers are stored in the host table, and their resource
161162 // type is vmwareresource.
162163
163- List <HostVO > hosts = _resourceMgr .listAllHostsInCluster (clusterId );
164+ // List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
164165
166+ //TODO: Activate the code below if we make the Nexus VSM a separate resource.
165167 // Iterate through each of the hosts in this list. Each host has a host id.
166168 // Given this host id, we can reconfigure the in-memory resource representing
167169 // the host via the agent manager. Thus we inject VSM related information
168170 // into each host's resource. Also, we first configure each resource's
169171 // entries in the database to contain this VSM information before the injection.
170172
171- for (HostVO host : hosts ) {
173+ // for (HostVO host : hosts) {
172174 // Create a host details VO object and write it out for this hostid.
173- long vsmId = _ciscoNexusVSMDeviceDao . getVSMbyIpaddress ( ipaddress ). getId ( );
174- Long hostid = new Long ( vsmId );
175- DetailVO vsmDetail = new DetailVO ( host . getId (), "vsmId" , hostid . toString () );
176- Transaction tx = Transaction . currentTxn ();
177- try {
178- tx . start ( );
179- _hostDetailDao . persist ( vsmDetail );
180- tx . commit ();
181- } catch ( Exception e ) {
182- tx . rollback ( );
183- throw new CloudRuntimeException ( e . getMessage ());
184- }
185- // Reconfigure the resource.
186- Map hostDetails = new HashMap <String , String >();
187- hostDetails .put (ApiConstants .ID , vsmId );
188- hostDetails .put (ApiConstants .IP_ADDRESS , ipaddress );
189- hostDetails .put (ApiConstants .USERNAME , username );
190- hostDetails .put (ApiConstants .PASSWORD , password );
191- //_agentMrg.send(host.getId(), )
192- }
175+ //Long hostid = new Long(vsmId );
176+ //DetailVO vsmDetail = new DetailVO(host.getId(), " vsmId", hostid.toString() );
177+ //Transaction tx = Transaction.currentTxn( );
178+ //try {
179+ //tx.start();
180+ //_hostDetailDao.persist(vsmDetail );
181+ //tx.commit( );
182+ //} catch (Exception e) {
183+ //tx.rollback();
184+ //throw new CloudRuntimeException(e.getMessage() );
185+ //}
186+ // }
187+ // Reconfigure the resource.
188+ // Map hostDetails = new HashMap<String, String>();
189+ // hostDetails.put(ApiConstants.ID, vsmId);
190+ // hostDetails.put(ApiConstants.IP_ADDRESS, ipaddress);
191+ // hostDetails.put(ApiConstants.USERNAME, username);
192+ // hostDetails.put(ApiConstants.PASSWORD, password);
193+ //_agentMrg.send(host.getId(), )
194+
193195 return VSMObj ;
194196
195197 }
@@ -262,12 +264,6 @@ public CiscoNexusVSMDeviceVO enableCiscoNexusVSM(long vsmId) {
262264 }
263265 }
264266
265- /*****
266- // Ok, I'm putting in a port profile creation call here. Just for testing.
267- PortProfileManagerImpl obj = new PortProfileManagerImpl();
268- obj.addPortProfile("pp1", 1, 4000, PortType.vEthernet, BindingType.Ephemeral);
269- ***/
270-
271267 return cisconexusvsm ;
272268 }
273269
@@ -291,14 +287,7 @@ public CiscoNexusVSMDeviceVO disableCiscoNexusVSM(long vsmId) {
291287 throw new CloudRuntimeException (e .getMessage ());
292288 }
293289 }
294-
295- /**
296- // Deleting the same port profile..
297- PortProfileVO obj = _ppDao.findByName("pp1");
298- PortProfileManagerImpl obj2 = new PortProfileManagerImpl();
299- obj2.deletePortProfile(obj.getId());
300- //_ppmgr.addPortProfile("pp1", 1, 4000, PortType.vEthernet, BindingType.Ephemeral);
301- **/
290+
302291 return cisconexusvsm ;
303292 }
304293
0 commit comments