public VCloudVirtualHardwareSection getResult() { VirtualHardwareSection hardware = hardwareHandler.getResult(); return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware .getTransports(), hardware.getSystem(), hardware.getItems()); }
/** * {@inheritDoc} */ @Override public VirtualHardwareSection build() { return new VirtualHardwareSection(info, transports, virtualSystem, items); }
/** * {@inheritDoc} */ @Override public Builder toBuilder() { return builder().fromVirtualHardwareSection(this); }
@Test(enabled = false) public static void checkHardware(VirtualHardwareSection result) { assertEquals(result.getSystem(), VirtualSystemSettingData.builder().instanceID("0").elementName( "Virtual Hardware Family").virtualSystemIdentifier("Ubuntu1004").virtualSystemType("vmx-07").build()); assertEquals(result.getInfo(), "Virtual hardware requirements"); assertEquals(Iterables.get(result.getItems(), 0).toString(), ResourceAllocationSettingData .builder().instanceID("1").elementName("Network adapter 0").description("PCNet32 ethernet adapter") .resourceType(ResourceType.ETHERNET_ADAPTER).resourceSubType("PCNet32").address("00:50:56:8c:00:13") .automaticAllocation(true).connection("vAppNet-vApp Internal").addressOnParent("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 1).toString(), ResourceAllocationSettingData .builder().instanceID("2").elementName("SCSI Controller 0").description("SCSI Controller").resourceType( ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic").address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 2).toString(), ResourceAllocationSettingData .builder().instanceID("2000").elementName("Hard disk 1").description("Hard disk").resourceType( ResourceType.DISK_DRIVE).addressOnParent("0").parent("2").build().toString()); assertEquals(Iterables.get(result.getItems(), 3).toString(), ResourceAllocationSettingData .builder().instanceID("3").elementName("IDE Controller 0").description("IDE Controller").resourceType( ResourceType.IDE_CONTROLLER).address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 4).toString(), ResourceAllocationSettingData .builder().instanceID("3002").elementName("CD/DVD Drive 1").description("CD/DVD Drive").resourceType( ResourceType.CD_DRIVE).addressOnParent("0").parent("3").automaticAllocation(false).build() .toString()); assertEquals(Iterables.get(result.getItems(), 5).toString(), ResourceAllocationSettingData .builder().instanceID("8000").elementName("Floppy Drive 1").description("Floppy Drive").resourceType(
@Override public Hardware apply(VApp from) { checkNotNull(from, "VApp"); // TODO make this work with composite vApps Vm vm = from.getChildren().size() == 0 ? null : Iterables.get(from.getChildren(), 0); if (vm == null) return null; VirtualHardwareSection hardware = vm.getVirtualHardwareSection(); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC())); builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( ImagePredicates.idEquals(from.getHref().toASCIIString())); builder.hypervisor("VMware"); return builder.build(); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj; return href.equals(other.href); }
@Override public Hardware apply(VApp from) { checkNotNull(from, "VApp"); // TODO make this work with composite vApps Vm vm = from.getChildren().size() == 0 ? null : Iterables.get(from.getChildren(), 0); if (vm == null) return null; VirtualHardwareSection hardware = vm.getVirtualHardwareSection(); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC())); builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( ImagePredicates.idEquals(from.getHref().toASCIIString())); builder.hypervisor("VMware"); return builder.build(); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj; return href.equals(other.href); }
public VCloudVirtualHardwareSection getResult() { VirtualHardwareSection hardware = hardwareHandler.getResult(); return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware .getTransports(), hardware.getSystem(), hardware.getItems()); }
@Override public Hardware apply(VApp from) { checkNotNull(from, "VApp"); // TODO make this work with composite vApps Vm vm = from.getChildren().size() == 0 ? null : Iterables.get(from.getChildren(), 0); if (vm == null) return null; VirtualHardwareSection hardware = vm.getVirtualHardwareSection(); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC())); builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( ImagePredicates.idEquals(from.getHref().toASCIIString())); builder.hypervisor("VMware"); return builder.build(); } }
/** * {@inheritDoc} */ @Override public Builder toBuilder() { return builder().fromVirtualHardwareSection(this); }
/** * {@inheritDoc} */ @Override public VirtualHardwareSection build() { return new VirtualHardwareSection(info, transports, virtualSystem, items); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj; return href.equals(other.href); }
public VCloudVirtualHardwareSection getResult() { VirtualHardwareSection hardware = hardwareHandler.getResult(); return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware .getTransports(), hardware.getSystem(), hardware.getItems()); }
@Override public Hardware apply(VAppTemplate from) { checkNotNull(from, "VAppTemplate"); Envelope ovf = templateToEnvelope.apply(from); if (ovf.getVirtualSystem().getVirtualHardwareSections().size() > 1) { logger.warn("multiple hardware choices found. using first", ovf); } VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); if (from.getVDC() != null) { builder.location(findLocationForResource.apply(from.getVDC())); } else { // otherwise, it could be in a public catalog, which is not assigned to a VDC } builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( ImagePredicates.idEquals(from.getHref().toASCIIString())); builder.hypervisor("VMware"); return builder.build(); }
/** * {@inheritDoc} */ @Override public Builder toBuilder() { return builder().fromVirtualHardwareSection(this); }
/** * {@inheritDoc} */ @Override public VirtualHardwareSection build() { return new VirtualHardwareSection(info, transports, virtualSystem, items); }
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) { return fromSection(in).items(in.getItems()).transports(in.getTransports()).system( in.getSystem()).info(in.getInfo()); }
@Override public Hardware apply(VAppTemplate from) { checkNotNull(from, "VAppTemplate"); Envelope ovf = templateToEnvelope.apply(from); if (ovf.getVirtualSystem().getVirtualHardwareSections().size() > 1) { logger.warn("multiple hardware choices found. using first", ovf); } VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); if (from.getVDC() != null) { builder.location(findLocationForResource.apply(from.getVDC())); } else { // otherwise, it could be in a public catalog, which is not assigned to a VDC } builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( ImagePredicates.idEquals(from.getHref().toASCIIString())); builder.hypervisor("VMware"); return builder.build(); }
/** * {@inheritDoc} */ @Override public Builder toBuilder() { return builder().fromVirtualHardwareSection(this); }