summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2018-10-08 16:32:02 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2018-10-08 16:32:02 +0000
commit7d1fb9b21014f5228785a590c2a168ee1a37cbf9 (patch)
tree93ad71dcb2ca88cb98cd4028cf7d55c09a03eee0 /regress/usr.sbin
parentc92abada57222b3de4c40244b747671a838884db (diff)
Add support for qcow2 base images (external snapshots).
This works is from Ori Bernstein, committing on his behalf: Add support to vmd for external snapshots. That is, snapshots that are derived from a base image. Data lookups start in the derived image, and if the derived image does not contain some data, the search proceeds ot the base image. Multiple derived images may exist off of a single base image. A limitation of this format is that modifying the base image will corrupt the derived image. This change also adds support for creating disk derived disk images to vmctl. To use it: vmctl create derived.qcow2 -s 16G -b base.qcow2 From Ori Bernstein OK mlarkin@ reyk@
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/vmd/diskfmt/Makefile7
-rw-r--r--regress/usr.sbin/vmd/diskfmt/vioscribble.c10
2 files changed, 11 insertions, 6 deletions
diff --git a/regress/usr.sbin/vmd/diskfmt/Makefile b/regress/usr.sbin/vmd/diskfmt/Makefile
index c2a5f42d5f6..33ac4c6cf18 100644
--- a/regress/usr.sbin/vmd/diskfmt/Makefile
+++ b/regress/usr.sbin/vmd/diskfmt/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2018/09/09 04:25:32 ccardenas Exp $
+# $OpenBSD: Makefile,v 1.2 2018/10/08 16:32:01 reyk Exp $
# This regression test creates a raw disk image and a
# qcow disk image, and scribbles the same data to both
@@ -11,7 +11,7 @@
VMD_DIR=$(BSDSRCDIR)/usr.sbin/vmd/
PROG=vioscribble
-SRCS=vioscribble.c $(VMD_DIR)/vioqcow2.c $(VMD_DIR)/vioraw.c
+SRCS=vioscribble.c vioqcow2.c vioraw.c
CFLAGS+=-I$(VMD_DIR) -pthread
LDFLAGS+=-pthread
@@ -26,3 +26,6 @@ scribble-images:
.PHONY: ${REGRESS_TARGETS} scribble-images
.include <bsd.regress.mk>
+
+vioqcow2.c vioraw.c: $(VMD_DIR)/vioqcow2.c $(VMD_DIR)/vioraw.c
+ cp $(VMD_DIR)/vioqcow2.c $(VMD_DIR)/vioraw.c .
diff --git a/regress/usr.sbin/vmd/diskfmt/vioscribble.c b/regress/usr.sbin/vmd/diskfmt/vioscribble.c
index 14d720db652..0152b8d4bb4 100644
--- a/regress/usr.sbin/vmd/diskfmt/vioscribble.c
+++ b/regress/usr.sbin/vmd/diskfmt/vioscribble.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioscribble.c,v 1.1 2018/09/09 04:25:32 ccardenas Exp $ */
+/* $OpenBSD: vioscribble.c,v 1.2 2018/10/08 16:32:01 reyk Exp $ */
/*
* Copyright (c) 2018 Ori Bernstein <ori@eigenstate.org>
@@ -122,16 +122,18 @@ main(int argc, char **argv)
verbose = !!getenv("VERBOSE");
qcfd = open("scribble.qc2", O_RDWR);
rawfd = open("scribble.raw", O_RDWR);
- if (qcfd == -1 || virtio_init_qcow2(&qcowfile, &qcsz, qcfd) == -1)
+ if (qcfd == -1)
err(1, "unable to open qcow");
- if (rawfd == -1 || virtio_init_raw(&rawfile, &rawsz, rawfd) == -1)
+ if (virtio_init_qcow2(&qcowfile, &qcsz, &qcfd, 1) == -1)
+ err(1, "unable to init qcow");
+ if (rawfd == -1 || virtio_init_raw(&rawfile, &rawsz, &rawfd, 1) == -1)
err(1, "unable to open raw");
srandom_deterministic(123);
/* scribble to both disks */
printf("scribbling...\n");
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 1024*16; i++) {
off = (random() % DISKSZ);
len = random() % sizeof buf + 1;
fill(off, buf, sizeof buf);