Package com.cloud.agent.api

Examples of com.cloud.agent.api.HostVmStateReportEntry


                final PowerState state = convertToPowerState(ps);

                s_logger.trace("VM " + dm.getName() + ": powerstate = " + ps
                        + "; vm state=" + state.toString());
                String vmName = dm.getName();
                vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null));
            } catch (final LibvirtException e) {
                s_logger.warn("Unable to get vms", e);
            } finally {
                try {
                    if (dm != null) {
                        dm.free();
                    }
                } catch (LibvirtException e) {
                    s_logger.trace("Ignoring libvirt error.", e);
                }
            }
        }

        for (int i = 0; i < vms.length; i++) {
            try {

                dm = conn.domainLookupByName(vms[i]);

                DomainInfo.DomainState ps = dm.getInfo().state;
                final PowerState state = convertToPowerState(ps);
                String vmName = dm.getName();
                s_logger.trace("VM " + vmName + ": powerstate = " + ps
                        + "; vm state=" + state.toString());

                vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null));
            } catch (final LibvirtException e) {
                s_logger.warn("Unable to get vms", e);
            } finally {
                try {
                    if (dm != null) {
View Full Code Here


                        name = VMInternalCSName;

                    if (!isTemplate) {
                        newStates.put(
                                name,
                                new HostVmStateReportEntry(convertPowerState(powerState), hyperHost.getHyperHostName(), null)
                                );
                    }
                }
            }
        }
View Full Code Here

                }

                if (host_uuid.equalsIgnoreCase(_host.uuid)) {
                    vmStates.put(
                            record.nameLabel,
                            new HostVmStateReportEntry(convertPowerState(ps), host_uuid)
                            );
                }
            }
        }
View Full Code Here

    protected HashMap<String, HostVmStateReportEntry> getHostVmStateReport() throws XmlRpcException {
        final HashMap<String, HostVmStateReportEntry> vmStates = new HashMap<String, HostVmStateReportEntry>();
        Map<String, String> vms = OvmHost.getAllVms(_conn);
        for (final Map.Entry<String, String> entry : vms.entrySet()) {
            PowerState state = toPowerState(entry.getKey(), entry.getValue());
            vmStates.put(entry.getKey(), new HostVmStateReportEntry(state, _conn.getIp()));
        }
        return vmStates;
    }
View Full Code Here

                // TODO : for XS/KVM (host-based resource), we require to remove
                // VM completely from host, for some reason, KVM seems to still keep
                // Stopped VM around, to work-around that, reporting only powered-on VM
                //
                if (state == PowerState.PowerOn)
                    vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName()));
            } catch (final LibvirtException e) {
                s_logger.warn("Unable to get vms", e);
            } finally {
                try {
                    if (dm != null) {
                        dm.free();
                    }
                } catch (LibvirtException e) {
                    s_logger.trace("Ignoring libvirt error.", e);
                }
            }
        }

        for (int i = 0; i < vms.length; i++) {
            try {

                dm = conn.domainLookupByName(vms[i]);

                DomainInfo.DomainState ps = dm.getInfo().state;
                final PowerState state = convertToPowerState(ps);
                String vmName = dm.getName();
                s_logger.trace("VM " + vmName + ": powerstate = " + ps + "; vm state=" + state.toString());

                // TODO : for XS/KVM (host-based resource), we require to remove
                // VM completely from host, for some reason, KVM seems to still keep
                // Stopped VM around, to work-around that, reporting only powered-on VM
                //
                if (state == PowerState.PowerOn)
                    vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName()));
            } catch (final LibvirtException e) {
                s_logger.warn("Unable to get vms", e);
            } finally {
                try {
                    if (dm != null) {
View Full Code Here

                    if (VMInternalCSName != null)
                        name = VMInternalCSName;

                    if (!isTemplate) {
                        newStates.put(name, new HostVmStateReportEntry(convertPowerState(powerState), hyperHost.getHyperHostName()));
                    }
                }
            }
        }
        return newStates;
View Full Code Here

            return null;
        }

        for (Map<String, String> vmMap : vmList) {
            String name = (String)vmMap.keySet().toArray()[0];
            vmStates.put(name, new HostVmStateReportEntry(PowerState.valueOf(vmMap.get(name)), _guid));
        }
        return vmStates;
    }
View Full Code Here

        if (hostId != null) {
            final List<? extends VMInstanceVO> vms = vmDao.listByHostId(hostId);
            for (VMInstanceVO vm : vms) {
                states.put(
                    vm.getInstanceName(),
                    new HostVmStateReportEntry(
                        vm.getState() == State.Running ? PowerState.PowerOn : PowerState.PowerOff, "host-" + hostId
                    )
                );
            }
        }
View Full Code Here

    protected HashMap<String, HostVmStateReportEntry> getHostVmStateReport() {
        HashMap<String, HostVmStateReportEntry> report = new HashMap<String, HostVmStateReportEntry>();

        for (String vmName : _runningVms.keySet()) {
            report.put(vmName, new HostVmStateReportEntry(PowerState.PowerOn, agentHost.getName()));
        }

        return report;
    }
View Full Code Here

                        name = VMInternalCSName;

                    if (!isTemplate) {
                        newStates.put(
                                name,
                                new HostVmStateReportEntry(convertPowerState(powerState), hyperHost.getHyperHostName(), null)
                                );
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.HostVmStateReportEntry

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.