예제 #1
0
  @Test
  public void filterImageDisksFilterDiskSnapshots() {
    disk1.setActive(true);

    List<DiskImage> result =
        ImagesHandler.filterImageDisks(Arrays.asList(disk1, disk2), false, false, true);

    assertEquals("Wrong number of Guids returned", 1, result.size());
    assertTrue("The result should contain the active image disk", result.contains(disk1));
  }
 private static DiskImage addTestDisk(VM vm, Guid snapshotId) {
   Guid imageId = Guid.newGuid();
   DiskImage disk = new DiskImage();
   disk.setImageId(imageId);
   disk.setId(Guid.newGuid());
   disk.setVolumeType(VolumeType.Sparse);
   disk.setvolumeFormat(VolumeFormat.COW);
   disk.setDiskInterface(DiskInterface.VirtIO);
   disk.setStoragePoolId(vm.getStoragePoolId());
   disk.setActive(Boolean.TRUE);
   disk.setPlugged(Boolean.TRUE);
   disk.setReadOnly(Boolean.FALSE);
   disk.setVmSnapshotId(snapshotId);
   disk.setImageStatus(ImageStatus.OK);
   disk.setAppList("");
   disk.setDescription("");
   vm.getDiskList().add(disk);
   vm.getDiskMap().put(imageId, disk);
   return disk;
 }