def init_host(self):
        """Initialization for a standalone compute service."""
        self.driver.init_host(host=self.host)
        context = nova.context.get_admin_context()
        instances = self.db.instance_get_all_by_host(context, self.host)
        for instance in instances:
            inst_name = instance['name']
            db_state = instance['power_state']
            drv_state = self._get_power_state(context, instance)

            expect_running = db_state == power_state.RUNNING \
                             and drv_state != db_state

            LOG.debug(_('Current state of %(inst_name)s is %(drv_state)s, '
                        'state in DB is %(db_state)s.'), locals())

            if (expect_running and FLAGS.resume_guests_state_on_host_boot)\
               or FLAGS.start_guests_on_host_boot:
                LOG.info(_('Rebooting instance %(inst_name)s after '
                            'nova-compute restart.'), locals())
                self.reboot_instance(context, instance['id'])
            elif drv_state == power_state.RUNNING:
                # Hyper-V and VMWareAPI drivers will raise and exception
                try:
                    net_info = self._get_instance_nw_info(context, instance)
                    self.driver.ensure_filtering_rules_for_instance(instance,
                                                                    net_info)
                except __HOLE__:
                    LOG.warning(_('Hypervisor driver does not '
                            'support firewall rules'))
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/compute/manager.py/ComputeManager.init_host