From: Michael Goldish <mgoldish@redhat.com>
To: Feng Yang <fyang@redhat.com>
Cc: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [KVM-AUTOTEST PATCH] KVM test: use command line option wrapper functions
Date: Thu, 20 May 2010 12:50:37 +0300 [thread overview]
Message-ID: <4BF505ED.6000801@redhat.com> (raw)
In-Reply-To: <1194881134.779571274257507638.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
On 05/19/2010 11:25 AM, Feng Yang wrote:
> Hi, Michael
>
> Thanks for your patch.
> We plan add "netdev" parameter support in make_qemu_command. Since you are working on this part. Could you add netdev support in your patch? hopeful netdev can be default supported in make_qemu_command if qemu support it. Thanks very much!
Sure, I'll look into it.
> I think the point of this patch is good and we need this kinds of patch.
> But I think we need not add so many new function. Especially some function only directly return the string and do nothing more.
> This will increase the function call consumption.
>
>
> ----- "Michael Goldish" <mgoldish@redhat.com> wrote:
>
>> From: "Michael Goldish" <mgoldish@redhat.com>
>> To: autotest@test.kernel.org, kvm@vger.kernel.org
>> Cc: "Michael Goldish" <mgoldish@redhat.com>
>> Sent: Monday, May 17, 2010 9:29:35 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
>> Subject: [KVM-AUTOTEST PATCH] KVM test: use command line option wrapper functions
>>
>> In order to support multiple versions of qemu which use different
>> command line
>> options or syntaxes, wrap all command line options in small helper
>> functions,
>> which append text to the command line according to the output of 'qemu
>> -help'.
>>
>> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
>> ---
>> client/tests/kvm/kvm_vm.py | 198
>> ++++++++++++++++++++++++++++++--------------
>> 1 files changed, 135 insertions(+), 63 deletions(-)
>>
>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>> index 047505a..94bacdf 100755
>> --- a/client/tests/kvm/kvm_vm.py
>> +++ b/client/tests/kvm/kvm_vm.py
>> @@ -186,12 +186,100 @@ class VM:
>> nic_model -- string to pass as 'model' parameter for
>> this
>> NIC (e.g. e1000)
>> """
>> - if name is None:
>> - name = self.name
>> - if params is None:
>> - params = self.params
>> - if root_dir is None:
>> - root_dir = self.root_dir
>> + # Helper function for command line option wrappers
>> + def has_option(help, option):
>> + return bool(re.search(r"^-%s(\s|$)" % option, help,
>> re.MULTILINE))
>> +
>> + # Wrappers for all supported qemu command line parameters.
>> + # This is meant to allow support for multiple qemu versions.
>> + # Each of these functions receives the output of 'qemu -help'
>> as a
>> + # parameter, and should add the requested command line
>> option
>> + # accordingly.
>> +
>> + def add_name(help, name):
>> + return " -name '%s'" % name
>
> I think we need not add so many new function. Especially some function only directly return the string and do nothing more.
> This will increase the function call consumption.
>
>> +
>> + def add_unix_socket_monitor(help, filename):
>> + return " -monitor unix:%s,server,nowait" % filename
> Same as above
>> +
>> + def add_mem(help, mem):
>> + return " -m %s" % mem
> Same as above
>> +
>> + def add_smp(help, smp):
>> + return " -smp %s" % smp
> Same as above.
All these helper functions are meant to be extended and modified in the
future. They're only there to minimize future effort involved in adding
support for new command line syntaxes.
Right now add_smp() just returns " -smp %s", but in the future we may
have to support different syntaxes for -smp, and then add_smp() will
consult the output of 'qemu -help' and return the proper string.
What do you mean by function call consumption? I don't think these
functions cause a measurable slowdown, and make_qemu_command() is called
very few times, so this really isn't a concern IMO.
next prev parent reply other threads:[~2010-05-20 9:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1112938281.779511274257387855.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-05-19 8:25 ` [KVM-AUTOTEST PATCH] KVM test: use command line option wrapper functions Feng Yang
2010-05-20 9:50 ` Michael Goldish [this message]
2010-05-20 10:57 ` Lucas Meneghel Rodrigues
[not found] <1160970060.953181274407267225.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-05-21 2:03 ` Feng Yang
2010-05-17 13:29 [KVM-AUTOTEST PATCH] KVM test: formatting improvements to scan_results.py Michael Goldish
2010-05-17 13:29 ` [KVM-AUTOTEST PATCH] KVM test: make use of tcpdump optional Michael Goldish
2010-05-17 13:29 ` [KVM-AUTOTEST PATCH] KVM test: use command line option wrapper functions Michael Goldish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BF505ED.6000801@redhat.com \
--to=mgoldish@redhat.com \
--cc=autotest@test.kernel.org \
--cc=fyang@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).