diff --git a/console-proxy/.classpath b/console-proxy/.classpath index 5a34eae6642..0b57db8ad5a 100644 --- a/console-proxy/.classpath +++ b/console-proxy/.classpath @@ -1,9 +1,9 @@ - - - - - - - - - + + + + + + + + + diff --git a/console-viewer/.classpath b/console-viewer/.classpath index e8a8d8c0a84..19542e73fc0 100644 --- a/console-viewer/.classpath +++ b/console-viewer/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/core/src/com/cloud/agent/api/storage/DestroyCommand.java b/core/src/com/cloud/agent/api/storage/DestroyCommand.java index 8e0dbf497fe..e7cdaec433f 100755 --- a/core/src/com/cloud/agent/api/storage/DestroyCommand.java +++ b/core/src/com/cloud/agent/api/storage/DestroyCommand.java @@ -24,13 +24,16 @@ import com.cloud.storage.VMTemplateStoragePoolVO; import com.cloud.storage.VolumeVO; public class DestroyCommand extends StorageCommand { + // in VMware, things are designed around VM instead of volume, we need it the volume VM context if the volume is attached + String vmName; VolumeTO volume; protected DestroyCommand() { } - public DestroyCommand(StoragePoolVO pool, VolumeVO volume) { + public DestroyCommand(StoragePoolVO pool, VolumeVO volume, String vmName) { this.volume = new VolumeTO(volume, pool); + this.vmName = vmName; } public DestroyCommand(StoragePoolVO pool, VMTemplateStoragePoolVO templatePoolRef) { @@ -40,6 +43,10 @@ public class DestroyCommand extends StorageCommand { public VolumeTO getVolume() { return volume; } + + public String getVmName() { + return vmName; + } @Override public boolean executeInSequence() { diff --git a/patches/systemvm/debian/config/etc/iptables/iptables-router b/patches/systemvm/debian/config/etc/iptables/iptables-router index 3cd069a04c0..3bc7b50f74a 100644 --- a/patches/systemvm/debian/config/etc/iptables/iptables-router +++ b/patches/systemvm/debian/config/etc/iptables/iptables-router @@ -19,8 +19,6 @@ COMMIT -A INPUT -i eth0 -p tcp -m state --state NEW --dport 80 -j ACCEPT -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -o eth2 -j ACCEPT --A FORWARD -i eth1 -o eth2 -j ACCEPT -A FORWARD -i eth2 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT --A FORWARD -i eth2 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT COMMIT diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 856eb88c252..e05b61b51bf 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1032,7 +1032,7 @@ public class StorageManagerImpl implements StorageManager { if (poolId != null && volumePath != null && !volumePath.trim().isEmpty()) { Answer answer = null; StoragePoolVO pool = _storagePoolDao.findById(poolId); - final DestroyCommand cmd = new DestroyCommand(pool, vol); + final DestroyCommand cmd = new DestroyCommand(pool, vol, vm.getInstanceName()); boolean removed = false; List poolhosts = _storagePoolHostDao.listByPoolId(poolId); for (StoragePoolHostVO poolhost : poolhosts) { @@ -1645,7 +1645,7 @@ public class StorageManagerImpl implements StorageManager { String destPrimaryStorageVolumeFolder = cvAnswer.getVolumeFolder(); // Delete the volume on the source storage pool - final DestroyCommand cmd = new DestroyCommand(srcPool, volume); + final DestroyCommand cmd = new DestroyCommand(srcPool, volume, null); Answer destroyAnswer = _agentMgr.easySend(sourceHostId, cmd); if (destroyAnswer == null || !destroyAnswer.getResult()) { @@ -2143,7 +2143,7 @@ public class StorageManagerImpl implements StorageManager { Long poolId = vol.getPoolId(); Answer answer = null; StoragePoolVO pool = _storagePoolDao.findById(poolId); - final DestroyCommand cmd = new DestroyCommand(pool, vol); + final DestroyCommand cmd = new DestroyCommand(pool, vol, null); answer = sendToPool(pool, cmd); if (answer != null && answer.getResult()) { s_logger.debug("Destroyed " + vol); diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 6deda9983ed..63a09c3daf6 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -891,8 +891,16 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM } HashSet avoid = new HashSet(); + + HostVO host = null; + if(vm.getLastHostId() != null) { + host = _hostDao.findById(vm.getLastHostId()); + if(host == null || host.getStatus() != com.cloud.host.Status.Up || host.getHypervisorType() != HypervisorType.VmWare) + host = null; + } - HostVO host = (HostVO) _agentMgr.findHost(Host.Type.Routing, dc, pod, sp, offering, template, vm, null, avoid); + if(host == null) + host = (HostVO) _agentMgr.findHost(Host.Type.Routing, dc, pod, sp, offering, template, vm, null, avoid); if (host == null) { String description = "Unable to find any host for " + vm.toString(); @@ -902,7 +910,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM _eventDao.persist(event); return null; } - if (!_vmDao.updateIf(vm, Event.StartRequested, host.getId())) { String description = "Unable to start VM " + vm.toString() + " because the state is not correct."; @@ -3831,7 +3838,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM } long eventId = EventUtils.saveScheduledEvent(userId, vmInstance.getAccountId(), EventTypes.EVENT_VM_STOP, "stopping Vm with Id: "+id); - userId = accountAndUserValidation(id, caller, userId, vmInstance); UserVO user = _userDao.findById(userId); @@ -3911,5 +3917,4 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM throw new CloudRuntimeException("Failed to destroy vm with id " + vmId); } } - }