aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2015-10-19 16:23:39 +0200
committerWill Deacon <will.deacon@arm.com>2015-10-27 16:01:57 +0000
commit8a7163f3dbc77b3734ccf7cee0b79119379a2a2d (patch)
tree659ddc5d8b3082cdd7d80970464d7efb75884582
parent3695adeb227813d96d9c41850703fb53a23845eb (diff)
downloadkvmtool-8a7163f3dbc77b3734ccf7cee0b79119379a2a2d.tar.gz
kvmtool/run: append cfg.kernel_cmdline at the end of real_cmdline
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> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--builtin-run.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin-run.c b/builtin-run.c
index e0c87329..aa5eaad2 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;
@@ -607,10 +601,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,