Package org.libvirt

Examples of org.libvirt.Domain


            domain.free();
        }
    }

    public int domainShutdown(String domainName) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.shutdown();
            return SUCCESS;
        } finally {
            domain.free();           
        }
    }
View Full Code Here


            domain.free();           
        }
    }

    public int domainSuspend(String domainName) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.suspend();
            return SUCCESS;
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public int domainCreate(String domainName) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.create();
            return SUCCESS;
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public boolean defineDomain(String xml) throws LibvirtException {
        Domain dom = connection.domainDefineXML(xml);
        boolean returnValue = (dom != null);
        if (returnValue) {
            dom.free();
        }
        return returnValue;
    }
View Full Code Here

        }
        return returnValue;
    }

    public void setMaxMemory(String domainName, long size) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.setMaxMemory(size);
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public void setMemory(String domainName, long size) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.setMemory(size);
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public void setVcpus(String domainName, int count) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            domain.setVcpus(count);
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public DomainInterfaceStats getDomainInterfaceStats(String domainName, String path) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            return domain.interfaceStats(path);
        } finally {
            domain.free();
        }
    }
View Full Code Here

            domain.free();
        }
    }

    public DomainBlockStats getDomainBlockStats(String domainName, String path) throws LibvirtException {
        Domain domain = getDomain(domainName);
        try {
            return domain.blockStats(path);
        } finally {
            domain.free();
        }
    }
View Full Code Here

    public double getMemoryPercentage() throws LibvirtException {
        double memory = connection.nodeInfo().memory;
        double usedMemory = 0;
        for (int id : connection.listDomains()) {
            Domain domain = connection.domainLookupByID(id);
            if (domain != null) {
                usedMemory += domain.getInfo().memory;
                domain.free();
            }
        }
        return usedMemory / memory;
    }
View Full Code Here

TOP

Related Classes of org.libvirt.Domain

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.