[
https://issues.apache.org/jira/browse/CLOUDSTACK-5642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rafael Weingärtner closed CLOUDSTACK-5642.
------------------------------------------
Resolution: Fixed
> KVM - LibvirtDomainXMLParser did not support <interface type='direct'>
> ----------------------------------------------------------------------
>
> Key: CLOUDSTACK-5642
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5642
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: KVM
> Affects Versions: 4.0.0
> Reporter: howie yu
> Priority: Minor
> Labels: patch
>
> n this document
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Support+in+Cloudstack
> , CloudStack should support direct mode.
> Direct Networking
> Libvirt supports direct attachment of the guest VM's network to a physical
> interface. To enable this mode, add the following to agent.properties:
> libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
> network.direct.source.mode=private (other values: bridge|vepa)
> network.direct.device=eth0
> But I found the following code may cause some problem, when the nic interface
> type is direct
> If type is direct , then this nic will be ignore.
> String type = nic.getAttribute("type");
> String mac = getAttrValue("mac", "address", nic);
> String dev = getAttrValue("target", "dev", nic);
> String model = getAttrValue("model", "type", nic);
> InterfaceDef def = new InterfaceDef();
> NodeList bandwidth = nic.getElementsByTagName("bandwidth");
> Integer networkRateKBps = 0;
> if ((bandwidth != null) && (bandwidth.getLength() != 0)) {
> Integer inbound = Integer.valueOf(getAttrValue("inbound",
> "average", (Element)bandwidth.item(0)));
> Integer outbound =
> Integer.valueOf(getAttrValue("outbound", "average",
> (Element)bandwidth.item(0)));
> if (inbound == outbound)
> networkRateKBps = inbound;
> }
> if (type.equalsIgnoreCase("network")) {
> String network = getAttrValue("source", "network", nic);
> def.defPrivateNet(network, dev, mac,
> nicModel.valueOf(model.toUpperCase()), networkRateKBps);
> } else if (type.equalsIgnoreCase("bridge")) {
> String bridge = getAttrValue("source", "bridge", nic);
> def.defBridgeNet(bridge, dev, mac,
> nicModel.valueOf(model.toUpperCase()), networkRateKBps);
> } else if (type.equalsIgnoreCase("ethernet")) {
> String scriptPath = getAttrValue("script", "path", nic);
> def.defEthernet(dev, mac,
> nicModel.valueOf(model.toUpperCase()), scriptPath, networkRateKBps);
> }
> interfaces.add(def);
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)