[PATCH kvmtool 01/10] builtin-run: Treat specifying both --kernel and --firmware as an error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the user specifies both the --kernel and the --firmware arguments,
--firmware takes precedence and --kernel is silently ignored. Since kvmtool
has no way of knowing what the user really intended, and guessing that
--firmware is the right argument might prove to be quite unexpected for the
user, be vocal about the incompatibility and refuse to create the VM.

Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
---
 builtin-run.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin-run.c b/builtin-run.c
index 7f93b9d9312c..8bb8051680b1 100644
--- a/builtin-run.c
+++ b/builtin-run.c
@@ -513,6 +513,9 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
 
 	kvm->nr_disks = kvm->cfg.image_count;
 
+	if (kvm->cfg.kernel_filename && kvm->cfg.firmware_filename)
+		die("Only one of --kernel or --firmware can be specified");
+
 	if (!kvm->cfg.kernel_filename && !kvm->cfg.firmware_filename) {
 		kvm->cfg.kernel_filename = find_kernel();
 
-- 
2.31.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux