diff options
Diffstat (limited to 'subplot/subplot.py')
-rw-r--r-- | subplot/subplot.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/subplot/subplot.py b/subplot/subplot.py index c9c3cdc..1570d27 100644 --- a/subplot/subplot.py +++ b/subplot/subplot.py @@ -11,14 +11,23 @@ def create_vm(ctx): QemuSystem = globals()["QemuSystem"] srcdir = globals()["srcdir"] - name = "debian-ansible-test" - base_image = "/home/liw/tmp/debian-10-openstack-amd64.qcow2" + MiB = 1024 ** 2 GiB = 1024 ** 3 - disk_size = 10 * GiB + + cfg = yaml.safe_load(open(os.path.join(srcdir, "test.cfg"))) + name = cfg["name"] + base_image = cfg["base_image"] + username = cfg["username"] + cpus = cfg["cpus"] + memory = cfg["memory"] * MiB + + # We use a hard-coded test key that we have in the source tree. pubkey = open(os.path.join(srcdir, "ssh", "id.pub")).read().strip() - memory = 1 * GiB - cpus = 2 - username = "debian" + + # We hard code the disk image size, since we don't expect scenarios to have + # any specific size needs, and also, the qcow2 image format is only as big + # as the data put into the disk, so we can choose a size that fits all. + disk_size = 10 * GiB logging.info("starting a VM using qemu-system") logging.info(f" name : {name}") |