Compare commits

..

11 Commits

Author SHA1 Message Date
aeb238f43c Bump version to 0.9.61 2023-02-08 10:08:05 -05:00
671a907236 Allow rename in disable state 2023-01-30 11:48:43 -05:00
e945fd8590 Remove bad casting to int in string compare 2023-01-01 13:55:10 -05:00
a49510ecc8 Bump version to 0.9.60 2022-12-06 15:42:55 -05:00
6d7730ab52 Disable RBD caching by default
Results in a massive (~2x) performance boost for random block I/O inside
VMs, and thus a worthwhile default change.
2022-12-05 17:56:59 -05:00
8135426973 Fix bad ref in example scripts 2022-11-18 12:54:28 -05:00
20d436a745 Update description 2022-11-16 22:48:40 -05:00
28f6819726 Fix up remaining bugs in Rinse test script 2022-11-16 13:32:24 -05:00
35c07f0384 Ensure transient dirs are cleaned up 2022-11-16 13:01:15 -05:00
6127387be4 Ensure swap is skipped during cleanup too 2022-11-16 12:52:24 -05:00
343d66875b Skip swap volumes during mounting 2022-11-16 12:42:28 -05:00
11 changed files with 55 additions and 43 deletions

View File

@ -1 +1 @@
0.9.59
0.9.61

View File

@ -1,5 +1,15 @@
## PVC Changelog
###### [v0.9.61](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.61)
* [provisioner] Fixes a bug in network comparison
* [api] Fixes a bug being unable to rename disabled VMs
###### [v0.9.60](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.60)
* [Provisioner] Cleans up several remaining bugs in the example scripts; they should all be valid now
* [Provisioner] Adjust default libvirt schema to disable RBD caching for a 2x+ performance boost
###### [v0.9.59](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.59)
* [API] Flips the mem(prov) and mem(free) selectors making mem(free) the default for "mem" and "memprov" explicit

View File

