mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6170 (VMware root-disk support for managed storage)
This commit is contained in:
parent
b2ffd86570
commit
21455222e4
|
|
@ -38,7 +38,7 @@ public interface VmwareHostService {
|
|||
String chapTargetUsername, String chapTargetSecret) throws Exception;
|
||||
|
||||
ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName,
|
||||
String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String storageHost, int storagePort, String volumeName, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception;
|
||||
|
||||
void handleDatastoreAndVmdkDetach(String iqn, String storageHost, int storagePort) throws Exception;
|
||||
|
|
|
|||
|
|
@ -1834,14 +1834,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
|
||||
@Override
|
||||
public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName,
|
||||
String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String storageHost, int storagePort, String volumeName, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception {
|
||||
ManagedObjectReference morDs = prepareManagedDatastore(hyperHost, iScsiName, storageHost, storagePort,
|
||||
chapInitiatorUsername, chapInitiatorSecret, chapTargetUsername, chapTargetSecret);
|
||||
|
||||
DatastoreMO dsMo = new DatastoreMO(getServiceContext(null), morDs);
|
||||
|
||||
String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), dsMo.getName());
|
||||
String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), volumeName != null ? volumeName : dsMo.getName());
|
||||
|
||||
if (!dsMo.fileExists(volumeDatastorePath)) {
|
||||
createVmdk(cmd, dsMo, volumeDatastorePath, size);
|
||||
|
|
@ -2350,12 +2350,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
if (morDatastore == null) {
|
||||
morDatastore = prepareManagedStorage(hyperHost, iScsiName,
|
||||
details.get(DiskTO.STORAGE_HOST), Integer.parseInt(details.get(DiskTO.STORAGE_PORT)),
|
||||
volumeTO.getVolumeType() == Volume.Type.ROOT ? volumeTO.getName() : null,
|
||||
details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET),
|
||||
details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET),
|
||||
Long.parseLong(details.get(DiskTO.VOLUME_SIZE)), cmd);
|
||||
|
||||
DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDatastore);
|
||||
String datastoreVolumePath = dsMo.getDatastorePath(dsMo.getName() + ".vmdk");
|
||||
String datastoreVolumePath = dsMo.getDatastorePath((volumeTO.getVolumeType() == Volume.Type.ROOT ? volumeTO.getName() : dsMo.getName()) + ".vmdk");
|
||||
|
||||
volumeTO.setPath(datastoreVolumePath);
|
||||
vol.setPath(datastoreVolumePath);
|
||||
|
|
@ -3433,7 +3434,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
ManagedObjectReference morDs = null;
|
||||
|
||||
if (cmd.getAttach() && cmd.isManaged()) {
|
||||
morDs = prepareManagedStorage(hyperHost, cmd.get_iScsiName(), cmd.getStorageHost(), cmd.getStoragePort(),
|
||||
morDs = prepareManagedStorage(hyperHost, cmd.get_iScsiName(), cmd.getStorageHost(), cmd.getStoragePort(), null,
|
||||
cmd.getChapInitiatorUsername(), cmd.getChapInitiatorPassword(),
|
||||
cmd.getChapTargetUsername(), cmd.getChapTargetPassword(), cmd.getVolumeSize(), cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
|
|||
|
||||
@Override
|
||||
public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName,
|
||||
String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String storageHost, int storagePort, String volumeName, String chapInitiatorUsername, String chapInitiatorSecret,
|
||||
String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception {
|
||||
throw new OperationNotSupportedException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,10 +277,10 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
managed ? managedStoragePoolRootVolumeName : templateUuidName);
|
||||
|
||||
if (managed) {
|
||||
String[] vmwareLayoutFilePair = VmwareStorageLayoutHelper.getVmdkFilePairDatastorePath(dsMo, managedStoragePoolRootVolumeName, managedStoragePoolRootVolumeName,
|
||||
VmwareStorageLayoutType.VMWARE, false);
|
||||
String[] legacyCloudStackLayoutFilePair = VmwareStorageLayoutHelper.getVmdkFilePairDatastorePath(dsMo, null, managedStoragePoolRootVolumeName,
|
||||
VmwareStorageLayoutType.CLOUDSTACK_LEGACY, false);
|
||||
String[] vmwareLayoutFilePair = VmwareStorageLayoutHelper.getVmdkFilePairDatastorePath(dsMo, managedStoragePoolRootVolumeName,
|
||||
managedStoragePoolRootVolumeName, VmwareStorageLayoutType.VMWARE, false);
|
||||
String[] legacyCloudStackLayoutFilePair = VmwareStorageLayoutHelper.getVmdkFilePairDatastorePath(dsMo, null,
|
||||
managedStoragePoolRootVolumeName, VmwareStorageLayoutType.CLOUDSTACK_LEGACY, false);
|
||||
|
||||
dsMo.moveDatastoreFile(vmwareLayoutFilePair[0], dcMo.getMor(), dsMo.getMor(), legacyCloudStackLayoutFilePair[0], dcMo.getMor(), true);
|
||||
dsMo.moveDatastoreFile(vmwareLayoutFilePair[1], dcMo.getMor(), dsMo.getMor(), legacyCloudStackLayoutFilePair[1], dcMo.getMor(), true);
|
||||
|
|
@ -1254,7 +1254,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
if (isAttach && isManaged) {
|
||||
Map<String, String> details = disk.getDetails();
|
||||
|
||||
morDs = hostService.prepareManagedStorage(hyperHost, iScsiName, storageHost, storagePort,
|
||||
morDs = hostService.prepareManagedStorage(hyperHost, iScsiName, storageHost, storagePort, null,
|
||||
details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET),
|
||||
details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET),
|
||||
volumeTO.getSize(), cmd);
|
||||
|
|
|
|||
Loading…
Reference in New Issue