Compare commits

...

18 Commits

Author SHA1 Message Date
6e83300d78 Increase ipmi plugin timeout 2023-10-04 19:21:59 -04:00
522da3fd95 Adjust wording for volume create too 2023-10-03 09:42:23 -04:00
3a1bf0724e Mention file_size as bytes 2023-10-03 09:39:19 -04:00
ee494fb1c0 Adjust the help text of storage pools
Makes some places clearer, cleans up cruft, and adds references to the
main documentation as required.
2023-10-02 11:46:12 -04:00
c6c44bf775 Bump version to 0.9.78 2023-09-30 12:57:55 -04:00
bbb940da65 Remove spurious comments 2023-09-30 12:37:58 -04:00
a0b45a2bcd Always create RBDs with bytes value
Converting into human results in imprecise values when specifying bytes
directly, which in turn breaks VMDK image uploads. Instead, just use the
raw bytes value when creating the volume instead of converting it back.
2023-09-30 12:37:43 -04:00
35e27f79ef Fix uploading of non-raw image files
Adds a new API query parameter to define the file size, which is then
used for the temporary image. This is required for, at least VMDK, files
to work properly in qemu-img convert.
2023-09-29 16:19:22 -04:00
ad2e7750ff Fix output path and print message 2023-09-21 02:32:53 -04:00
7c0f12750e Bump version to 0.9.77 2023-09-19 11:05:55 -04:00
1c68e83d98 Fix bad refs to etree library 2023-09-19 11:05:19 -04:00
51e78480fa Bump version to 0.9.76 2023-09-18 10:15:52 -04:00
c4397219da Ensure fencing states are properly reflected 2023-09-18 09:59:18 -04:00
f46bfc962f Bump version to 0.9.75 2023-09-16 23:06:38 -04:00
714d4b6005 Revert float conversion of cpu_cores
Results in much uglier output, there are no decimal core counts.
2023-09-16 23:06:07 -04:00
fa8329ac3d Explicitly round load avg in load plugin 2023-09-16 22:58:49 -04:00
457b7bed3d Handle exceptions in fence migrations 2023-09-16 22:56:09 -04:00
86115b2928 Add startup message for IPMI reachability
It's good to know that this succeeded in addition to knowing if it
failed.
2023-09-16 22:41:58 -04:00
17 changed files with 133 additions and 34 deletions

View File

@ -1 +1 @@
0.9.74
0.9.78

View File

@ -1,5 +1,24 @@
## PVC Changelog
###### [v0.9.78](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.78)
* [API, Client CLI] Fixes several bugs around image uploads; adds a new query parameter for non-raw images
* [API] Ensures RBD images are created with a raw bytes value to avoid rounding errors
###### [v0.9.77](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.77)
* [Client CLI] Fixes a bug from a bad library import
###### [v0.9.76](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.76)
* [API, Client CLI] Corrects some missing node states for fencing in status output
###### [v0.9.75](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.75)
* [Node Daemon] Adds a startup message about IPMI when succeeding
* [Node Daemon] Fixes a bug in fencing allowing non-failing VMs to migrate
* [Node Daemon] Adds rounding to load average in load plugin for consistency
###### [v0.9.74](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.74)
* [Docs] Removes docs from the main repo

View File

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

View File

