1) Remove forwarding between eth1 and eth2 as it does not solve the problem of asymmetic routing

2) correct Eclipse project settings
3) If VM is hosted by vmware hypervisor, give the previous host preference to start on to fit VMware's VM-centric model
This commit is contained in:
Kelven Yang 2010-11-17 15:50:34 -08:00
parent 39327f2f38
commit 5490577469
6 changed files with 36 additions and 26 deletions

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/thirdparty/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="/thirdparty/gson.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/console"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/thirdparty/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="/thirdparty/gson.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/console-common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/console"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/console-common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -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() {

View File

@ -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

View File

@ -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<StoragePoolHostVO> 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);

View File

@ -891,8 +891,16 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM
}
HashSet<Host> avoid = new HashSet<Host>();
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);
}
}
}