From e2ceadc1b70491be24b7592802db75c3c9f29ed8 Mon Sep 17 00:00:00 2001 From: reyk Date: Mon, 1 Oct 2018 09:31:15 +0000 Subject: Try to derive the qcow2 file format from an image file automatically. This makes the "-d qcow2:" and "format qcow" arguments optional as vmctl and vmd will read the magic bytes at the beginning of a file to guess if it is a raw or a qcow image file. The "vmctl create" command has been changed by removing the -f qcow2 option and replacing it with the same syntax as -d: "vmctl create qcow2:foo.img". In a slightly ununixy but intended way, the create command now also considers the file extension for the format as "vmctl create foo.qcow2" creates a qcow2 disk and not a raw image file. Ok mlarkin@ (and ccardenas@ on an earlier version of the diff) --- usr.sbin/vmd/vmd.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'usr.sbin/vmd/vmd.h') diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h index 4cf0295d946..b348d12c757 100644 --- a/usr.sbin/vmd/vmd.h +++ b/usr.sbin/vmd/vmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.h,v 1.80 2018/09/28 12:35:32 reyk Exp $ */ +/* $OpenBSD: vmd.h,v 1.81 2018/10/01 09:31:15 reyk Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -67,6 +67,9 @@ #define VMD_CDROM_MISSING 1005 #define VMD_CDROM_INVALID 1006 +/* Image file signatures */ +#define VM_MAGIC_QCOW "QFI\xfb" + /* 100.64.0.0/10 from rfc6598 (IPv4 Prefix for Shared Address Space) */ #define VMD_DHCP_PREFIX "100.64.0.0/10" -- cgit v1.2.3-59-g8ed1b