Package org.libvirt

Examples of org.libvirt.Domain.undefine()


        if (df == defineOps.UNDEFINE_VM) {
            try {
                dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
                        .getBytes()));
                dm.undefine();
            } catch (LibvirtException e) {

            } finally {
                try {
                    if (dm != null) {
View Full Code Here


            Domain dm = null;
            try {
                dm = conn.domainLookupByName(vmName);
                if (dm != null && dm.isPersistent() == 1) {
                    // this is safe because it doesn't stop running VMs
                    dm.undefine();
                }
            } catch (LibvirtException e) {
                // this is what we want, no domain found
            } finally {
                if (dm != null) {
View Full Code Here

            int persist = dm.isPersistent();
            if (force) {
                if (dm.isActive() == 1) {
                    dm.destroy();
                    if (persist == 1) {
                        dm.undefine();
                    }
                }
            } else {
                if (dm.isActive() == 0) {
                    return null;
View Full Code Here

                    s_logger.warn("Timed out waiting for domain " + vmName
                            + " to shutdown gracefully");
                    return Script.ERR_TIMEOUT;
                } else {
                    if (persist == 1) {
                        dm.undefine();
                    }
                }
            }
        } catch (LibvirtException e) {
            if (e.getMessage().contains("Domain not found")) {
View Full Code Here

            DomainState state = domain.getInfo().state;
   
            if ((state != DomainState.VIR_DOMAIN_SHUTDOWN) && (state != DomainState.VIR_DOMAIN_SHUTOFF)) {
                domain.destroy();
            }
            domain.undefine();
           
            return SUCCESS;
        } finally {
            domain.free();           
        }
View Full Code Here

            Domain dm = null;
            try {
                dm = conn.domainLookupByName(vmName);
                if (dm != null && dm.isPersistent() == 1) {
                    // this is safe because it doesn't stop running VMs
                    dm.undefine();
                }
            } catch (LibvirtException e) {
                // this is what we want, no domain found
            } finally {
                if (dm != null) {
View Full Code Here

            int persist = dm.isPersistent();
            if (force) {
                if (dm.isActive() == 1) {
                    dm.destroy();
                    if (persist == 1) {
                        dm.undefine();
                    }
                }
            } else {
                if (dm.isActive() == 0) {
                    return null;
View Full Code Here

                    s_logger.warn("Timed out waiting for domain " + vmName
                            + " to shutdown gracefully");
                    return Script.ERR_TIMEOUT;
                } else {
                    if (persist == 1) {
                        dm.undefine();
                    }
                }
            }
        } catch (LibvirtException e) {
            if (e.getMessage().contains("Domain not found")) {
View Full Code Here

        if (df == defineOps.UNDEFINE_VM) {
            try {
                dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
                        .getBytes()));
                dm.undefine();
            } catch (LibvirtException e) {

            } finally {
                try {
                    if (dm != null) {
View Full Code Here

            Domain dm = null;
            try {
                dm = conn.domainLookupByName(vmName);
                if (dm != null && dm.isPersistent() == 1) {
                    // this is safe because it doesn't stop running VMs
                    dm.undefine();
                }
            } catch (LibvirtException e) {
                // this is what we want, no domain found
            } finally {
                if (dm != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.