You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "howie yu (JIRA)" <ji...@apache.org> on 2013/12/25 03:25:50 UTC

[jira] [Created] (CLOUDSTACK-5642) KVM - LibvirtDomainXMLParser did not support

howie yu created CLOUDSTACK-5642:
------------------------------------

             Summary: 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


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.1.5#6160)