/** * Get list of disks in a virtual machine * * @title Retrieve the list of hard disks of a virtual machine in the cloud infrastructure * @param datacenterId * @param rackId * @param machineId * @param vmId * @param restBuilder * @return * @throws Exception */ @GET @Path(DISKS_ACTION_PATH) @Produces(DisksManagementDto.MEDIA_TYPE) public DisksManagementDto getListOfDisks( @PathParam(DatacenterResource.DATACENTER) @NotNull @Min(1) final Integer datacenterId, @PathParam(RackResource.RACK) @NotNull @Min(1) final Integer rackId, @PathParam(MachineResource.MACHINE) @Min(1) @NotNull final Integer machineId, @PathParam(VirtualMachineInfrastructureResource.VIRTUAL_MACHINE_INFRASTRUCTURE) @Min(1) @NotNull final Integer vmId, @Context final IRESTBuilder restBuilder) throws Exception { VirtualMachine vm = service.getVirtualMachineFromInfrastructure(datacenterId, rackId, machineId, vmId); List<DiskManagement> disks = storageService.getListOfHardDisksByVM(vm); DisksManagementDto dto = new DisksManagementDto(); for (DiskManagement disk : disks) { dto.getCollection().add(DiskResource.createDiskTransferObject(disk, restBuilder)); } return dto; }
/** * Return a virtual machine deployed in the given physical machine. * * @title Retrive a virtual machine deployed in a physical machine * @wiki Returns the requested virtual machine that is deployed in a physical machine and is * actually managed by abiquo. That means that the virtual machine exist in the database and * in the hypervisor. * @param datacenterId identifier of the datacenter * @param rackId identifier of the rack * @param machineId identifier of the machine * @param vmId identifier of the requested virtual machine * @param restBuilder a Context-injected object to create the links of the Dto * @return the {VirtualMachineDto} object with the virtual machine deployed in the physical * machine * @throws Exception */ @GET @Produces(VirtualMachineDto.MEDIA_TYPE) public VirtualMachineDto getInfrastructureVirtualMachine( @PathParam(DatacenterResource.DATACENTER) @NotNull @Min(1) final Integer datacenterId, @PathParam(RackResource.RACK) @NotNull @Min(1) final Integer rackId, @PathParam(MachineResource.MACHINE) @Min(1) @NotNull final Integer machineId, @PathParam(VirtualMachineInfrastructureResource.VIRTUAL_MACHINE_INFRASTRUCTURE) @Min(1) @NotNull final Integer vmId, @Context final IRESTBuilder restBuilder) throws Exception { VirtualMachine vm = service.getVirtualMachineFromInfrastructure(datacenterId, rackId, machineId, vmId); VirtualAppliance vapp = service.getVirtualApplianceFromVirtualMachineHelper(vm); return createTransferObject(datacenterId, rackId, machineId, vm, vapp, restBuilder); }