Package org.libvirt

Examples of org.libvirt.Connect


        String snapshotDestPath = null;
        String snapshotRelPath = null;
        String vmName = cmd.getVmName();
        KVMStoragePool secondaryStoragePool = null;
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(vmName);

            secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI(
                    secondaryStoragePoolUrl);

            String ssPmountPath = secondaryStoragePool.getLocalPath();
View Full Code Here


    private Answer execute(SecurityGroupRulesCmd cmd) {
        String vif = null;
        String brname = null;
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            List<InterfaceDef> nics = getInterfaces(conn, cmd.getVmName());
            vif = nics.get(0).getDevName();
            brname = nics.get(0).getBrName();
        } catch (LibvirtException e) {
            return new SecurityGroupRuleAnswer(cmd, false, e.toString());
View Full Code Here

        return new Answer(cmd, result, "");
    }

    protected GetVncPortAnswer execute(GetVncPortCommand cmd) {
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getName());
            Integer vncPort = getVncPort(conn, cmd.getName());
            return new GetVncPortAnswer(cmd, _privateIp, 5900 + vncPort);
        } catch (LibvirtException e) {
            return new GetVncPortAnswer(cmd, e.toString());
        }
View Full Code Here

                result);
    }

    private Answer execute(AttachIsoCommand cmd) {
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            attachOrDetachISO(conn, cmd.getVmName(), cmd.getIsoPath(),
                    cmd.isAttach());
        } catch (LibvirtException e) {
            return new Answer(cmd, false, e.toString());
        } catch (URISyntaxException e) {
View Full Code Here

        return new Answer(cmd);
    }

    private AttachVolumeAnswer execute(AttachVolumeCommand cmd) {
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            KVMStoragePool primary = _storagePoolMgr.getStoragePool(
                    cmd.getPooltype(),
                    cmd.getPoolUuid());
            KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath());
            attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk,
View Full Code Here

        return State.Stopped;
    }

    private Answer execute(CheckVirtualMachineCommand cmd) {
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            final State state = getVmState(conn, cmd.getVmName());
            Integer vncPort = null;
            if (state == State.Running) {
                vncPort = getVncPort(conn, cmd.getVmName());
View Full Code Here

        }

        List<InterfaceDef> ifaces = null;

        Domain dm = null;
        Connect dconn = null;
        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.debug("Preparing host for migrating " + vm);
        }

        NicTO[] nics = vm.getNics();
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(vm.getName());
            for (NicTO nic : nics) {
                getVifDriver(nic.getType()).plug(nic, null);
            }

            /* setup disks, e.g for iso */
 
View Full Code Here

        synchronized (_vms) {
            _vms.put(cmd.getVmName(), State.Starting);
        }

        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            final String result = rebootVM(conn, cmd.getVmName());
            if (result == null) {
                Integer vncPort = null;
                try {
                    vncPort = getVncPort(conn, cmd.getVmName());
View Full Code Here

    protected GetVmDiskStatsAnswer execute(GetVmDiskStatsCommand cmd) {
        List<String> vmNames = cmd.getVmNames();
        try {
            HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsNameMap = new HashMap<String, List<VmDiskStatsEntry>>();
            Connect conn = LibvirtConnection.getConnection();
            for (String vmName : vmNames) {
                List<VmDiskStatsEntry> statEntry = getVmDiskStat(conn, vmName);
                if (statEntry == null) {
                    continue;
                }
View Full Code Here

TOP

Related Classes of org.libvirt.Connect

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.