HI All

In this document
https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Support+in+Cloudstack,
CloudStack should support direct mode.
Direct Networking

Libvirt supports direct
attachment<http://libvirt.org/formatdomain.html#elementsNICSDirect>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.


Should I open a JIRA ticket ? and patch it ?


 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);

 Howie

Reply via email to