Package com.cloud.hypervisor.kvm.resource.LibvirtVMDef

Examples of com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef


        try {
            conn = LibvirtConnection.getConnection();
            Domain vm = getDomain(conn, routerName);
            List<InterfaceDef> pluggedNics = getInterfaces(conn, routerName);
            InterfaceDef routerNic = null;

            for (InterfaceDef pluggedNic : pluggedNics) {
                if (pluggedNic.getMacAddress().equalsIgnoreCase(nic.getMac())) {
                    routerNic = pluggedNic;
                    break;
View Full Code Here


            return false;
        }
        String vif = null;
        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() > 0) {
            InterfaceDef intf = intfs.get(0);
            vif = intf.getDevName();
        }
        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("destroy_network_rules_for_vm");
        cmd.add("--vmname", vmName);
        if (vif != null) {
View Full Code Here

        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() < nic.getDeviceId()) {
            return false;
        }

        InterfaceDef intf = intfs.get(nic.getDeviceId());
        String brname = intf.getBrName();
        String vif = intf.getDevName();

        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("default_network_rules");
        cmd.add("--vmname", vmName);
        cmd.add("--vmid", vmId.toString());
View Full Code Here

        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() < nic.getDeviceId()) {
            return false;
        }

        InterfaceDef intf = intfs.get(nic.getDeviceId());
        String brname = intf.getBrName();
        String vif = intf.getDevName();

        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("post_default_network_rules");
        cmd.add("--vmname", vmName);
        cmd.add("--vmid", vmId.toString());
View Full Code Here

      if (cmd.getType() == PvlanSetupCommand.Type.DHCP) {
        Script script = new Script(_ovsPvlanDhcpHostPath, _timeout, s_logger);
        if (add) {
          conn = LibvirtConnection.getConnectionByVmName(dhcpName);
          List<InterfaceDef> ifaces = getInterfaces(conn, dhcpName);
          InterfaceDef guestNic = ifaces.get(0);
          script.add(opr, "-b", _guestBridgeName,
            "-p", primaryPvlan, "-i", isolatedPvlan, "-n", dhcpName,
            "-d", dhcpIp, "-m", dhcpMac, "-I", guestNic.getDevName());
        } else {
          script.add(opr, "-b", _guestBridgeName,
            "-p", primaryPvlan, "-i", isolatedPvlan, "-n", dhcpName,
            "-d", dhcpIp, "-m", dhcpMac);
        }
View Full Code Here

        }

        try {
            conn = LibvirtConnection.getConnectionByVmName(routerName);
            List<InterfaceDef> pluggedNics = getInterfaces(conn, routerName);
            InterfaceDef routerNic = null;

            for (InterfaceDef pluggedNic : pluggedNics) {
                if (pluggedNic.getMacAddress().equalsIgnoreCase(nic.getMac())) {
                    routerNic = pluggedNic;
                    break;
View Full Code Here

            return false;
        }
        String vif = null;
        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() > 0) {
            InterfaceDef intf = intfs.get(0);
            vif = intf.getDevName();
        }
        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("destroy_network_rules_for_vm");
        cmd.add("--vmname", vmName);
        if (vif != null) {
View Full Code Here

        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() == 0 || intfs.size() < nic.getDeviceId()) {
            return false;
        }

        InterfaceDef intf = intfs.get(nic.getDeviceId());
        String brname = intf.getBrName();
        String vif = intf.getDevName();

        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("default_network_rules");
        cmd.add("--vmname", vmName);
        cmd.add("--vmid", vmId.toString());
View Full Code Here

        List<InterfaceDef> intfs = getInterfaces(conn, vmName);
        if (intfs.size() < nic.getDeviceId()) {
            return false;
        }

        InterfaceDef intf = intfs.get(nic.getDeviceId());
        String brname = intf.getBrName();
        String vif = intf.getDevName();

        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("post_default_network_rules");
        cmd.add("--vmname", vmName);
        cmd.add("--vmid", vmId.toString());
View Full Code Here

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

            Element graphic = (Element) devices
View Full Code Here

TOP

Related Classes of com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.