Skip to contentSkip to conversation

convert -m to QemuOpts

PATCH Applied Igor Mammedov 3 participants 12 messages Mar 6, 2014 – Apr 25, 2014

lore
Share & tools
lore
#0 lore raw

v4 cover convert -m to QemuOpts

changes since v3:
- fix not completed option renaming s/mem/size/

changes since v2 suggested by Andreas Färber:
- s/fprintf/error_report/
- rename 'mem' option to 'size'
- CCing to qemu-trivial

changes since v1:
- check for overflow
- check for empty mem="" case
- reshuffle code to avoid conflicts with another series on list
- some style/typo fixes

changes since RFC:
- resolved conflict with error_abort change
in qemu_get_machine_opts()

Igor Mammedov (1):
vl: convert -m to QemuOpts

Paolo Bonzini (1):
qemu-option: introduce qemu_find_opts_singleton

 include/qemu/config-file.h |    2 +
 qemu-options.hx            |    9 +++--
 util/qemu-config.c         |   14 +++++++
 vl.c                       |   82 +++++++++++++++++++++++++++++++-------------
 4 files changed, 80 insertions(+), 27 deletions(-)
#1 lore raw

PATCH v4 1/2 qemu-option: introduce qemu_find_opts_singleton

From: Paolo Bonzini <[email protected]>

---
 include/qemu/config-file.h |    2 ++
 util/qemu-config.c         |   14 ++++++++++++++
 vl.c                       |   11 +----------
 3 files changed, 17 insertions(+), 10 deletions(-)
include/qemu/config-file.h +2 -0
index dbd97c4..d4ba20e 100644
@@ -8,6 +8,8 @@
 
 QemuOptsList *qemu_find_opts(const char *group);
 QemuOptsList *qemu_find_opts_err(const char *group, Error **errp);
+QemuOpts *qemu_find_opts_singleton(const char *group);
+
 void qemu_add_opts(QemuOptsList *list);
 void qemu_add_drive_opts(QemuOptsList *list);
 int qemu_set_option(const char *str);
util/qemu-config.c +14 -0
index f610101..60051df 100644
@@ -39,6 +39,20 @@ QemuOptsList *qemu_find_opts(const char *group)
     return ret;
 }
 
