[PATCH] openvz_conf: Use g_autofree
by Rayhan Faizel
---
src/openvz/openvz_conf.c | 60 ++++++++++++----------------------------
1 file changed, 17 insertions(+), 43 deletions(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index eab3f748d0..4dbaef356c 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -163,7 +163,7 @@ openvzReadNetworkConf(virDomainDef *def,
{
int ret;
virDomainNetDef *net = NULL;
- char *temp = NULL;
+ g_autofree char *temp = NULL;
char *token, *saveptr = NULL;
/*parse routing network configuration*
@@ -258,12 +258,9 @@ openvzReadNetworkConf(virDomainDef *def,
}
}
- VIR_FREE(temp);
-
return 0;
error:
- VIR_FREE(temp);
virDomainNetDefFree(net);
return -1;
}
@@ -276,7 +273,7 @@ openvzReadFSConf(virDomainDef *def,
int ret;
virDomainFSDef *fs = NULL;
g_autofree char *veid_str = NULL;
- char *temp = NULL;
+ g_autofree char *temp = NULL;
const char *param;
unsigned long long barrier, limit;
@@ -337,11 +334,8 @@ openvzReadFSConf(virDomainDef *def,
VIR_APPEND_ELEMENT(def->fss, def->nfss, fs);
- VIR_FREE(temp);
-
return 0;
error:
- VIR_FREE(temp);
virDomainFSDefFree(fs);
return -1;
}
@@ -351,7 +345,7 @@ static int
openvzReadMemConf(virDomainDef *def, int veid)
{
int ret = -1;
- char *temp = NULL;
+ g_autofree char *temp = NULL;
unsigned long long barrier, limit;
const char *param;
long kb_per_pages;
@@ -411,7 +405,6 @@ openvzReadMemConf(virDomainDef *def, int veid)
ret = 0;
error:
- VIR_FREE(temp);
return ret;
}
@@ -549,7 +542,7 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
g_autofree char *temp_file = NULL;
int temp_fd = -1;
FILE *fp;
- char *line = NULL;
+ g_autofree char *line = NULL;
size_t line_size = 0;
temp_file = g_strdup_printf("%s.tmp", conf_file);
@@ -586,12 +579,9 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
if (rename(temp_file, conf_file) < 0)
goto error;
- VIR_FREE(line);
-
return 0;
error:
- VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
VIR_FORCE_CLOSE(temp_fd);
if (temp_file)
@@ -602,14 +592,13 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
int
openvzWriteVPSConfigParam(int vpsid, const char *param, const char *value)
{
- char *conf_file;
+ g_autofree char *conf_file = NULL;
int ret;
if (openvzLocateConfFile(vpsid, &conf_file, "conf") < 0)
return -1;
ret = openvzWriteConfigParam(conf_file, param, value);
- VIR_FREE(conf_file);
return ret;
}
@@ -622,7 +611,7 @@ openvzWriteVPSConfigParam(int vpsid, const char *param, const char *value)
int
openvzReadConfigParam(const char *conf_file, const char *param, char **value)
{
- char *line = NULL;
+ g_autofree char *line = NULL;
size_t line_size = 0;
FILE *fp;
int err = 0;
@@ -652,7 +641,6 @@ openvzReadConfigParam(const char *conf_file, const char *param, char **value)
/* keep going - last entry wins */
}
}
- VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
return err ? -1 : *value ? 1 : 0;
@@ -672,21 +660,20 @@ openvzReadConfigParam(const char *conf_file, const char *param, char **value)
int
openvzReadVPSConfigParam(int vpsid, const char *param, char **value)
{
- char *conf_file;
+ g_autofree char *conf_file = NULL;
int ret;
if (openvzLocateConfFile(vpsid, &conf_file, "conf") < 0)
return -1;
ret = openvzReadConfigParam(conf_file, param, value);
- VIR_FREE(conf_file);
return ret;
}
static int
openvz_copyfile(char* from_path, char* to_path)
{
- char *line = NULL;
+ g_autofree char *line = NULL;
size_t line_size = 0;
FILE *fp;
int copy_fd;
@@ -715,12 +702,9 @@ openvz_copyfile(char* from_path, char* to_path)
if (VIR_CLOSE(copy_fd) < 0)
goto error;
- VIR_FREE(line);
-
return 0;
error:
- VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
VIR_FORCE_CLOSE(copy_fd);
return -1;
@@ -734,10 +718,10 @@ openvz_copyfile(char* from_path, char* to_path)
int
openvzCopyDefaultConfig(int vpsid)
{
- char *confdir = NULL;
- char *default_conf_file = NULL;
- char *configfile_value = NULL;
- char *conf_file = NULL;
+ g_autofree char *confdir = NULL;
+ g_autofree char *default_conf_file = NULL;
+ g_autofree char *configfile_value = NULL;
+ g_autofree char *conf_file = NULL;
int ret = -1;
if (openvzReadConfigParam(VZ_CONF_FILE, "CONFIGFILE", &configfile_value) < 0)
@@ -758,10 +742,6 @@ openvzCopyDefaultConfig(int vpsid)
ret = 0;
cleanup:
- VIR_FREE(confdir);
- VIR_FREE(default_conf_file);
- VIR_FREE(configfile_value);
- VIR_FREE(conf_file);
return ret;
}
@@ -771,7 +751,7 @@ openvzCopyDefaultConfig(int vpsid)
static int
openvzLocateConfFileDefault(int vpsid, char **conffile, const char *ext)
{
- char *confdir;
+ g_autofree char *confdir = NULL;
int ret = 0;
confdir = openvzLocateConfDir();
@@ -780,7 +760,6 @@ openvzLocateConfFileDefault(int vpsid, char **conffile, const char *ext)
*conffile = g_strdup_printf("%s/%d.%s", confdir, vpsid, ext ? ext : "conf");
- VIR_FREE(confdir);
return ret;
}
@@ -828,8 +807,8 @@ openvz_readline(int fd, char *ptr, int maxlen)
static int
openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
{
- char *conf_file;
- char *line = NULL;
+ g_autofree char *conf_file = NULL;
+ g_autofree char *line = NULL;
size_t line_size = 0;
char *saveptr = NULL;
char *uuidbuf;
@@ -868,9 +847,7 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
}
retval = 0;
cleanup:
- VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
- VIR_FREE(conf_file);
return retval;
}
@@ -881,7 +858,7 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
int
openvzSetDefinedUUID(int vpsid, unsigned char *uuid)
{
- char *conf_file;
+ g_autofree char *conf_file = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
FILE *fp = NULL;
int ret = -1;
@@ -912,7 +889,6 @@ openvzSetDefinedUUID(int vpsid, unsigned char *uuid)
ret = 0;
cleanup:
VIR_FORCE_FCLOSE(fp);
- VIR_FREE(conf_file);
return ret;
}
@@ -941,7 +917,7 @@ static int openvzAssignUUIDs(void)
{
g_autoptr(DIR) dp = NULL;
struct dirent *dent;
- char *conf_dir;
+ g_autofree char *conf_dir = NULL;
int vpsid;
char *ext;
int ret = 0;
@@ -951,7 +927,6 @@ static int openvzAssignUUIDs(void)
return -1;
if (virDirOpenQuiet(&dp, conf_dir) < 0) {
- VIR_FREE(conf_dir);
return 0;
}
@@ -964,7 +939,6 @@ static int openvzAssignUUIDs(void)
openvzSetUUID(vpsid);
}
- VIR_FREE(conf_dir);
return ret;
}
--
2.34.1
9 months, 1 week
[PATCH 0/2] Mock another version of open()
by Michal Privoznik
Since rawhide has the most recent packages (glibc in this case) it is
usually the first where a problematic change shows. This time there's a
problem with glibc and the way it calls open() -> in some cases it calls
__open_2() instead. Since we are not mocking the latter our test cases
are not redirected to stay inside the repo. For instance, nsstest tries
to open "/var/lib/libvirt/dnsmasq//virbr1.status".
Green pipeline:
https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1213064943
Michal Prívozník (2):
virusbmock: Switch to VIR_MOCK_REAL_INIT()
tests: mock __open_2()
meson.build | 13 +++++++++++++
tests/nssmock.c | 26 +++++++++++++++++++++++++
tests/qemusecuritymock.c | 24 +++++++++++++++++++++++
tests/vircgroupmock.c | 42 ++++++++++++++++++++++++++++++++++++++++
tests/virfilewrapper.c | 18 +++++++++++++++++
tests/virmock.h | 4 ++++
tests/virpcimock.c | 17 ++++++----------
tests/virtestmock.c | 20 +++++++++++++++++++
tests/virusbmock.c | 42 ++++++++++++++++++++++++++++------------
9 files changed, 183 insertions(+), 23 deletions(-)
--
2.43.2
9 months, 1 week
[PATCH 00/23] vsh: Fix handling of commands and help - part 1 (help text formatter and flags)
by Peter Krempa
This series refactors the cruft in the virsh command and argument
handling so that handling of options and the flags for them make
actually sense.
Except for the 'timeout' parameter of 'daemon-timeout' 'virt-admin'
command the behaviour is supposed to be identical.
Peter Krempa (23):
vsh: Always assume that command groups are used
vsh: Don't translate error messages for 'self-test'
vsh: Add VSH_OT_NONE option type to catch programming errors
vsh: Remove VSH_CMD_FLAG_ALIAS
vshCmddefCheckInternals: Fix listing of missing completers for
'VSH_OT_ARGV'
virsh: Remove uncommon redundant descriptions of virsh commands
virt-admin: Drop trailing whitespaces from description of some
commands
virsh-domain: Don't explicitly break lines in help
vsh: Add '--dump-help' option for 'self-test' command
vsh: Refactor store of command help and description
vshCmddefHelp: Refactor printing of help (list of arguments)
vshCmddefHelp: Refactor printing of help (argument description)
vshCmddefGetOption: Improve readability
virsh: Inline only use of VIRSH_COMMON_OPT_DOMAIN_OT_ARGV macro
vsh: Annotate 'required' and 'positional' arguments explicitly
vsh: Fix broken assumption that required VSH_OT_INT must be positional
vsh: Require that positional non-argv arguments are required
vshCmddefCheckInternals: Remove refactoring safety checks
vshCmdGrpHelp: Refactor formatting of help for VSH_OT_ARGV
vshCmddefHelp: Refactor and fix printing of help for _STRING/_INT
arguments
vsh: Replace VSH_OT_DATA by VSH_OT_STRING
vsh: remove VSH_OFLAG_REQ
vsh: Automatically calculate VSH_OFLAG_REQ_OPT
tools/virsh-backup.c | 29 +-
tools/virsh-checkpoint.c | 109 +--
tools/virsh-domain-event.c | 13 +-
tools/virsh-domain-monitor.c | 207 ++--
tools/virsh-domain.c | 1783 ++++++++++++----------------------
tools/virsh-host.c | 311 ++----
tools/virsh-interface.c | 217 ++---
tools/virsh-network.c | 312 ++----
tools/virsh-nodedev.c | 242 ++---
tools/virsh-nwfilter.c | 144 +--
tools/virsh-pool.c | 296 ++----
tools/virsh-secret.c | 113 +--
tools/virsh-snapshot.c | 137 +--
tools/virsh-volume.c | 241 ++---
tools/virsh.c | 22 +-
tools/virsh.h | 29 +-
tools/virt-admin.c | 275 ++----
tools/vsh.c | 474 +++++----
tools/vsh.h | 49 +-
19 files changed, 1798 insertions(+), 3205 deletions(-)
--
2.44.0
9 months, 1 week
Re: [PATCH v2] Remove VIR_FREE in favor of g_autofree in some
functions in libvrit-domain.c
by Peter Krempa
On Tue, Mar 12, 2024 at 00:11:28 +0200, Mostafa wrote:
The patch looks good now, but you've used multiple names in various
fields over the two postings and the preference in terms of both
authorship and sign-off is to use a full real name
Used previously:
> From: مصطفي محمود كمال الدين <48567303+moste00(a)users.noreply.github.com>
> From: m kamal <recenum(a)outlook.com>
The one in this patch:
> Signed-off-by: Mostafa <recenum(a)outlook.com>
I don't want to assume anything about foreign names, but the last one
looks more like a nickname or given name only.
> ---
> src/libvirt-domain.c | 32 ++++++++------------------------
> 1 file changed, 8 insertions(+), 24 deletions(-)
For the code:
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
9 months, 2 weeks
[PATCH v2] ch: Enable hyperv hypervisor
by Praveen K Paladugu
From: Praveen K Paladugu <prapal(a)linux.microsoft.com>
Cloud-Hypervisor is capable of running VMs with kvm or mshv as the
hypervisor on Linux Host. Guest to hypevisor ABI with mshv hypervisor is
the same as in the case of VIR_DOMAIN_VIRT_HYPERV. So, VIR_DOMAIN_VIRT_HYPERV
type will be reused to represent the config with Linux Host and mshv as the
hypervisor.
While initializing ch driver, check if either of /dev/kvm or /dev/mshv
device is present on the host. Before starting ch domains, check if the
requested hypervisor device is present on the host.
Users can specify hypervisor in ch guests's domain definitions like
below:
<domain type='kvm'>
_or_
<domain type='hyperv'>
Signed-off-by: Praveen K Paladugu <prapal(a)linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu(a)gmail.com>
---
src/ch/ch_conf.c | 2 ++
src/ch/ch_driver.c | 7 +++++++
src/ch/ch_process.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index f421af5121..1911ae8f8b 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -69,6 +69,8 @@ virCaps *virCHDriverCapsInit(void)
virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM,
NULL, NULL, 0, NULL);
+ virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_HYPERV,
+ NULL, NULL, 0, NULL);
return g_steal_pointer(&caps);
}
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 96de5044ac..d6294c76ee 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -32,6 +32,7 @@
#include "viraccessapicheck.h"
#include "virchrdev.h"
#include "virerror.h"
+#include "virfile.h"
#include "virlog.h"
#include "virobject.h"
#include "virtypedparam.h"
@@ -876,6 +877,12 @@ static int chStateInitialize(bool privileged,
return -1;
}
+ if (!(virFileExists("/dev/kvm") || virFileExists("/dev/mshv"))) {
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
+ _("/dev/kvm and /dev/mshv. ch driver failed to initialize."));
+ return VIR_DRV_STATE_INIT_ERROR;
+ }
+
ch_driver = g_new0(virCHDriver, 1);
if (virMutexInit(&ch_driver->lock) < 0) {
diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index 3bde9d9dcf..640f72a9ca 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -637,6 +637,37 @@ chProcessAddNetworkDevices(virCHDriver *driver,
return 0;
}
+/**
+ * virCHProcessStartValidate:
+ * @vm: domain object
+ *
+ * Checks done before starting a VM.
+ *
+ * Returns 0 on success or -1 in case of error
+ */
+static int virCHProcessStartValidate(virDomainObj *vm)
+{
+ if (vm->def->virtType == VIR_DOMAIN_VIRT_KVM) {
+ VIR_DEBUG("Checking for KVM availability");
+ if (!virFileExists("/dev/kvm")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Domain requires KVM, but it is not available. Check that virtualization is enabled in the host BIOS, and host configuration is setup to load the kvm modules."));
+ return -1;
+ }
+ } else if (vm->def->virtType == VIR_DOMAIN_VIRT_HYPERV) {
+ VIR_DEBUG("Checking for mshv availability");
+ if (!virFileExists("/dev/mshv")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Domain requires MSHV device, but it is not available. Check that virtualization is enabled in the host BIOS, and host configuration is setup to load the mshv modules."));
+ return -1;
+ }
+ } else {
+ return -1;
+ }
+ return 0;
+
+}
+
/**
* virCHProcessStart:
* @driver: pointer to driver structure
@@ -664,6 +695,10 @@ virCHProcessStart(virCHDriver *driver,
return -1;
}
+ if (virCHProcessStartValidate(vm) < 0) {
+ return -1;
+ }
+
if (!priv->monitor) {
/* And we can get the first monitor connection now too */
if (!(priv->monitor = virCHProcessConnectMonitor(driver, vm))) {
--
2.43.0
9 months, 2 weeks
[PATCH v2] storage: Upgrade default qcow2 verion to 1.1
by Abhiram Tilak
Change the default to modern qcow2 as it's supported by all qemu
versions supported by libvirt and in fact 'qemu-img' already defaults to
the new format for a long time.
Some Unittests require changes to pass, now that version 1.1 is default.
Unittests like `qcow2-1.1.argv` may not be relevant anymore, but this patch
doesn't affect them.
Signed-off-by: Abhiram Tilak <atp.exp(a)gmail.com>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/storage/storage_util.c | 2 +-
.../storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-compat.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv | 2 +-
.../qcow2-luks-convert-encrypt2fileqcow2.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-luks.argv | 2 +-
.../qcow2-nobacking-convert-prealloc-compat.argv | 2 +-
.../storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv | 2 +-
.../qcow2-nocapacity-convert-prealloc.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-nocapacity.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-nocow-compat.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-zerocapacity.argv | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 7bf815d978..28d5fce4f0 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -765,7 +765,7 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo,
if (info->compat)
virBufferAsprintf(&buf, "compat=%s,", info->compat);
else if (info->format == VIR_STORAGE_FILE_QCOW2)
- virBufferAddLit(&buf, "compat=0.10,");
+ virBufferAddLit(&buf, "compat=1.1,");
if (info->clusterSize > 0)
virBufferAsprintf(&buf, "cluster_size=%llu,", info->clusterSize);
diff --git a/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv b/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv
index 4b9ccfe8dc..705604b162 100644
--- a/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv
+++ b/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv
@@ -1,7 +1,7 @@
qemu-img \
create \
-f qcow2 \
--o compat=0.10 \
+-o compat=1.1 \
/var/lib/libvirt/images/sparse-qcow2.img \
1073741824K
qemu-img \
diff --git a/tests/storagevolxml2argvdata/qcow2-compat.argv b/tests/storagevolxml2argvdata/qcow2-compat.argv
index bf3a50a7f3..40fbe065e0 100644
--- a/tests/storagevolxml2argvdata/qcow2-compat.argv
+++ b/tests/storagevolxml2argvdata/qcow2-compat.argv
@@ -2,6 +2,6 @@ qemu-img \
create \
-f qcow2 \
-b /dev/null \
--o backing_fmt=raw,compat=0.10 \
+-o backing_fmt=raw,compat=1.1 \
/var/lib/libvirt/images/OtherDemo.img \
5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv b/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv
index dbc7deb16a..b68da425d9 100644
--- a/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv
+++ b/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv
@@ -2,6 +2,6 @@ qemu-img \
convert \
-f raw \
-O qcow2 \
--o compat=0.10 \
+-o compat=1.1 \
/dev/HostVG/Swap \
/var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv
index d89622d4a6..3068b4b38d 100644
--- a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv
+++ b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv
@@ -2,7 +2,7 @@ qemu-img \
create \
-f qcow2 \
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
--o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \
+-o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=1.1 \
/var/lib/libvirt/images/OtherDemoLuks.img \
5242880K
qemu-img \
diff --git a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv
index 4d910552d0..948e9ac66d 100644
--- a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv
+++ b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv
@@ -1,7 +1,7 @@
qemu-img \
create \
-f qcow2 \
--o compat=0.10 \
+-o compat=1.1 \
/var/lib/libvirt/images/sparse-qcow2.img \
1073741824K
qemu-img \
diff --git a/tests/storagevolxml2argvdata/qcow2-luks.argv b/tests/storagevolxml2argvdata/qcow2-luks.argv
index 308316c90c..a3be41a406 100644
--- a/tests/storagevolxml2argvdata/qcow2-luks.argv
+++ b/tests/storagevolxml2argvdata/qcow2-luks.argv
@@ -3,6 +3,6 @@ create \
-f qcow2 \
-b /dev/null \
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
--o backing_fmt=raw,encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \
+-o backing_fmt=raw,encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=1.1 \
/var/lib/libvirt/images/OtherDemoLuks.img \
5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv
index 463ae26779..a130ed8894 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv
@@ -2,6 +2,6 @@ qemu-img \
convert \
-f raw \
-O qcow2 \
--o preallocation=metadata,compat=0.10 \
+-o preallocation=metadata,compat=1.1 \
/var/lib/libvirt/images/sparse.img \
/var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv
index 510e0c13f6..440ad8f122 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv
@@ -1,6 +1,6 @@
qemu-img \
create \
-f qcow2 \
--o preallocation=metadata,compat=0.10 \
+-o preallocation=metadata,compat=1.1 \
/var/lib/libvirt/images/OtherDemo.img \
5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv
index 0152b1efb6..3bf8613d72 100644
--- a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv
@@ -2,6 +2,6 @@ qemu-img \
convert \
-f raw \
-O qcow2 \
--o preallocation=falloc,compat=0.10 \
+-o preallocation=falloc,compat=1.1 \
/var/lib/libvirt/images/sparse.img \
/var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nocapacity.argv b/tests/storagevolxml2argvdata/qcow2-nocapacity.argv
index 047932a559..924c5c6084 100644
--- a/tests/storagevolxml2argvdata/qcow2-nocapacity.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nocapacity.argv
@@ -2,5 +2,5 @@ qemu-img \
create \
-f qcow2 \
-b /dev/null \
--o backing_fmt=raw,compat=0.10 \
+-o backing_fmt=raw,compat=1.1 \
/var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv b/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv
index 4cc7904cfc..ae94e4e588 100644
--- a/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv
@@ -2,6 +2,6 @@ qemu-img \
create \
-f qcow2 \
-b /dev/null \
--o backing_fmt=raw,nocow=on,compat=0.10 \
+-o backing_fmt=raw,nocow=on,compat=1.1 \
/var/lib/libvirt/images/OtherDemo.img \
5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv b/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv
index 607c642e6f..05e31509cb 100644
--- a/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv
+++ b/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv
@@ -1,6 +1,6 @@
qemu-img \
create \
-f qcow2 \
--o compat=0.10 \
+-o compat=1.1 \
/var/lib/libvirt/images/OtherDemo.img \
0K
--
2.42.1
9 months, 2 weeks
[PATCH 0/4] ch: A couple of cleanups
by Michal Privoznik
As I rewrote and merged [1] I've broken the build because not
chxml2xmltest relies on host having /dev/kvm accessible. Here are some
fixes and cleanups I've come up with. And here [2] is the green
pipeline (not sure about the x86_64-fedora-rawhide-clang failure,
investigating, but seems unrelated).
1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/OE...
2: https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1206477954
Michal Prívozník (4):
tests: Introduce chxml2xmlmock
ch: Demote error when CH driver fails to init
capabilities: Allow suppressing error message from
virCapabilitiesDomainDataLookup()
capabilities: Allow suppressing error message from
virCapabilitiesDomainSupported()
src/bhyve/bhyve_domain.c | 3 ++-
src/ch/ch_domain.c | 5 ++++-
src/ch/ch_driver.c | 9 ++++-----
src/ch/ch_process.c | 4 ++--
src/conf/capabilities.c | 23 +++++++++++++++++------
src/conf/capabilities.h | 6 ++++--
src/conf/domain_conf.c | 5 ++++-
src/libxl/libxl_domain.c | 3 ++-
src/libxl/xen_common.c | 5 ++++-
src/lxc/lxc_domain.c | 3 ++-
src/openvz/openvz_conf.c | 3 ++-
src/qemu/qemu_capabilities.c | 10 +++++-----
src/vmware/vmware_driver.c | 3 ++-
src/vmx/vmx.c | 3 ++-
src/vz/vz_driver.c | 3 ++-
tests/chxml2xmlmock.c | 33 +++++++++++++++++++++++++++++++++
tests/chxml2xmltest.c | 2 +-
tests/meson.build | 3 +++
18 files changed, 95 insertions(+), 31 deletions(-)
create mode 100644 tests/chxml2xmlmock.c
--
2.43.0
9 months, 2 weeks
[PULL 13/13] docs/about/deprecated.rst: Move SMP configurations item to system emulator section
by Philippe Mathieu-Daudé
From: Zhao Liu <zhao1.liu(a)intel.com>
In the commit 54c4ea8f3ae6 ("hw/core/machine-smp: Deprecate unsupported
'parameter=1' SMP configurations"), the SMP related item is put under
the section "User-mode emulator command line arguments" instead of
"System emulator command line arguments".
-smp is a system emulator command, so move SMP configurations item to
system emulator section.
Signed-off-by: Zhao Liu <zhao1.liu(a)intel.com>
Reviewed-by: Thomas Huth <thuth(a)redhat.com>
Message-ID: <20240312071512.3283513-1-zhao1.liu(a)linux.intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd(a)linaro.org>
---
docs/about/deprecated.rst | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index dfd681cd02..2f9277c915 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -47,16 +47,6 @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
However, short-form booleans are deprecated and full explicit ``arg_name=on``
form is preferred.
-User-mode emulator command line arguments
------------------------------------------
-
-``-p`` (since 9.0)
-''''''''''''''''''
-
-The ``-p`` option pretends to control the host page size. However,
-it is not possible to change the host page size, and using the
-option only causes failures.
-
``-smp`` (Unsupported "parameter=1" SMP configurations) (since 9.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -71,6 +61,16 @@ configurations (e.g. -smp drawers=1,books=1,clusters=1 for x86 PC machine) is
marked deprecated since 9.0, users have to ensure that all the topology members
described with -smp are supported by the target machine.
+User-mode emulator command line arguments
+-----------------------------------------
+
+``-p`` (since 9.0)
+''''''''''''''''''
+
+The ``-p`` option pretends to control the host page size. However,
+it is not possible to change the host page size, and using the
+option only causes failures.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
--
2.41.0
9 months, 2 weeks
[PATCH-for-9.0] docs: Deprecate the pseries-2.12 machines
by Philippe Mathieu-Daudé
pSeries machines before 3.0 have complex migration back
compatibility code we'd like to get ride of. The last
one is 2.12, which is 6 years old. We just deprecated up
to the 2.11 machine in commit 1392617d35 ("spapr: Tag
pseries-2.1 - 2.11 machines as deprecated").
Take to opportunity to also deprecate the 2.12 machines.
Signed-off-by: Philippe Mathieu-Daudé <philmd(a)linaro.org>
---
In 2025 I'd like to get ride of the code related to:
include/hw/ppc/spapr_cpu_core.h:31: bool pre_3_0_migration; /* older machine don't know about SpaprCpuState */
---
docs/about/deprecated.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index dfd681cd02..65111513cc 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -237,13 +237,13 @@ The Nios II architecture is orphan.
The machine is no longer in existence and has been long unmaintained
in QEMU. This also holds for the TC51828 16MiB flash that it uses.
-``pseries-2.1`` up to ``pseries-2.11`` (since 9.0)
+``pseries-2.1`` up to ``pseries-2.12`` (since 9.0)
''''''''''''''''''''''''''''''''''''''''''''''''''
-Older pseries machines before version 2.12 have undergone many changes
+Older pseries machines before version 3.0 have undergone many changes
to correct issues, mostly regarding migration compatibility. These are
no longer maintained and removing them will make the code easier to
-read and maintain. Use versions 2.12 and above as a replacement.
+read and maintain. Use versions 3.0 and above as a replacement.
Backend options
---------------
--
2.41.0
9 months, 2 weeks
[PATCH v2] Remove VIR_FREE in favor of g_autofree in some functions in libvrit-domain.c
by Mostafa
Signed-off-by: Mostafa <recenum(a)outlook.com>
---
src/libvirt-domain.c | 32 ++++++++------------------------
1 file changed, 8 insertions(+), 24 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 83abad251e..4ba3563c9e 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -884,7 +884,7 @@ virDomainSave(virDomainPtr domain, const char *to)
if (conn->driver->domainSave) {
int ret;
- char *absolute_to;
+ g_autofree char *absolute_to = NULL;
/* We must absolutize the file path as the save is done out of process */
if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
@@ -895,8 +895,6 @@ virDomainSave(virDomainPtr domain, const char *to)
ret = conn->driver->domainSave(domain, absolute_to);
- VIR_FREE(absolute_to);
-
if (ret < 0)
goto error;
return ret;
@@ -974,7 +972,7 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
if (conn->driver->domainSaveFlags) {
int ret;
- char *absolute_to;
+ g_autofree char *absolute_to = NULL;
/* We must absolutize the file path as the save is done out of process */
if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
@@ -985,8 +983,6 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
ret = conn->driver->domainSaveFlags(domain, absolute_to, dxml, flags);
- VIR_FREE(absolute_to);
-
if (ret < 0)
goto error;
return ret;
@@ -1076,7 +1072,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
if (conn->driver->domainRestore) {
int ret;
- char *absolute_from;
+ g_autofree char *absolute_from = NULL;
/* We must absolutize the file path as the restore is done out of process */
if (!(absolute_from = g_canonicalize_filename(from, NULL))) {
@@ -1087,8 +1083,6 @@ virDomainRestore(virConnectPtr conn, const char *from)
ret = conn->driver->domainRestore(conn, absolute_from);
- VIR_FREE(absolute_from);
-
if (ret < 0)
goto error;
return ret;
@@ -1156,7 +1150,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
if (conn->driver->domainRestoreFlags) {
int ret;
- char *absolute_from;
+ g_autofree char *absolute_from = NULL;
/* We must absolutize the file path as the restore is done out of process */
if (!(absolute_from = g_canonicalize_filename(from, NULL))) {
@@ -1168,8 +1162,6 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
ret = conn->driver->domainRestoreFlags(conn, absolute_from, dxml,
flags);
- VIR_FREE(absolute_from);
-
if (ret < 0)
goto error;
return ret;
@@ -1263,7 +1255,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
if (conn->driver->domainSaveImageGetXMLDesc) {
char *ret;
- char *absolute_file;
+ g_autofree char *absolute_file = NULL;
/* We must absolutize the file path as the read is done out of process */
if (!(absolute_file = g_canonicalize_filename(file, NULL))) {
@@ -1275,8 +1267,6 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
ret = conn->driver->domainSaveImageGetXMLDesc(conn, absolute_file,
flags);
- VIR_FREE(absolute_file);
-
if (!ret)
goto error;
return ret;
@@ -1338,7 +1328,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
if (conn->driver->domainSaveImageDefineXML) {
int ret;
- char *absolute_file;
+ g_autofree char *absolute_file = NULL;
/* We must absolutize the file path as the read is done out of process */
if (!(absolute_file = g_canonicalize_filename(file, NULL))) {
@@ -1350,8 +1340,6 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
ret = conn->driver->domainSaveImageDefineXML(conn, absolute_file,
dxml, flags);
- VIR_FREE(absolute_file);
-
if (ret < 0)
goto error;
return ret;
@@ -1415,7 +1403,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
if (conn->driver->domainCoreDump) {
int ret;
- char *absolute_to;
+ g_autofree char *absolute_to = NULL;
/* We must absolutize the file path as the save is done out of process */
if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
@@ -1426,8 +1414,6 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
ret = conn->driver->domainCoreDump(domain, absolute_to, flags);
- VIR_FREE(absolute_to);
-
if (ret < 0)
goto error;
return ret;
@@ -1501,7 +1487,7 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to,
if (conn->driver->domainCoreDumpWithFormat) {
int ret;
- char *absolute_to;
+ g_autofree char *absolute_to = NULL;
/* We must absolutize the file path as the save is done out of process */
if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
@@ -1513,8 +1499,6 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to,
ret = conn->driver->domainCoreDumpWithFormat(domain, absolute_to,
dumpformat, flags);
- VIR_FREE(absolute_to);
-
if (ret < 0)
goto error;
return ret;
--
2.34.1
9 months, 2 weeks