@ -398,7 +398,7 @@ class VMBuilderScript(VMBuilder):
if volume.get("source_volume") is not None:
continue
if volume.get("filesystem") is None:
if volume.get("filesystem") is None or volume.get("filesystem") == "swap":
continue
mapped_dst_volume = f"/dev/rbd/{dst_volume}"
@ -473,7 +473,7 @@ class VMBuilderScript(VMBuilder):
]
# We need to know our root disk for later GRUB-ing
root_disk = None
root_volume = None
for volume in volumes:
if volume["mountpoint"] == "/":
root_volume = volume
@ -725,6 +725,7 @@ GRUB_DISABLE_LINUX_UUID=false
if (
volume.get("source_volume") is None
and volume.get("filesystem") is not None
and volume.get("filesystem") != "swap"
):
# Unmount filesystem
retcode, stdout, stderr = pvc_common.run_os_command(

View File

@ -20,7 +20,7 @@
###############################################################################
# This script provides an example of a PVC provisioner script. It will create a
# standard VM config and install a RHEL-like OS using rinse.
# standard VM config and install a RHEL 8+ or similar OS using rinse.
# This script can thus be used as an example or reference implementation of a
# PVC provisioner script and expanded upon as required.
@ -398,7 +398,7 @@ class VMBuilderScript(VMBuilder):
if volume.get("source_volume") is not None:
continue
if volume.get("filesystem") is None:
if volume.get("filesystem") is None or volume.get("filesystem") == "swap":
continue
mapped_dst_volume = f"/dev/rbd/{dst_volume}"
@ -487,7 +487,7 @@ class VMBuilderScript(VMBuilder):
post_packages = ["cloud-init"]
# We need to know our root disk for later GRUB-ing
root_disk = None
root_volume = None
for volume in volumes:
if volume["mountpoint"] == "/":
root_volume = volume
@ -571,21 +571,6 @@ class VMBuilderScript(VMBuilder):
with open(hostname_file, "w") as fh:
fh.write("{}".format(vm_name))
# Fix the cloud-init.target since it's broken by default
cloudinit_target_file = "{}/etc/systemd/system/cloud-init.target".format(
temporary_directory
)
with open(cloudinit_target_file, "w") as fh:
# We lose our indent on these raw blocks to preserve the apperance of the files
# inside the VM itself
data = """[Install]
WantedBy=multi-user.target
[Unit]
Description=Cloud-init target
After=multi-user.target
"""
fh.write(data)
# Due to device ordering within the Libvirt XML configuration, the first Ethernet interface
# will always be on PCI bus ID 2, hence the name "ens2".
# Write a DHCP stanza for ens2
@ -682,11 +667,6 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=
# Set the timezone to UTC
os.system("ln -sf ../usr/share/zoneinfo/UTC /etc/localtime")
# Unmount the bound devfs and sysfs
os.system("umount {}/dev".format(temporary_directory))
os.system("umount {}/sys".format(temporary_directory))
os.system("umount {}/proc".format(temporary_directory))
def cleanup(self):
"""
cleanup(): Perform any cleanup required due to prepare()/install()
@ -700,6 +680,7 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=
"""
# Run any imports first
import os
from pvcapid.vmbuilder import open_zk
from pvcapid.Daemon import config
import daemon_lib.common as pvc_common
@ -708,6 +689,11 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=
# Set the tempdir we used in the prepare() and install() steps
temp_dir = "/tmp/target"
# Unmount the bound devfs and sysfs
os.system(f"umount {temp_dir}/dev")
os.system(f"umount {temp_dir}/sys")
os.system(f"umount {temp_dir}/proc")
# Use this construct for reversing the list, as the normal reverse() messes with the list
for volume in list(reversed(self.vm_data["volumes"])):
dst_volume_name = f"{self.vm_name}_{volume['disk_id']}"
@ -718,6 +704,7 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=
if (
volume.get("source_volume") is None
and volume.get("filesystem") is not None
and volume.get("filesystem") != "swap"
):
# Unmount filesystem
retcode, stdout, stderr = pvc_common.run_os_command(
@ -728,14 +715,14 @@ GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=
f"Failed to unmount '{mapped_dst_volume}' on '{mount_path}': {stderr}"
)
# Unmap volume
with open_zk(config) as zkhandler:
success, message = pvc_ceph.unmap_volume(
zkhandler,
volume["pool"],
dst_volume_name,
)
if not success:
raise ProvisioningError(
f"Failed to unmap '{mapped_dst_volume}': {stderr}"
)
# Unmap volume
with open_zk(config) as zkhandler:
success, message = pvc_ceph.unmap_volume(
zkhandler,
volume["pool"],
dst_volume_name,
)
if not success:
raise ProvisioningError(
f"Failed to unmap '{mapped_dst_volume}': {stderr}"
)

View File

@ -27,7 +27,7 @@ from ssl import SSLContext, TLSVersion
from distutils.util import strtobool as dustrtobool
# Daemon version
version = "0.9.59"
version = "0.9.61"
# API version
API_VERSION = 1.0

View File

@ -100,7 +100,7 @@ devices_scsi_controller = """ <controller type='scsi' index='0' model='virtio
# * vm_name
# * disk_id
devices_disk_header = """ <disk type='network' device='disk'>
<driver name='qemu' discard='unmap'/>
<driver name='qemu' discard='unmap' cache='none'/>
<target dev='{disk_id}' bus='scsi'/>
<auth username='libvirt'>
<secret type='ceph' uuid='{ceph_storage_secret}'/>

View File

@ -580,7 +580,7 @@ def delete_template_network_element(name, vni):
networks, code = list_template_network_vnis(name)
found_vni = False
for network in networks:
if network["vni"] == int(vni):
if network["vni"] == vni:
found_vni = True
if not found_vni:
retmsg = {

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name="pvc",
version="0.9.59",
version="0.9.61",
packages=["pvc", "pvc.cli_lib"],
install_requires=[
"Click",

View File

@ -644,7 +644,7 @@ def rename_vm(zkhandler, domain, new_domain):
# Verify that the VM is in a stopped state; renaming is not supported otherwise
state = zkhandler.read(("domain.state", dom_uuid))
if state != "stop":
if state not in ["stop", "disable"]:
return (
False,
'ERROR: VM "{}" is not in stopped state; VMs cannot be renamed while running.'.format(

14
debian/changelog vendored
View File

@ -1,3 +1,17 @@
pvc (0.9.61-0) unstable; urgency=high
* [provisioner] Fixes a bug in network comparison
* [api] Fixes a bug being unable to rename disabled VMs
-- Joshua M. Boniface <joshua@boniface.me> Wed, 08 Feb 2023 10:08:05 -0500
pvc (0.9.60-0) unstable; urgency=high
* [Provisioner] Cleans up several remaining bugs in the example scripts; they should all be valid now
* [Provisioner] Adjust default libvirt schema to disable RBD caching for a 2x+ performance boost
-- Joshua M. Boniface <joshua@boniface.me> Tue, 06 Dec 2022 15:42:55 -0500
pvc (0.9.59-0) unstable; urgency=high
* [API] Flips the mem(prov) and mem(free) selectors making mem(free) the default for "mem" and "memprov" explicit

View File

@ -48,7 +48,7 @@ import re
import json
# Daemon version
version = "0.9.59"
version = "0.9.61"
##########################################################