Package org.libvirt

Examples of org.libvirt.Connect.domainLookupByName()


        Domain destDomain = null;
        Connect conn = null;
        try {
            conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            ifaces = getInterfaces(conn, vmName);
            dm = conn.domainLookupByName(vmName);
            dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp()
                    + "/system");
            /*
             * Hard code lm flags: VIR_MIGRATE_LIVE(1<<0) and
             * VIR_MIGRATE_PERSIST_DEST(1<<3)
 
View Full Code Here


        s_logger.trace("Checking on the HALTED State");
        Domain dm = null;
        for (; i < 5; i++) {
            try {
                Connect conn = LibvirtConnection.getConnectionByVmName(vm);
                dm = conn.domainLookupByName(vm);
                DomainInfo.DomainState vps = dm.getInfo().state;
                if (vps != null
                        && vps != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF
                        && vps != DomainInfo.DomainState.VIR_DOMAIN_NOSTATE) {
                    return convertToState(vps);
View Full Code Here

        HypervisorType[] hypervisors = new HypervisorType[] { HypervisorType.KVM, Hypervisor.HypervisorType.LXC };

        for (HypervisorType hypervisor : hypervisors) {
            try {
                Connect conn = LibvirtConnection.getConnectionByType(hypervisor.toString());
                if (conn.domainLookupByName(vmName) != null) {
                    return conn;
                }
            } catch (Exception e) {
                s_logger.debug("can't find connection: " + hypervisor.toString() + ", for vm: " + vmName + ", continue");
            }
View Full Code Here

        String xmlDesc = null;
        try {
            conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            ifaces = getInterfaces(conn, vmName);
            disks = getDisks(conn, vmName);
            dm = conn.domainLookupByName(vmName);
            /*
                We replace the private IP address with the address of the destination host.
                This is because the VNC listens on the private IP address of the hypervisor,
                but that address is ofcourse different on the target host.

View Full Code Here

        s_logger.trace("Checking on the HALTED State");
        Domain dm = null;
        for (; i < 5; i++) {
            try {
                Connect conn = LibvirtConnection.getConnectionByVmName(vm);
                dm = conn.domainLookupByName(vm);
                DomainInfo.DomainState vps = dm.getInfo().state;
                if (vps != null
                        && vps != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF
                        && vps != DomainInfo.DomainState.VIR_DOMAIN_NOSTATE) {
                    return convertToState(vps);
View Full Code Here

        HypervisorType[] hypervisors = new HypervisorType[] {HypervisorType.KVM, Hypervisor.HypervisorType.LXC};

        for (HypervisorType hypervisor : hypervisors) {
            try {
                Connect conn = LibvirtConnection.getConnectionByType(hypervisor.toString());
                if (conn.domainLookupByName(vmName) != null) {
                    return conn;
                }
            } catch (Exception e) {
                s_logger.debug("can't find connection: " + hypervisor.toString() + ", for vm: " + vmName + ", continue");
            }
View Full Code Here

        s_logger.trace("Checking on the HALTED State");
        Domain dm = null;
        for (; i < 5; i++) {
            try {
                Connect conn = LibvirtConnection.getConnectionByVmName(vm);
                dm = conn.domainLookupByName(vm);
                DomainInfo.DomainState vps = dm.getInfo().state;
                if (vps != null && vps != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF && vps != DomainInfo.DomainState.VIR_DOMAIN_NOSTATE) {
                    return convertToState(vps);
                }
            } catch (final LibvirtException e) {
View Full Code Here

        String xmlDesc = null;
        try {
            conn = LibvirtConnection.getConnectionByVmName(vmName);
            ifaces = getInterfaces(conn, vmName);
            disks = getDisks(conn, vmName);
            dm = conn.domainLookupByName(vmName);
            /*
                We replace the private IP address with the address of the destination host.
                This is because the VNC listens on the private IP address of the hypervisor,
                but that address is ofcourse different on the target host.

View Full Code Here

        final String vmName = cmd.getVmName();

        if (cmd.checkBeforeCleanup()) {
            try {
                Connect conn = LibvirtConnection.getConnectionByVmName(vmName);
                Domain vm = conn.domainLookupByName(cmd.getVmName());
                if (vm != null && vm.getInfo().state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING) {
                    return new StopAnswer(cmd, "vm is still running on host", false);
                }
            } catch (Exception e) {
                s_logger.debug("Failed to get vm status in case of checkboforecleanup is true", e);
View Full Code Here

        Domain destDomain = null;
        Connect conn = null;
        try {
            conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            ifaces = getInterfaces(conn, vmName);
            dm = conn.domainLookupByName(vmName);
            dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp()
                    + "/system");
            /*
             * Hard code lm flags: VIR_MIGRATE_LIVE(1<<0) and
             * VIR_MIGRATE_PERSIST_DEST(1<<3)
 
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.