mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge release branch 4.9 to master
* 4.9: CLOUDSTACK-9591: Fix guest VM ovf xml to remove network nodes CLOUDSTACK-9591: Fix systemvmtemplate to not include network details
This commit is contained in:
commit
7b78a22c5e
@ -433,12 +433,6 @@ scsi0:0.writeThrough = "false"
|
|||||||
scsi0.virtualDev = "lsilogic"
|
scsi0.virtualDev = "lsilogic"
|
||||||
scsi0.present = "TRUE"
|
scsi0.present = "TRUE"
|
||||||
vmci0.unrestricted = "false"
|
vmci0.unrestricted = "false"
|
||||||
ethernet0.present = "TRUE"
|
|
||||||
ethernet0.virtualDev = "e1000"
|
|
||||||
ethernet0.connectionType = "bridged"
|
|
||||||
ethernet0.startConnected = "TRUE"
|
|
||||||
ethernet0.addressType = "generated"
|
|
||||||
ethernet0.wakeonpcktrcv = "false"
|
|
||||||
vcpu.hotadd = "false"
|
vcpu.hotadd = "false"
|
||||||
vcpu.hotremove = "false"
|
vcpu.hotremove = "false"
|
||||||
firmware = "bios"
|
firmware = "bios"
|
||||||
|
|||||||
@ -16,17 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.hypervisor.vmware.mo;
|
package com.cloud.hypervisor.vmware.mo;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.cloud.exception.CloudException;
|
import com.cloud.exception.CloudException;
|
||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
import com.cloud.hypervisor.vmware.util.VmwareHelper;
|
import com.cloud.hypervisor.vmware.util.VmwareHelper;
|
||||||
@ -92,6 +81,33 @@ import com.vmware.vim25.VirtualSCSISharing;
|
|||||||
import com.vmware.vim25.VmwareDistributedVirtualSwitchPvlanSpec;
|
import com.vmware.vim25.VmwareDistributedVirtualSwitchPvlanSpec;
|
||||||
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
|
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
|
||||||
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanSpec;
|
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanSpec;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.traversal.DocumentTraversal;
|
||||||
|
import org.w3c.dom.traversal.NodeFilter;
|
||||||
|
import org.w3c.dom.traversal.NodeIterator;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerException;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class HypervisorHostHelper {
|
public class HypervisorHostHelper {
|
||||||
private static final Logger s_logger = Logger.getLogger(HypervisorHostHelper.class);
|
private static final Logger s_logger = Logger.getLogger(HypervisorHostHelper.class);
|
||||||
@ -1477,6 +1493,40 @@ public class HypervisorHostHelper {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String removeOVFNetwork(final String ovfString) {
|
||||||
|
if (ovfString == null || ovfString.isEmpty()) {
|
||||||
|
return ovfString;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
final Document doc = factory.newDocumentBuilder().parse(new ByteArrayInputStream(ovfString.getBytes()));
|
||||||
|
final DocumentTraversal traversal = (DocumentTraversal) doc;
|
||||||
|
final NodeIterator iterator = traversal.createNodeIterator(doc.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
|
||||||
|
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
|
||||||
|
final Element e = (Element) n;
|
||||||
|
if ("NetworkSection".equals(e.getTagName())) {
|
||||||
|
if (e.getParentNode() != null) {
|
||||||
|
e.getParentNode().removeChild(e);
|
||||||
|
}
|
||||||
|
} else if ("rasd:Connection".equals(e.getTagName())) {
|
||||||
|
if (e.getParentNode() != null && e.getParentNode().getParentNode() != null) {
|
||||||
|
e.getParentNode().getParentNode().removeChild(e.getParentNode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final DOMSource domSource = new DOMSource(doc);
|
||||||
|
final StringWriter writer = new StringWriter();
|
||||||
|
final StreamResult result = new StreamResult(writer);
|
||||||
|
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||||
|
final Transformer transformer = tf.newTransformer();
|
||||||
|
transformer.transform(domSource, result);
|
||||||
|
return writer.toString();
|
||||||
|
} catch (SAXException | IOException | ParserConfigurationException | TransformerException e) {
|
||||||
|
s_logger.warn("Unexpected exception caught while removing network elements from OVF:", e);
|
||||||
|
}
|
||||||
|
return ovfString;
|
||||||
|
}
|
||||||
|
|
||||||
public static void importVmFromOVF(VmwareHypervisorHost host, String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption, ManagedObjectReference morRp,
|
public static void importVmFromOVF(VmwareHypervisorHost host, String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption, ManagedObjectReference morRp,
|
||||||
ManagedObjectReference morHost) throws Exception {
|
ManagedObjectReference morHost) throws Exception {
|
||||||
|
|
||||||
@ -1488,9 +1538,9 @@ public class HypervisorHostHelper {
|
|||||||
importSpecParams.setEntityName(vmName);
|
importSpecParams.setEntityName(vmName);
|
||||||
importSpecParams.setDeploymentOption("");
|
importSpecParams.setDeploymentOption("");
|
||||||
importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
|
importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
|
||||||
//importSpecParams.setPropertyMapping(null);
|
|
||||||
|
|
||||||
String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
|
String ovfDescriptor = removeOVFNetwork(HttpNfcLeaseMO.readOvfContent(ovfFilePath));
|
||||||
|
|
||||||
VmwareContext context = host.getContext();
|
VmwareContext context = host.getContext();
|
||||||
OvfCreateImportSpecResult ovfImportResult =
|
OvfCreateImportSpecResult ovfImportResult =
|
||||||
context.getService().createImportSpec(context.getServiceContent().getOvfManager(), ovfDescriptor, morRp, dsMo.getMor(), importSpecParams);
|
context.getService().createImportSpec(context.getServiceContent().getOvfManager(), ovfDescriptor, morRp, dsMo.getMor(), importSpecParams);
|
||||||
|
|||||||
@ -16,22 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.hypervisor.vmware.mo;
|
package com.cloud.hypervisor.vmware.mo;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.MockitoAnnotations;
|
|
||||||
|
|
||||||
import com.vmware.vim25.AboutInfo;
|
import com.vmware.vim25.AboutInfo;
|
||||||
import com.vmware.vim25.BoolPolicy;
|
import com.vmware.vim25.BoolPolicy;
|
||||||
import com.vmware.vim25.DVPortgroupConfigInfo;
|
import com.vmware.vim25.DVPortgroupConfigInfo;
|
||||||
@ -41,8 +26,21 @@ import com.vmware.vim25.LongPolicy;
|
|||||||
import com.vmware.vim25.ServiceContent;
|
import com.vmware.vim25.ServiceContent;
|
||||||
import com.vmware.vim25.VMwareDVSPortSetting;
|
import com.vmware.vim25.VMwareDVSPortSetting;
|
||||||
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
|
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class HypervisorHostHelperTest {
|
public class HypervisorHostHelperTest {
|
||||||
@Mock
|
@Mock
|
||||||
@ -557,4 +555,223 @@ public class HypervisorHostHelperTest {
|
|||||||
String cloudNetworkName = HypervisorHostHelper.composeCloudNetworkName(prefix, vlanId, svlanId, networkRateMbps, vSwitchName);
|
String cloudNetworkName = HypervisorHostHelper.composeCloudNetworkName(prefix, vlanId, svlanId, networkRateMbps, vSwitchName);
|
||||||
assertEquals("cloud.guest.400.s123.512.1-vSwitch2", cloudNetworkName);
|
assertEquals("cloud.guest.400.s123.512.1-vSwitch2", cloudNetworkName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOvfDomRewriter() {
|
||||||
|
final String ovfString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
||||||
|
"<!--Generated by VMware ovftool 3.5.0 (build-1274719), UTC time: 2016-10-03T12:49:55.591821Z-->" +
|
||||||
|
"<Envelope xmlns=\"http://schemas.dmtf.org/ovf/envelope/1\" xmlns:cim=\"http://schemas.dmtf.org/wbem/wscim/1/common\" xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1\" xmlns:rasd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData\" xmlns:vmw=\"http://www.vmware.com/schema/ovf\" xmlns:vssd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
|
||||||
|
" <References>\n" +
|
||||||
|
" <File ovf:href=\"macchinina-vmware-disk1.vmdk\" ovf:id=\"file1\" ovf:size=\"23303168\"/>\n" +
|
||||||
|
" </References>\n" +
|
||||||
|
" <DiskSection>\n" +
|
||||||
|
" <Info>Virtual disk information</Info>\n" +
|
||||||
|
" <Disk ovf:capacity=\"50\" ovf:capacityAllocationUnits=\"byte * 2^20\" ovf:diskId=\"vmdisk1\" ovf:fileRef=\"file1\" ovf:format=\"http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized\" ovf:populatedSize=\"43319296\"/>\n" +
|
||||||
|
" </DiskSection>\n" +
|
||||||
|
" <NetworkSection>\n" +
|
||||||
|
" <Info>The list of logical networks</Info>\n" +
|
||||||
|
" <Network ovf:name=\"bridged\">\n" +
|
||||||
|
" <Description>The bridged network</Description>\n" +
|
||||||
|
" </Network>\n" +
|
||||||
|
" </NetworkSection>\n" +
|
||||||
|
" <VirtualSystem ovf:id=\"vm\">\n" +
|
||||||
|
" <Info>A virtual machine</Info>\n" +
|
||||||
|
" <Name>macchinina-vmware</Name>\n" +
|
||||||
|
" <OperatingSystemSection ovf:id=\"101\" vmw:osType=\"otherLinux64Guest\">\n" +
|
||||||
|
" <Info>The kind of installed guest operating system</Info>\n" +
|
||||||
|
" </OperatingSystemSection>\n" +
|
||||||
|
" <VirtualHardwareSection>\n" +
|
||||||
|
" <Info>Virtual hardware requirements</Info>\n" +
|
||||||
|
" <System>\n" +
|
||||||
|
" <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>\n" +
|
||||||
|
" <vssd:InstanceID>0</vssd:InstanceID>\n" +
|
||||||
|
" <vssd:VirtualSystemIdentifier>macchinina-vmware</vssd:VirtualSystemIdentifier>\n" +
|
||||||
|
" <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>\n" +
|
||||||
|
" </System>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>\n" +
|
||||||
|
" <rasd:Description>Number of Virtual CPUs</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>1</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>3</rasd:ResourceType>\n" +
|
||||||
|
" <rasd:VirtualQuantity>1</rasd:VirtualQuantity>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>\n" +
|
||||||
|
" <rasd:Description>Memory Size</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>256MB of memory</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>2</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>4</rasd:ResourceType>\n" +
|
||||||
|
" <rasd:VirtualQuantity>256</rasd:VirtualQuantity>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:Address>0</rasd:Address>\n" +
|
||||||
|
" <rasd:Description>SCSI Controller</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>scsiController0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>3</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>\n" +
|
||||||
|
" <rasd:ResourceType>6</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:Address>0</rasd:Address>\n" +
|
||||||
|
" <rasd:Description>IDE Controller</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>ideController0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>4</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>5</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AddressOnParent>0</rasd:AddressOnParent>\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>cdrom0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>5</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:Parent>4</rasd:Parent>\n" +
|
||||||
|
" <rasd:ResourceType>15</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AddressOnParent>0</rasd:AddressOnParent>\n" +
|
||||||
|
" <rasd:ElementName>disk0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>\n" +
|
||||||
|
" <rasd:InstanceID>6</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:Parent>3</rasd:Parent>\n" +
|
||||||
|
" <rasd:ResourceType>17</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AddressOnParent>2</rasd:AddressOnParent>\n" +
|
||||||
|
" <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:Connection>bridged</rasd:Connection>\n" +
|
||||||
|
" <rasd:Description>E1000 ethernet adapter on "bridged"</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>ethernet0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>7</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceSubType>E1000</rasd:ResourceSubType>\n" +
|
||||||
|
" <rasd:ResourceType>10</rasd:ResourceType>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"wakeOnLanEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>video</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>8</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>24</rasd:ResourceType>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"enable3DSupport\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"useAutoDetect\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"videoRamSizeInKB\" vmw:value=\"4096\"/>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>vmci</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>9</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>\n" +
|
||||||
|
" <rasd:ResourceType>1</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"cpuHotAddEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"cpuHotRemoveEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"firmware\" vmw:value=\"bios\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"memoryHotAddEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" </VirtualHardwareSection>\n" +
|
||||||
|
" <AnnotationSection ovf:required=\"false\">\n" +
|
||||||
|
" <Info>A human-readable annotation</Info>\n" +
|
||||||
|
" <Annotation>macchinina-vmware</Annotation>\n" +
|
||||||
|
" </AnnotationSection>\n" +
|
||||||
|
" </VirtualSystem>\n" +
|
||||||
|
"</Envelope>";
|
||||||
|
|
||||||
|
final String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
||||||
|
"<!--Generated by VMware ovftool 3.5.0 (build-1274719), UTC time: 2016-10-03T12:49:55.591821Z-->" +
|
||||||
|
"<Envelope xmlns=\"http://schemas.dmtf.org/ovf/envelope/1\" xmlns:cim=\"http://schemas.dmtf.org/wbem/wscim/1/common\" xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1\" xmlns:rasd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData\" xmlns:vmw=\"http://www.vmware.com/schema/ovf\" xmlns:vssd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
|
||||||
|
" <References>\n" +
|
||||||
|
" <File ovf:href=\"macchinina-vmware-disk1.vmdk\" ovf:id=\"file1\" ovf:size=\"23303168\"/>\n" +
|
||||||
|
" </References>\n" +
|
||||||
|
" <DiskSection>\n" +
|
||||||
|
" <Info>Virtual disk information</Info>\n" +
|
||||||
|
" <Disk ovf:capacity=\"50\" ovf:capacityAllocationUnits=\"byte * 2^20\" ovf:diskId=\"vmdisk1\" ovf:fileRef=\"file1\" ovf:format=\"http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized\" ovf:populatedSize=\"43319296\"/>\n" +
|
||||||
|
" </DiskSection>\n \n" +
|
||||||
|
" <VirtualSystem ovf:id=\"vm\">\n" +
|
||||||
|
" <Info>A virtual machine</Info>\n" +
|
||||||
|
" <Name>macchinina-vmware</Name>\n" +
|
||||||
|
" <OperatingSystemSection ovf:id=\"101\" vmw:osType=\"otherLinux64Guest\">\n" +
|
||||||
|
" <Info>The kind of installed guest operating system</Info>\n" +
|
||||||
|
" </OperatingSystemSection>\n" +
|
||||||
|
" <VirtualHardwareSection>\n" +
|
||||||
|
" <Info>Virtual hardware requirements</Info>\n" +
|
||||||
|
" <System>\n" +
|
||||||
|
" <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>\n" +
|
||||||
|
" <vssd:InstanceID>0</vssd:InstanceID>\n" +
|
||||||
|
" <vssd:VirtualSystemIdentifier>macchinina-vmware</vssd:VirtualSystemIdentifier>\n" +
|
||||||
|
" <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>\n" +
|
||||||
|
" </System>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>\n" +
|
||||||
|
" <rasd:Description>Number of Virtual CPUs</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>1</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>3</rasd:ResourceType>\n" +
|
||||||
|
" <rasd:VirtualQuantity>1</rasd:VirtualQuantity>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>\n" +
|
||||||
|
" <rasd:Description>Memory Size</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>256MB of memory</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>2</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>4</rasd:ResourceType>\n" +
|
||||||
|
" <rasd:VirtualQuantity>256</rasd:VirtualQuantity>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:Address>0</rasd:Address>\n" +
|
||||||
|
" <rasd:Description>SCSI Controller</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>scsiController0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>3</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>\n" +
|
||||||
|
" <rasd:ResourceType>6</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:Address>0</rasd:Address>\n" +
|
||||||
|
" <rasd:Description>IDE Controller</rasd:Description>\n" +
|
||||||
|
" <rasd:ElementName>ideController0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>4</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>5</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AddressOnParent>0</rasd:AddressOnParent>\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>cdrom0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>5</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:Parent>4</rasd:Parent>\n" +
|
||||||
|
" <rasd:ResourceType>15</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item>\n" +
|
||||||
|
" <rasd:AddressOnParent>0</rasd:AddressOnParent>\n" +
|
||||||
|
" <rasd:ElementName>disk0</rasd:ElementName>\n" +
|
||||||
|
" <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>\n" +
|
||||||
|
" <rasd:InstanceID>6</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:Parent>3</rasd:Parent>\n" +
|
||||||
|
" <rasd:ResourceType>17</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n \n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>video</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>8</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceType>24</rasd:ResourceType>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"enable3DSupport\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"useAutoDetect\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"videoRamSizeInKB\" vmw:value=\"4096\"/>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <Item ovf:required=\"false\">\n" +
|
||||||
|
" <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>\n" +
|
||||||
|
" <rasd:ElementName>vmci</rasd:ElementName>\n" +
|
||||||
|
" <rasd:InstanceID>9</rasd:InstanceID>\n" +
|
||||||
|
" <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>\n" +
|
||||||
|
" <rasd:ResourceType>1</rasd:ResourceType>\n" +
|
||||||
|
" </Item>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"cpuHotAddEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"cpuHotRemoveEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"firmware\" vmw:value=\"bios\"/>\n" +
|
||||||
|
" <vmw:Config ovf:required=\"false\" vmw:key=\"memoryHotAddEnabled\" vmw:value=\"false\"/>\n" +
|
||||||
|
" </VirtualHardwareSection>\n" +
|
||||||
|
" <AnnotationSection ovf:required=\"false\">\n" +
|
||||||
|
" <Info>A human-readable annotation</Info>\n" +
|
||||||
|
" <Annotation>macchinina-vmware</Annotation>\n" +
|
||||||
|
" </AnnotationSection>\n" +
|
||||||
|
" </VirtualSystem>\n" +
|
||||||
|
"</Envelope>";
|
||||||
|
assertEquals(expected, HypervisorHostHelper.removeOVFNetwork(ovfString));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user