@Test public void test() throws ApiSenderException, InterruptedException { VmInstanceInventory vm = deployer.vms.get("TestVm"); VolumeInventory root = CollectionUtils.find( vm.getAllVolumes(), new Function<VolumeInventory, VolumeInventory>() { @Override public VolumeInventory call(VolumeInventory arg) { return VolumeType.Root.toString().equals(arg.getType()) ? arg : null; } }); assert root != null; VolumeSnapshotInventory sp = api.createSnapshot(root.getUuid()); IscsiBtrfsSnapshotValidator validator = new IscsiBtrfsSnapshotValidator(); validator.validate(sp); VolumeInventory volume = api.createDataVolumeFromSnapshot(sp.getUuid()); Assert.assertEquals(VolumeConstant.VOLUME_FORMAT_RAW, volume.getFormat()); }
@Test public void test() throws ApiSenderException, InterruptedException { VmInstanceInventory vm = deployer.vms.get("TestVm"); VolumeInventory root = CollectionUtils.find( vm.getAllVolumes(), new Function<VolumeInventory, VolumeInventory>() { @Override public VolumeInventory call(VolumeInventory arg) { return VolumeType.Root.toString().equals(arg.getType()) ? arg : null; } }); assert root != null; VolumeSnapshotInventory sp = api.createSnapshot(root.getUuid()); IscsiBtrfsSnapshotValidator validator = new IscsiBtrfsSnapshotValidator(); validator.validate(sp); Assert.assertEquals(1, iconfig.createSubVolumeCmds.size()); api.destroyVmInstance(vm.getUuid()); api.deleteSnapshot(sp.getUuid()); VolumeSnapshotVO spvo = dbf.findByUuid(sp.getUuid(), VolumeSnapshotVO.class); Assert.assertNull(spvo); }