예제 #1
0
    def host_service_configured(self, service):
        """
        Returns whether a host service is configured or not
        """
        kubernetes_config = True
        if not os.path.isfile('/etc/kubernetes/admin.conf'):
            kubernetes_config = False

        configured = True

        if kubernetes_config:
            if service == HOST_SERVICES.COMPUTE:
                configured = (not nfvi.nfvi_compute_plugin_disabled()
                              and self._nfvi_host.openstack_compute)
            elif service == HOST_SERVICES.NETWORK:
                configured = (not nfvi.nfvi_network_plugin_disabled()
                              and self._nfvi_host.openstack_compute)
            elif service == HOST_SERVICES.GUEST:
                configured = (not nfvi.nfvi_guest_plugin_disabled()
                              and self._nfvi_host.openstack_compute)
            elif service != HOST_SERVICES.CONTAINER:
                DLOG.error("unknown service %s" % service)
                configured = False
        else:
            if service == HOST_SERVICES.CONTAINER:
                configured = False

        DLOG.verbose("Host configure check for service %s, result %s" %
                     (service, configured))

        return configured
예제 #2
0
def vim_nfvi_events_initialize():
    """
    Initialize listening for nfvi events
    """
    nfvi.nfvi_register_host_add_callback(_nfvi_host_add_callback)

    nfvi.nfvi_register_host_action_callback(_nfvi_host_action_callback)

    nfvi.nfvi_register_host_state_change_callback(
        _nfvi_host_state_change_callback)

    nfvi.nfvi_register_host_get_callback(_nfvi_host_get_callback)

    nfvi.nfvi_register_host_upgrade_callback(_nfvi_host_upgrade_callback)

    nfvi.nfvi_register_host_update_callback(_nfvi_host_update_callback)

    nfvi.nfvi_register_host_notification_callback(
        _nfvi_host_notification_callback)

    if not nfvi.nfvi_compute_plugin_disabled():
        nfvi.nfvi_register_instance_state_change_callback(
            _nfvi_instance_state_change_callback)

        nfvi.nfvi_register_instance_action_change_callback(
            _nfvi_instance_action_change_callback)

        nfvi.nfvi_register_instance_action_callback(
            _nfvi_instance_action_callback)

        nfvi.nfvi_register_instance_delete_callback(
            _nfvi_instance_delete_callback)

    if not nfvi.nfvi_guest_plugin_disabled():
        nfvi.nfvi_register_host_services_query_callback(
            _nfvi_host_services_query_callback)

        nfvi.nfvi_register_guest_services_query_callback(
            _nfvi_guest_services_query_callback)

        nfvi.nfvi_register_guest_services_state_notify_callback(
            _nfvi_guest_services_state_notify_callback)

        nfvi.nfvi_register_guest_services_alarm_notify_callback(
            _nfvi_guest_services_alarm_notify_callback)

        nfvi.nfvi_register_guest_services_action_notify_callback(
            _nfvi_guest_services_action_notify_callback)

    timers.timers_register_interval_timers([_nfvi_periodic_timer_event])
예제 #3
0
def vim_nfvi_audits_initialize():
    """
    Initialize nfvi audits
    """
    audits = list()

    audits.append(_audit_nfvi)

    if not nfvi.nfvi_compute_plugin_disabled():
        audits.append(_audit_nfvi_instance)
        audits.append(_audit_nfvi_hypervisor_details)
        audits.append(_audit_nfvi_instance_type_details)

    if not nfvi.nfvi_block_storage_plugin_disabled():
        audits.append(_audit_nfvi_volume)

    if not nfvi.nfvi_guest_plugin_disabled():
        audits.append(_audit_nfvi_guest_services)

    timers.timers_register_interval_timers(audits)