bug 11489: simulator is not updating type field in mockvm table

status 11489: resolved fixed
reviewed-by: Kishan.Kavala@citrix.com

Added necessary VO methods to update the type field of the MockVM table.
(cherry picked from commit ddd090e0352579ca1b63a8676ac8a7564944f343)
This commit is contained in:
Prasanna Santhanam 2011-09-19 17:10:29 +05:30
parent 58ea286166
commit 005b37f6d8
3 changed files with 19 additions and 1 deletions

View File

@ -111,6 +111,15 @@ public class MockVmManagerImpl implements MockVmManager {
vm.setName(vmName);
vm.setVncPort(vncPort);
vm.setHostId(host.getId());
if(vmName.startsWith("s-")) {
vm.setType("SecondaryStorageVm");
} else if (vmName.startsWith("v-")) {
vm.setType("ConsoleProxy");
} else if (vmName.startsWith("r-")) {
vm.setType("DomainRouter");
} else if (vmName.startsWith("i-")) {
vm.setType("User");
}
vm = _mockVmDao.persist((MockVMVO)vm);
} else {
if(vm.getState() == State.Stopped) {

View File

@ -79,6 +79,10 @@ public class MockVMVO implements MockVm{
return this.state;
}
public String getType() {
return this.vmType;
}
public void setState(State state) {
this.state = state;
}
@ -106,5 +110,9 @@ public class MockVMVO implements MockVm{
public void setCpu(int cpu) {
this.cpu = cpu;
}
public void setType(String type) {
this.vmType = type;
}
}

View File

@ -21,12 +21,13 @@ public interface MockVm {
public long getMemory();
public int getCpu();
public String getType();
public int getVncPort();
public void setName(String name);
public void setMemory(long memory);
public void setCpu(int cpu);
public void setType(String type);
public void setVncPort(int vncPort);
public long getId();
}