From: Oleg Nesterov <oleg@redhat.com>
To: Pekka Enberg <penberg@kernel.org>,
Sasha Levin <sasha.levin@oracle.com>,
Will Deacon <will.deacon@arm.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH] kvmtool/run: append cfg.kernel_cmdline at the end of real_cmdline
Date: Mon, 19 Oct 2015 16:23:39 +0200 [thread overview]
Message-ID: <20151019142339.GA21322@redhat.com> (raw)
This allows the user to always override the paramaters set by lkvm.
Say, currently 'lkvm run -p ro' doesn't work.
To keep the current logic we need to change strstr("root=") to check
cfg.kernel_cmdline, not real_cmdline. And perhaps we can even add a
simple helper add_param(name, val) to make this all more consistent;
it should only append "name=val" to real_cmdline if cfg.kernel_cmdline
doesn't include this paramater.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
builtin-run.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/builtin-run.c b/builtin-run.c
index 3da00da..ab1fc2a 100644
--- a/builtin-run.c
+++ b/builtin-run.c
@@ -566,12 +566,6 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
memset(real_cmdline, 0, sizeof(real_cmdline));
kvm__arch_set_cmdline(real_cmdline, kvm->cfg.vnc || kvm->cfg.sdl || kvm->cfg.gtk);
- if (strlen(real_cmdline) > 0)
- strcat(real_cmdline, " ");
-
- if (kvm->cfg.kernel_cmdline)
- strlcat(real_cmdline, kvm->cfg.kernel_cmdline, sizeof(real_cmdline));
-
if (!kvm->cfg.guest_name) {
if (kvm->cfg.custom_rootfs) {
kvm->cfg.guest_name = kvm->cfg.custom_rootfs_name;
@@ -611,10 +605,15 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
if (kvm_setup_guest_init(kvm->cfg.custom_rootfs_name))
die("Failed to setup init for guest.");
}
- } else if (!strstr(real_cmdline, "root=")) {
+ } else if (!strstr(kvm->cfg.kernel_cmdline, "root=")) {
strlcat(real_cmdline, " root=/dev/vda rw ", sizeof(real_cmdline));
}
+ if (kvm->cfg.kernel_cmdline) {
+ strcat(real_cmdline, " ");
+ strlcat(real_cmdline, kvm->cfg.kernel_cmdline, sizeof(real_cmdline));
+ }
+
kvm->cfg.real_cmdline = real_cmdline;
printf(" # %s run -k %s -m %Lu -c %d --name %s\n", KVM_BINARY_NAME,
--
2.4.3
reply other threads:[~2015-10-19 14:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20151019142339.GA21322@redhat.com \
--to=oleg@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=sasha.levin@oracle.com \
--cc=will.deacon@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.