From patchwork Mon Nov 15 14:31:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 325222 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAFEVl4M005342 for ; Mon, 15 Nov 2010 14:31:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932486Ab0KOObc (ORCPT ); Mon, 15 Nov 2010 09:31:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757452Ab0KOObQ (ORCPT ); Mon, 15 Nov 2010 09:31:16 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVDje025901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Nov 2010 09:31:13 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVCGl026343; Mon, 15 Nov 2010 09:31:13 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 49A6018D491; Mon, 15 Nov 2010 16:31:10 +0200 (IST) From: Gleb Natapov To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, blauwirbel@gmail.com, armbru@redhat.com, alex.williamson@redhat.com, mst@redhat.com, kevin@koconnor.net Subject: [PATCHv5 14/15] Add notifier that will be called when machine is fully created. Date: Mon, 15 Nov 2010 16:31:08 +0200 Message-Id: <1289831469-25540-15-git-send-email-gleb@redhat.com> In-Reply-To: <1289831469-25540-1-git-send-email-gleb@redhat.com> References: <1289831469-25540-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 15 Nov 2010 14:31:49 +0000 (UTC) diff --git a/sysemu.h b/sysemu.h index 48f8eee..c42f33a 100644 --- a/sysemu.h +++ b/sysemu.h @@ -60,6 +60,8 @@ void qemu_system_reset(void); void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); +void qemu_add_machine_init_done_notifier(Notifier *notify); + void do_savevm(Monitor *mon, const QDict *qdict); int load_vmstate(const char *name); void do_delvm(Monitor *mon, const QDict *qdict); diff --git a/vl.c b/vl.c index e8ada75..918d988 100644 --- a/vl.c +++ b/vl.c @@ -253,6 +253,9 @@ static void *boot_set_opaque; static NotifierList exit_notifiers = NOTIFIER_LIST_INITIALIZER(exit_notifiers); +static NotifierList machine_init_done_notifiers = + NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); + int kvm_allowed = 0; uint32_t xen_domid; enum xen_mode xen_mode = XEN_EMULATE; @@ -1778,6 +1781,16 @@ static void qemu_run_exit_notifiers(void) notifier_list_notify(&exit_notifiers); } +void qemu_add_machine_init_done_notifier(Notifier *notify) +{ + notifier_list_add(&machine_init_done_notifiers, notify); +} + +static void qemu_run_machine_init_done_notifiers(void) +{ + notifier_list_notify(&machine_init_done_notifiers); +} + static const QEMUOption *lookup_opt(int argc, char **argv, const char **poptarg, int *poptind) { @@ -3023,6 +3036,8 @@ int main(int argc, char **argv, char **envp) exit(1); } + qemu_run_machine_init_done_notifiers(); + qemu_system_reset(); if (loadvm) { if (load_vmstate(loadvm) < 0) {