|
16 | 16 |
|
17 | 17 | import org.apache.log4j.Logger; |
18 | 18 |
|
| 19 | +import com.cloud.agent.api.StopAnswer; |
19 | 20 | import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand; |
20 | 21 | import com.cloud.agent.manager.Commands; |
21 | 22 | import com.cloud.api.commands.AttachVolumeCmd; |
@@ -271,7 +272,9 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE |
271 | 272 | if (_itMgr.allocate(vm, template, offering, null, null, networks, null, plan, cmd.getHypervisor(), owner) == null) { |
272 | 273 | return null; |
273 | 274 | } |
274 | | - |
| 275 | + |
| 276 | + // startVirtualMachine() will retrieve this property |
| 277 | + vm.setDetail("pxeboot", "true"); |
275 | 278 | _vmDao.saveDetails(vm); |
276 | 279 |
|
277 | 280 | if (s_logger.isDebugEnabled()) { |
@@ -374,16 +377,12 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> pro |
374 | 377 | throw new PermissionDeniedException("The owner of " + vm + " either does not exist or is disabled: " + vm.getAccountId()); |
375 | 378 | } |
376 | 379 |
|
377 | | - if (profile.getTemplate() == null) { |
| 380 | + PxeServerType pxeType = (PxeServerType) profile.getParameter(Param.PxeSeverType); |
| 381 | + if (pxeType == null) { |
378 | 382 | s_logger.debug("This is a normal IPMI start, skip prepartion of PXE server"); |
379 | 383 | return true; |
380 | 384 | } |
381 | | - |
382 | 385 | s_logger.debug("This is a PXE start, prepare PXE server first"); |
383 | | - PxeServerType pxeType = (PxeServerType) profile.getParameter(Param.PxeSeverType); |
384 | | - if (pxeType == null) { |
385 | | - throw new CloudRuntimeException("No PXE type specified"); |
386 | | - } |
387 | 386 |
|
388 | 387 | PxeServerManager pxeMgr = null; |
389 | 388 | ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); |
@@ -445,4 +444,14 @@ public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile, long hostI |
445 | 444 |
|
446 | 445 | return true; |
447 | 446 | } |
| 447 | + |
| 448 | + @Override |
| 449 | + public void finalizeStop(VirtualMachineProfile<UserVmVO> profile, StopAnswer answer) { |
| 450 | + super.finalizeStop(profile, answer); |
| 451 | + } |
| 452 | + |
| 453 | + @Override |
| 454 | + public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException { |
| 455 | + return super.destroyVm(vmId); |
| 456 | + } |
448 | 457 | } |
0 commit comments