+QemuOpts *qemu_find_opts_singleton(const char *group)
+{
+    QemuOptsList *list;
+    QemuOpts *opts;
+
+    list = qemu_find_opts(group);
+    assert(list);
+    opts = qemu_opts_find(list, NULL);
+    if (!opts) {
+        opts = qemu_opts_create(list, NULL, 0, &error_abort);
+    }
+    return opts;
+}
+
 static CommandLineParameterInfoList *query_option_descs(const QemuOptDesc *desc)
 {
     CommandLineParameterInfoList *param_list = NULL, *entry;
vl.c +1 -10
index 685a7a9..7eb3b73 100644
@@ -482,16 +482,7 @@ static QemuOptsList qemu_msg_opts = {
  */
 QemuOpts *qemu_get_machine_opts(void)
 {
-    QemuOptsList *list;
-    QemuOpts *opts;
-
-    list = qemu_find_opts("machine");
-    assert(list);
-    opts = qemu_opts_find(list, NULL);
-    if (!opts) {
-        opts = qemu_opts_create(list, NULL, 0, &error_abort);
-    }
-    return opts;
+    return qemu_find_opts_singleton("machine");
 }
 
 const char *qemu_get_vm_name(void)
Signature · 1 line
1.7.1
#2 lore raw

PATCH v4 2/2 vl: convert -m to QemuOpts

In reply to Igor Mammedov

Adds option to -m
"size" - startup memory amount

For compatibility with legacy CLI if suffix-less number is passed, it assumes amount in Mb.

Otherwise user is free to use suffixed number using suffixes b,k/K,M,G

---
v3:
- fix not completed renaming of 'mem' option to 'size'
v2:
- suggested by Andreas Färber <[email protected]>
* s/fprintf/error_report/
* rename 'mem' option to 'size'
- fix conflict with missing numa QemuOpts

---
 qemu-options.hx |    9 ++++--
 vl.c            |   71 ++++++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 63 insertions(+), 17 deletions(-)
qemu-options.hx +6 -3
index 56e5fdf..5e89e0d 100644
@@ -210,10 +210,13 @@ use is discouraged as it may be removed from future versions.
 ETEXI
 
 DEF("m", HAS_ARG, QEMU_OPTION_m,
-    "-m megs         set virtual RAM size to megs MB [default="
-    stringify(DEFAULT_RAM_SIZE) "]\n", QEMU_ARCH_ALL)
+    "-m [size=]megs\n"
+    "                configure guest RAM\n"
+    "                size: initial amount of guest memory (default: "
+    stringify(DEFAULT_RAM_SIZE) "MiB)\n",
+    QEMU_ARCH_ALL)
 STEXI
-@item -m @var{megs}
+@item -m [size=]@var{megs}
 @findex -m
 Set virtual RAM size to @var{megs} megabytes. Default is 128 MiB.  Optionally,
 a suffix of ``M'' or ``G'' can be used to signify a value in megabytes or
vl.c +57 -14

112 lines not on this page · raw message

Signature · 1 line
1.7.1
Reviewed-by on v4 2/2
#3 lore raw

Re: [Qemu-devel] [PATCH v4 2/2] vl: convert -m to QemuOpts

Am 06.03.2014 10:39, schrieb Igor Mammedov:

Quoted 11 lines

Adds option to -m
"size" - startup memory amount

For compatibility with legacy CLI if suffix-less number is passed, it assumes amount in Mb.

Otherwise user is free to use suffixed number using suffixes b,k/K,M,G

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw
In reply to Igor Mammedov

mjt,

Am 06.03.2014 10:39, schrieb Igor Mammedov:

Quoted 11 lines

Igor Mammedov (1):
vl: convert -m to QemuOpts

Paolo Bonzini (1):
qemu-option: introduce qemu_find_opts_singleton

 include/qemu/config-file.h |    2 +
 qemu-options.hx            |    9 +++--
 util/qemu-config.c         |   14 +++++++
 vl.c                       |   82 +++++++++++++++++++++++++++++++-------------
 4 files changed, 80 insertions(+), 27 deletions(-)

Since I believe you have a track record of reviewing and queuing such QemuOpts conversions, can you review and take this for 2.0 please?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
Quoted 1 line · On Thu, 06 Mar 2014 20:32:39 +0100 Andreas Färber <[email protected]> wrote:

mjt,

[...]

Quoted 2 lines

Since I believe you have a track record of reviewing and queuing such QemuOpts conversions, can you review and take this for 2.0 please?

ping

Quoted 7 lines

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Signature · 2 lines
Regards,
  Igor
#6 lore raw
Quoted 8 lines · Igor Mammedov
Quoted 1 line · On Thu, 06 Mar 2014 20:32:39 +0100 Andreas Färber <[email protected]> wrote:

mjt,

[...]

Quoted 2 lines

Since I believe you have a track record of reviewing and queuing such QemuOpts conversions, can you review and take this for 2.0 please?

ping

I'm really sorry for this. Somehow I thought to queue it PAST 2.0, not FOR 2.0.

Oh well.

/mjt

#8 lore raw
Quoted 8 lines · On Thu, 20 Mar 2014 20:21:14 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 2 lines · Igor Mammedov

Igor Mammedov (1):
vl: convert -m to QemuOpts

This patch (2/2) was mime-damaged, I had to edit it manually in order for it to apply. Please take a look at
http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-next
to verify it's okay.

I'm sorry for not providing link to git repo to pull from. I can't check because it looks like site is unreachable from my place.

here is git tree with patch rebased on top of today's tree to compare with/pull from:
https://github.com/imammedo/qemu/commits/qoptify-m.v4

https://github.com/imammedo/qemu/commit/548b68295bf4967b1dd950f6d84a88b782f17f41

Thanks,
Igor

Quoted 7 lines

Applied to -trivial.

Thanks,

/mjt

#9 lore raw
In reply to Michael Tokarev
Quoted 10 lines · On Thu, 20 Mar 2014 20:21:14 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 2 lines · Igor Mammedov

Igor Mammedov (1):
vl: convert -m to QemuOpts

This patch (2/2) was mime-damaged, I had to edit it manually in order for it to apply. Please take a look at
http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-next
to verify it's okay.

Applied to -trivial.

seeing your today's PULL trivial req,
it looks like this patch was lost from your queue, could you reapply it please?

Quoted 5 lines

Thanks,

/mjt

#10 lore raw
Quoted 12 lines · Igor Mammedov
Quoted 9 lines · On Thu, 20 Mar 2014 20:21:14 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 2 lines · Igor Mammedov

Igor Mammedov (1):
vl: convert -m to QemuOpts

This patch (2/2) was mime-damaged, I had to edit it manually in order for it to apply. Please take a look at
http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-next
to verify it's okay.

Quoted 4 lines
Quoted 1 line

Applied to -trivial.

seeing your today's PULL trivial req,
it looks like this patch was lost from your queue, could you reapply it please?

It isn't lost, it is waiting in a -next branch.
I just re-sent a previous pullreq which were targetted 2.0 but hasn't been applied for 2.0.

Other stuff (about 20 other patches) is waiting.

Thank you for the reminder. Having in mind my previous sloppery with this stuff it is good to be reminded again, to not repeat past mistakes!

/mjt