|
46 | 46 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
47 | 47 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
48 | 48 | import org.apache.cloudstack.utils.identity.ManagementServerNode; |
| 49 | +import org.apache.cloudstack.storage.to.VolumeObjectTO; |
| 50 | +import org.apache.log4j.Logger; |
49 | 51 |
|
50 | 52 | import com.cloud.agent.AgentManager; |
51 | 53 | import com.cloud.agent.Listener; |
|
76 | 78 | import com.cloud.agent.api.StopCommand; |
77 | 79 | import com.cloud.agent.api.UnPlugNicAnswer; |
78 | 80 | import com.cloud.agent.api.UnPlugNicCommand; |
| 81 | +import com.cloud.agent.api.to.DiskTO; |
79 | 82 | import com.cloud.agent.api.to.NicTO; |
80 | 83 | import com.cloud.agent.api.to.VirtualMachineTO; |
| 84 | +import com.cloud.agent.api.to.VolumeTO; |
81 | 85 | import com.cloud.agent.manager.Commands; |
82 | 86 | import com.cloud.agent.manager.allocator.HostAllocator; |
83 | 87 | import com.cloud.alert.AlertManager; |
@@ -902,6 +906,8 @@ else if (_uservmDetailsDao.findDetail(vm.getId(),"cpuOvercommitRatio") != null) |
902 | 906 | destHostId = finalHost.getId(); |
903 | 907 | } |
904 | 908 | if (vmGuru.finalizeStart(vmProfile, destHostId, cmds, ctx)) { |
| 909 | + syncDiskChainChange(startAnswer); |
| 910 | + |
905 | 911 | if (!changeState(vm, Event.OperationSucceeded, destHostId, work, Step.Done)) { |
906 | 912 | throw new ConcurrentOperationException("Unable to transition to a new state."); |
907 | 913 | } |
@@ -992,6 +998,18 @@ else if (_uservmDetailsDao.findDetail(vm.getId(),"cpuOvercommitRatio") != null) |
992 | 998 | + "' (" + vm.getUuid() + "), see management server log for details"); |
993 | 999 | } |
994 | 1000 | } |
| 1001 | + |
| 1002 | + private void syncDiskChainChange(StartAnswer answer) { |
| 1003 | + VirtualMachineTO vmSpec = answer.getVirtualMachine(); |
| 1004 | + |
| 1005 | + for(DiskTO disk : vmSpec.getDisks()) { |
| 1006 | + if(disk.getType() != Volume.Type.ISO) { |
| 1007 | + VolumeObjectTO vol = (VolumeObjectTO)disk.getData(); |
| 1008 | + |
| 1009 | + volumeMgr.updateVolumeDiskChain(vol.getId(), vol.getPath(), vol.getChainInfo()); |
| 1010 | + } |
| 1011 | + } |
| 1012 | + } |
995 | 1013 |
|
996 | 1014 | @Override |
997 | 1015 | public void stop(String vmUuid) throws ResourceUnavailableException { |
|
0 commit comments