Package org.libvirt

Examples of org.libvirt.Network


    public boolean isNetworkActive(String name) throws LibvirtException {
        return getNetworks().contains(name);
    }

    public NetworkInfo getNetwork(String name) throws LibvirtException {
        Network net = getLibVirtNetwork(name);
       
        try {
            NetworkInfo info = new NetworkInfo();
            info.name = net.getName();
            info.autostart = net.getAutostart();
            info.bridgeName = net.getBridgeName();
            return info;
        } finally {
            net.free();
        }
    }
View Full Code Here


            net.free();
        }
    }

    public String getNetworkXML(String name) throws LibvirtException {
        Network network = getLibVirtNetwork(name);
        try {
            return network.getXMLDesc(0);
        } finally {
            network.free();
        }
    }
View Full Code Here

        }
    }

    public void updateNetwork(String name, String xml, boolean autostart) throws LibvirtException {
        connection.networkDefineXML(xml);
        Network network = getLibVirtNetwork(name);
        try {
            network.setAutostart(autostart);
        } finally {
            network.free();
        }
    }
View Full Code Here

       
        return ret;
    }
   
    private Network getLibVirtNetwork(String networkName) throws LibvirtException, IllegalArgumentException {
        Network ret = connection.networkLookupByName(networkName);
        if (ret == null) {
            throw new IllegalArgumentException("Could not find a netword called '" + networkName + "'.");
        }
       
        return ret;
View Full Code Here

TOP

Related Classes of org.libvirt.Network

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.