From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKQRw-0006Bx-8J for qemu-devel@nongnu.org; Mon, 03 Mar 2014 05:50:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKQRn-0006Vc-RV for qemu-devel@nongnu.org; Mon, 03 Mar 2014 05:50:20 -0500 Received: from mail-qg0-x229.google.com ([2607:f8b0:400d:c04::229]:47511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKQRn-0006VY-My for qemu-devel@nongnu.org; Mon, 03 Mar 2014 05:50:11 -0500 Received: by mail-qg0-f41.google.com with SMTP id i50so10873245qgf.0 for ; Mon, 03 Mar 2014 02:50:11 -0800 (PST) Sender: Paolo Bonzini Message-ID: <53145E5D.30704@redhat.com> Date: Mon, 03 Mar 2014 11:50:05 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1393765632-2753-1-git-send-email-marcel.a@redhat.com> In-Reply-To: <1393765632-2753-1-git-send-email-marcel.a@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC V2 0/9] qemu-machine as a QOM object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, blauwirbel@gmail.com, mdroth@linux.vnet.ibm.com, mst@redhat.com, armbru@redhat.com, mtosatti@redhat.com, agraf@suse.de, ehabkost@redhat.com, lcapitulino@redhat.com, peter.crosthwaite@petalogix.com, quintela@redhat.com, aliguori@amazon.com, imammedo@redhat.com, scottwood@freescale.com, edgar.iglesias@gmail.com, afaerber@suse.de, rth@twiddle.net Il 02/03/2014 14:07, Marcel Apfelbaum ha scritto: > Most of the "Cc" list is due to patch 8: (Should I send each patch to a different list?) > machine-opts: replace qemu_opt_get by QOM QemuMachine queries. > > Status: > - machine_opts are mapped into QemuMachineState's properties, > which can be queried as regular QOM properties. > - Subclassing QemuMachineClass allows to add a command line > option specific to a machine type, error mechanism should > work if this option is used on another machine. (Not tested, on the todo list.) > - Next big step would be to completely remove the qemu machines initialization > and replace it by regular QOM type registration. Having seen all the series, I think we can plan the actual code as follows. Patches 1-3 are fine (except for the missing object_property_add_child in patch 3). Patch 4 is also fine, but it should refer to the embedded QEMUMachineInitArgs. The .machine field from QEMUMachineArgs can be removed very early. It can be replaced with the class of current_machine. Another early refactoring should be to pass ¤t_machine->init_args to machine->init, not the "args". Now here's a possible plan to get rid of QEMUMachineInitArgs: 1) Add three wrappers to QemuMachine for reading kernel_filename, kernel_cmdline, initrd_filename. Unlike object_property_get_str, they can skip the strdup of the value. This way you don't have to add the matching free to all uses of the fields. 2) Similarly, add get/set functions (not properties, since these are not accessible via -machine) for ram_size, boot_order, cpu_model. 3) Now you can have something like patch 8 in this series. 4) Thanks to the previous change, there should be no usage of QEMUMachineInitArgs anymore. Change the machine init function to take a "QemuMachineState *current_machine". 5) Remove the current_machine global. There will be few users of current_machine, and they can look at /machine instead, as mentioned in the review of patch 3. Does it look feasible? The bulk changes should all be fairly mechanical. Paolo