コード例 #1
0
  @Test
  public void nullifiedSnapshotOnUpdateDiskToShareable() {
    UpdateVmDiskParameters parameters = createParameters();
    DiskImage disk = createShareableDisk(VolumeFormat.RAW);
    parameters.setDiskInfo(disk);
    StorageDomain storage = addNewStorageDomainToDisk(disk, StorageType.NFS);
    parameters.setDiskInfo(disk);

    DiskImage oldDisk = createDiskImage();
    oldDisk.setVmSnapshotId(Guid.newGuid());

    when(diskDao.get(diskImageGuid)).thenReturn(oldDisk);
    when(storageDomainStaticDao.get(storage.getId())).thenReturn(storage.getStorageStaticData());

    initializeCommand(parameters);
    mockVdsCommandSetVolumeDescription();
    mockInterfaceList();

    CanDoActionTestUtils.runAndAssertCanDoActionSuccess(command);
    command.executeVmCommand();
    assertTrue(oldDisk.getVmSnapshotId() == null);
  }
コード例 #2
0
  @Test
  public void canDoActionFailedShareableDiskOnGlusterDomain() throws Exception {
    UpdateVmDiskParameters parameters = createParameters();
    DiskImage disk = createShareableDisk(VolumeFormat.RAW);
    StorageDomain storage = addNewStorageDomainToDisk(disk, StorageType.GLUSTERFS);
    parameters.setDiskInfo(disk);

    when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage());
    when(storageDomainStaticDao.get(storage.getId())).thenReturn(storage.getStorageStaticData());
    initializeCommand(parameters);

    CanDoActionTestUtils.runAndAssertCanDoActionFailure(
        command, EngineMessage.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN);
  }
コード例 #3
0
  @Test
  public void canDoActionFailedShareableDiskVolumeFormatUnsupported() throws Exception {
    UpdateVmDiskParameters parameters = createParameters();
    DiskImage disk = createShareableDisk(VolumeFormat.COW);
    StorageDomain storage = addNewStorageDomainToDisk(disk, StorageType.NFS);
    parameters.setDiskInfo(disk);

    when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage());
    when(storageDomainStaticDao.get(storage.getId())).thenReturn(storage.getStorageStaticData());
    initializeCommand(parameters);

    CanDoActionTestUtils.runAndAssertCanDoActionFailure(
        command, EngineMessage.SHAREABLE_DISK_IS_NOT_SUPPORTED_BY_VOLUME_FORMAT);
  }