@ -4843,7 +4843,7 @@ class API_Storage_Ceph_Volume_Root(Resource):
{
"name": "size",
"required": True,
"helptext": "A volume size in bytes (or with k/M/G/T suffix) must be specified.",
"helptext": "A volume size in bytes (B implied or with SI suffix k/M/G/T) must be specified.",
},
]
)
@ -4869,7 +4869,7 @@ class API_Storage_Ceph_Volume_Root(Resource):
name: size
type: string
required: true
description: The volume size in bytes (or with a metric suffix, i.e. k/M/G/T)
description: The volume size, in bytes (B implied) or with a single-character SI suffix (k/M/G/T)
responses:
200:
description: OK
@ -5088,7 +5088,12 @@ class API_Storage_Ceph_Volume_Element_Upload(Resource):
"required": True,
"location": ["args"],
"helptext": "A source image format must be specified.",
}
},
{
"name": "file_size",
"required": False,
"location": ["args"],
},
]
)
@Authenticator
@ -5113,6 +5118,11 @@ class API_Storage_Ceph_Volume_Element_Upload(Resource):
- qed
- vdi
- vpc
- in: query
name: file_size
type: integer
required: false
description: The size of the image file, in bytes, if {image_format} is not "raw"
responses:
200:
description: OK
@ -5131,7 +5141,10 @@ class API_Storage_Ceph_Volume_Element_Upload(Resource):
id: Message
"""
return api_helper.ceph_volume_upload(
pool, volume, reqargs.get("image_format", None)
pool,
volume,
reqargs.get("image_format", None),
reqargs.get("file_size", None),
)

View File

@ -1584,7 +1584,7 @@ def ceph_volume_remove(zkhandler, pool, name):
@ZKConnection(config)
def ceph_volume_upload(zkhandler, pool, volume, img_type):
def ceph_volume_upload(zkhandler, pool, volume, img_type, file_size=None):
"""
Upload a raw file via HTTP post to a PVC Ceph volume
"""
@ -1605,7 +1605,17 @@ def ceph_volume_upload(zkhandler, pool, volume, img_type):
}
retcode = 400
return output, retcode
dev_size = retdata[0]["stats"]["size"]
try:
dev_size = retdata[0]["stats"]["size"]
except Exception:
output = {
"message": "Target volume '{}' does not exist in pool '{}'.".format(
volume, pool
)
}
retcode = 400
return output, retcode
def cleanup_maps_and_volumes():
# Unmap the target blockdev
@ -1619,8 +1629,14 @@ def ceph_volume_upload(zkhandler, pool, volume, img_type):
zkhandler, pool, "{}_tmp".format(volume)
)
# Create a temporary block device to store non-raw images
if img_type == "raw":
if file_size != dev_size:
output = {
"message": f"Image file size {file_size} does not match volume size {dev_size}"
}
retcode = 400
return output, retcode
# Map the target blockdev
retflag, retdata = pvc_ceph.map_volume(zkhandler, pool, volume)
if not retflag:
@ -1659,11 +1675,15 @@ def ceph_volume_upload(zkhandler, pool, volume, img_type):
cleanup_maps_and_volumes()
return output, retcode
# Write the image directly to the blockdev
else:
if file_size is None:
output = {"message": "A file size must be specified"}
retcode = 400
return output, retcode
# Create a temporary blockdev
retflag, retdata = pvc_ceph.add_volume(
zkhandler, pool, "{}_tmp".format(volume), dev_size
zkhandler, pool, "{}_tmp".format(volume), file_size
)
if not retflag:
output = {"message": retdata.replace('"', "'")}

View File

@ -1188,10 +1188,8 @@ def cli_vm_modify(
# Grab the current config
current_vm_cfg_raw = vm_information.get("xml")
xml_data = etree.fromstring(current_vm_cfg_raw)
current_vm_cfgfile = (
etree.tostring(xml_data, pretty_print=True).decode("utf8").strip()
)
xml_data = fromstring(current_vm_cfg_raw)
current_vm_cfgfile = tostring(xml_data, pretty_print=True).decode("utf8").strip()
if editor is True:
new_vm_cfgfile = click.edit(
@ -3459,14 +3457,14 @@ def cli_storage_pool():
show_default=True,
required=False,
help="""
The replication configuration, specifying both a "copies" and "mincopies" value, separated by a comma, e.g. "copies=3,mincopies=2". The "copies" value specifies the total number of replicas and should not exceed the total number of nodes; the "mincopies" value specifies the minimum number of available copies to allow writes. For additional details please see the Cluster Architecture documentation.
The replication configuration, specifying both a "copies" and "mincopies" value, separated by a comma, e.g. "copies=3,mincopies=2". The "copies" value specifies the total number of replicas and the "mincopies" value specifies the minimum number of active replicas to allow I/O. For additional details please see the documentation.
""",
)
def cli_storage_pool_add(name, pgs, tier, replcfg):
"""
Add a new Ceph RBD pool with name NAME and PGS placement groups.
The placement group count must be a non-zero power of 2.
The placement group count must be a non-zero power of 2. Generally you should choose a PGS number such that there will be 50-150 PGs on each OSD in a single node (before replicas); 64, 128, or 256 are good values for small clusters (1-5 OSDs per node); higher values are recommended for higher node or OSD counts. For additional details please see the documentation.
"""
retcode, retmsg = pvc.lib.storage.ceph_pool_add(
@ -3505,9 +3503,9 @@ def cli_storage_pool_set_pgs(name, pgs):
"""
Set the placement groups (PGs) count for the pool NAME to PGS.
The placement group count must be a non-zero power of 2.
The placement group count must be a non-zero power of 2. Generally you should choose a PGS number such that there will be 50-150 PGs on each OSD in a single node (before replicas); 64, 128, or 256 are good values for small clusters (1-5 OSDs per node); higher values are recommended for higher node or OSD counts. For additional details please see the documentation.
Placement group counts may be increased or decreased as required though frequent alteration is not recommended.
Placement group counts may be increased or decreased as required though frequent alteration is not recommended. Placement group alterations are intensive operations on the storage cluster.
"""
retcode, retmsg = pvc.lib.storage.ceph_pool_set_pgs(CLI_CONFIG, name, pgs)
@ -3600,7 +3598,7 @@ def cli_storage_volume_upload(pool, name, image_format, image_file):
If the image format is "raw", the image is uploaded directly to the target volume without modification. Otherwise, it will be converted into raw format by "qemu-img convert" on the remote side before writing using a temporary volume. The image format must be a valid format recognized by "qemu-img", such as "vmdk" or "qcow2".
"""
if not os.path.exists(image_file):
if not path.exists(image_file):
echo(CLI_CONFIG, "ERROR: File '{}' does not exist!".format(image_file))
exit(1)
@ -4912,13 +4910,13 @@ def cli_provisioner_ova_upload(name, filename, pool):
Storage templates, provisioning scripts, and arguments for OVA-type profiles will be ignored and should not be set.
"""
if not os.path.exists(filename):
if not path.exists(filename):
echo(CLI_CONFIG, "ERROR: File '{}' does not exist!".format(filename))
exit(1)
params = dict()
params["pool"] = pool
params["ova_size"] = os.path.getsize(filename)
params["ova_size"] = path.getsize(filename)
retcode, retdata = pvc.lib.provisioner.ova_upload(
CLI_CONFIG, name, filename, params

View File

@ -135,7 +135,7 @@ def cli_cluster_status_format_pretty(CLI_CONFIG, data):
state_colour = ansii["green"]
elif state in ["run,flush", "run,unflush", "run,flushed"]:
state_colour = ansii["blue"]
elif "dead" in state or "stop" in state:
elif "dead" in state or "fenced" in state or "stop" in state:
state_colour = ansii["red"]
else:
state_colour = ansii["yellow"]

View File

@ -21,6 +21,7 @@
import math
from os import path
from json import loads
from requests_toolbelt.multipart.encoder import (
MultipartEncoder,
@ -1209,6 +1210,11 @@ def ceph_volume_upload(config, pool, volume, image_format, image_file):
"""
import click
if image_format != "raw":
file_size = path.getsize(image_file)
else:
file_size = None
bar = UploadProgressBar(
image_file, end_message="Parsing file on remote side...", end_nl=False
)
@ -1220,7 +1226,7 @@ def ceph_volume_upload(config, pool, volume, image_format, image_file):
upload_monitor = MultipartEncoderMonitor(upload_data, bar.update)
headers = {"Content-Type": upload_monitor.content_type}
params = {"image_format": image_format}
params = {"image_format": image_format, "file_size": file_size}
response = call_api(
config,

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name="pvc",
version="0.9.74",
version="0.9.78",
packages=["pvc.cli", "pvc.lib"],
install_requires=[
"Click",

View File

@ -763,9 +763,7 @@ def add_volume(zkhandler, pool, name, size):
# 2. Create the volume
retcode, stdout, stderr = common.run_os_command(
"rbd create --size {} {}/{}".format(
format_bytes_tohuman(size_bytes), pool, name
)
"rbd create --size {}B {}/{}".format(size_bytes, pool, name)
)
if retcode:
return False, 'ERROR: Failed to create RBD volume "{}": {}'.format(name, stderr)

View File

@ -256,8 +256,13 @@ def getClusterInformation(zkhandler):
"stop,unflush",
"dead,ready",
"dead,flush",
"dead,fence-flush",
"dead,flushed",
"dead,unflush",
"fenced,ready",
"fenced,flush",
"fenced,flushed",
"fenced,unflush",
]
vm_state_combinations = [
"start",

27
debian/changelog vendored
View File

@ -1,3 +1,30 @@
pvc (0.9.78-0) unstable; urgency=high
* [API, Client CLI] Fixes several bugs around image uploads; adds a new query parameter for non-raw images
* [API] Ensures RBD images are created with a raw bytes value to avoid rounding errors
-- Joshua M. Boniface <joshua@boniface.me> Sat, 30 Sep 2023 12:57:55 -0400
pvc (0.9.77-0) unstable; urgency=high
* [Client CLI] Fixes a bug from a bad library import
-- Joshua M. Boniface <joshua@boniface.me> Tue, 19 Sep 2023 11:05:55 -0400
pvc (0.9.76-0) unstable; urgency=high
* [API, Client CLI] Corrects some missing node states for fencing in status output
-- Joshua M. Boniface <joshua@boniface.me> Mon, 18 Sep 2023 10:15:52 -0400
pvc (0.9.75-0) unstable; urgency=high
* [Node Daemon] Adds a startup message about IPMI when succeeding
* [Node Daemon] Fixes a bug in fencing allowing non-failing VMs to migrate
* [Node Daemon] Adds rounding to load average in load plugin for consistency
-- Joshua M. Boniface <joshua@boniface.me> Sat, 16 Sep 2023 23:06:38 -0400
pvc (0.9.74-0) unstable; urgency=high
* [Docs] Removes docs from the main repo

View File

@ -14,7 +14,7 @@ sys.path.append('api-daemon')
import pvcapid.flaskapi as pvc_api
swagger_file = "docs/manuals/swagger.json"
swagger_file = "swagger.json"
swagger_data = swagger(pvc_api.app)
swagger_data['info']['version'] = "1.0"
swagger_data['info']['title'] = "PVC Client and Provisioner API"
@ -22,3 +22,5 @@ swagger_data['host'] = "pvc.local:7370"
with open(swagger_file, 'w') as fd:
fd.write(json.dumps(swagger_data, sort_keys=True, indent=4))
print(f"Swagger file output to {swagger_file}; add it to the PVC documentation repo.")

View File

@ -76,7 +76,7 @@ class MonitoringPluginScript(MonitoringPlugin):
ipmi_password = self.config["ipmi_password"]
retcode, _, _ = run_os_command(
f"/usr/bin/ipmitool -I lanplus -H {ipmi_hostname} -U {ipmi_username} -P {ipmi_password} chassis power status",
timeout=2
timeout=5
)
if retcode > 0:

View File

@ -72,7 +72,7 @@ class MonitoringPluginScript(MonitoringPlugin):
from psutil import cpu_count
# Get the current 1-minute system load average
load_average = getloadavg()[0]
load_average = float(round(getloadavg()[0], 2))
# Get the number of CPU cores
cpu_cores = cpu_count()

View File

@ -49,7 +49,7 @@ import re
import json
# Daemon version
version = "0.9.74"
version = "0.9.78"
##########################################################
@ -324,9 +324,14 @@ def entrypoint():
config["ipmi_hostname"], config["ipmi_username"], config["ipmi_password"]
):
logger.out(
"Our IPMI is not reachable; fencing of this node will likely fail",
"Our IPMI interface is not reachable; fencing of this node will fail until corrected",
state="w",
)
else:
logger.out(
"Our IPMI interface is reachable; fencing of this node is possible",
state="o",
)
# Validate libvirt
if not pvcnoded.util.libvirt.validate_libvirtd(logger, config):

View File

@ -153,7 +153,13 @@ def migrateFromFencedNode(zkhandler, node_name, config, logger):
# Loop through the VMs
for dom_uuid in dead_node_running_domains:
fence_migrate_vm(dom_uuid)
try:
fence_migrate_vm(dom_uuid)
except Exception as e:
logger.out(
f"Failed to migrate VM {dom_uuid}, continuing: {e}",
state="w",
)
# Set node in flushed state for easy remigrating when it comes back
zkhandler.write([(("node.state.domain", node_name), "flushed")])