Implement CreateVolume/AttachVolue for vmware

This commit is contained in:
Kelven Yang 2010-09-16 11:50:57 -07:00 committed by edison
parent 2337a9d99f
commit 86d59bdddd
2 changed files with 13 additions and 1 deletions

View File

@ -25,6 +25,7 @@ public class AttachVolumeCommand extends Command {
boolean attach;
String vmName;
StoragePoolType pooltype;
String poolUuid;
String volumeFolder;
String volumePath;
String volumeName;
@ -83,5 +84,12 @@ public class AttachVolumeCommand extends Command {
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getPoolUuid() {
return poolUuid;
}
public void setPoolUuid(String poolUuid) {
this.poolUuid = poolUuid;
}
}

View File

@ -387,7 +387,9 @@ public class UserVmManagerImpl implements UserVmManager {
AttachVolumeAnswer answer = null;
Long hostId = vm.getHostId();
if (sendCommand) {
StoragePoolVO volumePool = _storagePoolDao.findById(volume.getPoolId());
AttachVolumeCommand cmd = new AttachVolumeCommand(true, vm.getInstanceName(), volume.getPoolType(), volume.getFolder(), volume.getPath(), volume.getName(), deviceId);
cmd.setPoolUuid(volumePool.getUuid());
try {
answer = (AttachVolumeAnswer)_agentMgr.send(hostId, cmd);
@ -481,6 +483,8 @@ public class UserVmManagerImpl implements UserVmManager {
if (sendCommand) {
AttachVolumeCommand cmd = new AttachVolumeCommand(false, vm.getInstanceName(), volume.getPoolType(), volume.getFolder(), volume.getPath(), volume.getName(), deviceId!=0 ? deviceId : volume.getDeviceId());
StoragePoolVO volumePool = _storagePoolDao.findById(volume.getPoolId());
cmd.setPoolUuid(volumePool.getUuid());
try {
answer = _agentMgr.send(vm.getHostId(), cmd);