public static APIQueryVolumeSnapshotReply __example__() { APIQueryVolumeSnapshotReply reply = new APIQueryVolumeSnapshotReply(); VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setUuid(uuid()); inv.setName("My Snapshot 2"); inv.setPrimaryStorageUuid(uuid()); inv.setFormat("qcow2"); inv.setLatest(false); inv.setPrimaryStorageUuid("/zstack_ps/rootVolumes/acct-e77f16d460ea46e18262547b56972273/vol-13c66bb52d0949398e520183b917f813/snapshots/2fa6979af5c6479fa98f37d316f44b5f.qcow2"); inv.setSize(1310720); inv.setStatus(VolumeSnapshotStatus.Ready.toString()); inv.setState(VolumeSnapshotState.Enabled.toString()); inv.setVolumeType(VolumeType.Root.toString()); reply.setInventories(Collections.singletonList(inv)); return reply; }
public static APICreateVolumeSnapshotEvent __example__() { APICreateVolumeSnapshotEvent event = new APICreateVolumeSnapshotEvent(); String volumeUuid= uuid(); String snapshotUuid = uuid(); VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setName("Snapshot-1"); inv.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date)); inv.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date)); inv.setParentUuid(uuid()); inv.setDescription("create-snapshot-from-volume"); inv.setState(VolumeState.Enabled.toString()); inv.setType("Hypervisor"); inv.setVolumeUuid(volumeUuid); inv.setFormat("qcow2"); inv.setUuid(snapshotUuid); inv.setStatus("Ready"); inv.setPrimaryStorageUuid(uuid()); inv.setPrimaryStorageInstallPath(String.format("/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-%s/snapshots/%s.qcow2", volumeUuid, snapshotUuid)); inv.setLatest(true); inv.setSize(SizeUnit.GIGABYTE.toByte(1)); inv.setVolumeType(VolumeType.Root.toString()); inv.setTreeUuid(uuid()); event.setInventory(inv); return event; }
public static APIUpdateVolumeSnapshotEvent __example__() { APIUpdateVolumeSnapshotEvent event = new APIUpdateVolumeSnapshotEvent(); VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setUuid(uuid()); inv.setName("My Snapshot 2"); inv.setPrimaryStorageUuid(uuid()); inv.setFormat("qcow2"); inv.setLatest(false); inv.setPrimaryStorageUuid("/zstack_ps/rootVolumes/acct-e77f16d460ea46e18262547b56972273/vol-13c66bb52d0949398e520183b917f813/snapshots/2fa6979af5c6479fa98f37d316f44b5f.qcow2"); inv.setSize(1310720); inv.setStatus(VolumeSnapshotStatus.Ready.toString()); inv.setState(VolumeSnapshotState.Enabled.toString()); inv.setVolumeType(VolumeType.Root.toString()); event.setInventory(inv); return event; }
public static APIQueryVolumeSnapshotTreeReply __example__() { APIQueryVolumeSnapshotTreeReply reply = new APIQueryVolumeSnapshotTreeReply(); VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setUuid(uuid()); inv.setName("My Snapshot 2"); inv.setPrimaryStorageUuid(uuid()); inv.setFormat("qcow2"); inv.setVolumeUuid(uuid()); inv.setLatest(false); inv.setPrimaryStorageUuid("/zstack_ps/rootVolumes/acct-e77f16d460ea46e18262547b56972273/vol-13c66bb52d0949398e520183b917f813/snapshots/2fa6979af5c6479fa98f37d316f44b5f.qcow2"); inv.setSize(1310720); inv.setStatus(VolumeSnapshotStatus.Ready.toString()); inv.setState(VolumeSnapshotState.Enabled.toString()); inv.setVolumeType(VolumeType.Root.toString()); VolumeSnapshotTree.SnapshotLeafInventory linv = new VolumeSnapshotTree.SnapshotLeafInventory(); linv.setInventory(inv); linv.setParentUuid(uuid()); VolumeSnapshotTreeInventory tinv = new VolumeSnapshotTreeInventory(); tinv.setUuid(uuid()); tinv.setCurrent(false); tinv.setVolumeUuid(inv.getVolumeUuid()); tinv.setTree(linv); return reply; }
public static VolumeSnapshotInventory valueOf(VolumeSnapshotVO vo) { VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setName(vo.getName()); inv.setCreateDate(vo.getCreateDate()); inv.setDescription(vo.getDescription()); inv.setLastOpDate(vo.getLastOpDate()); inv.setParentUuid(vo.getParentUuid()); inv.setState(vo.getState().toString()); inv.setType(vo.getType()); inv.setVolumeUuid(vo.getVolumeUuid()); inv.setFormat(vo.getFormat()); inv.setUuid(vo.getUuid()); inv.setStatus(vo.getStatus().toString()); inv.setPrimaryStorageUuid(vo.getPrimaryStorageUuid()); inv.setPrimaryStorageInstallPath(vo.getPrimaryStorageInstallPath()); inv.setLatest(vo.isLatest()); inv.setSize(vo.getSize()); inv.setVolumeType(vo.getVolumeType()); inv.setTreeUuid(vo.getTreeUuid()); inv.setBackupStorageRefs(VolumeSnapshotBackupStorageRefInventory.valueOf(vo.getBackupStorageRefs())); return inv; }