use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.
the class TestVSphereDiskService method createDiskWithDatastore.
private DiskState createDiskWithDatastore(String alias, DiskService.DiskType type, long capacityMBytes, HashMap<String, String> customProperties) throws Throwable {
DiskState diskState = constructDiskState(alias, type, 0, null, capacityMBytes, customProperties);
diskState.storageDescriptionLink = createStorageDescriptionState().documentSelfLink;
return postDiskStateWithDetails(diskState);
}
use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.
the class TestVSphereDiskService method testDiskCreateAndDeleteWithStoragePolicy.
@Test
public void testDiskCreateAndDeleteWithStoragePolicy() throws Throwable {
prepareEnvironment();
DiskState diskState = createDiskWithStoragePolicy("AdditionalDisk1", DiskService.DiskType.HDD, ADDITIONAL_DISK_SIZE, buildCustomProperties());
testDiskCreateAndDelete(diskState);
}
use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.
the class TestVSphereDiskService method testDiskCreateAndDelete.
private void testDiskCreateAndDelete(DiskState diskState) throws Throwable {
// start provision task to do the actual disk creation
String documentSelfLink = performDiskRequest(diskState, SubStage.CREATING_DISK);
this.host.waitForFinishedTask(ProvisionDiskTaskService.ProvisionDiskTaskState.class, documentSelfLink);
// check that the disk has been created
ServiceDocumentQueryResult result = ProvisioningUtils.queryDiskInstances(this.host, 1);
if (!isMock()) {
DiskState disk = Utils.fromJson(result.documents.get(diskState.documentSelfLink), DiskState.class);
assertNotNull(disk.customProperties);
assertNotNull(disk.customProperties.get(DISK_FULL_PATH));
assertEquals(DiskService.DiskStatus.AVAILABLE, disk.status);
assertNotNull(disk.customProperties.get(DISK_PARENT_DIRECTORY));
assertNotNull(disk.customProperties.get(DISK_DATASTORE_NAME));
assertTrue(disk.id.startsWith(diskState.name));
}
// start provision task to do the disk deletion
documentSelfLink = performDiskRequest(diskState, SubStage.DELETING_DISK);
this.host.waitForFinishedTask(ProvisionDiskTaskService.ProvisionDiskTaskState.class, documentSelfLink);
// check that the disk has been deleted
ProvisioningUtils.queryDiskInstances(this.host, 0);
}
use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.
the class TestVSphereDiskService method testDiskCreateAndDeleteWithCustomPropsDataStore.
@Test
public void testDiskCreateAndDeleteWithCustomPropsDataStore() throws Throwable {
prepareEnvironment();
DiskState diskState = createDiskWithCustomPropsDataStore("AdditionalDisk1", DiskService.DiskType.HDD, ADDITIONAL_DISK_SIZE, buildCustomProperties());
testDiskCreateAndDelete(diskState);
}
use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.
the class TestVSphereDiskService method createDiskWithStoragePolicy.
private DiskState createDiskWithStoragePolicy(String alias, DiskService.DiskType type, long capacityMBytes, HashMap<String, String> customProperties) throws Throwable {
DiskState diskState = constructDiskState(alias, type, 0, null, capacityMBytes, customProperties);
diskState.groupLinks = new HashSet<>();
if (isMock()) {
diskState.groupLinks.add(createResourceGroupState().documentSelfLink);
} else {
diskState.groupLinks.add(getStoragePolicyLink());
}
return postDiskStateWithDetails(diskState);
}
Aggregations