> + /**
> + * Retrieve the virtual machine this volume is attached to.
> + *
> + * @return The virtual machine this volume is attached to, or null if it
> is
> + * not attached.
> + */
> + public VirtualMachine getVirtualMachine() {
> + checkState(ATTACHED == VolumeState.valueOf(target.getState()), "Volume
> is not attached to a VM");
> + RESTLink vmLink =
> checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_MACHINE),
> + ValidationErrors.MISSING_REQUIRED_LINK + " " +
> ParentLinkName.VIRTUAL_MACHINE);
> + vmLink.setType(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE);
> + HttpResponse response = context.getApi().get(vmLink);
> +
> + ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto> parser = new
> ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto>(
> + context.utils().xml(),
> + TypeLiteral.get(VirtualMachineWithNodeExtendedDto.class));
Still not clear why we are explicitly instantiating a parser here. This should
be injected by Guice if we need it, no? But can't we make a different API call
that gives us back a VirtualMachine directly?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/31/files#r7280889