Re: [PATCH v2] Remove VIR_FREE in favor of g_autofree in some
functions in libvrit-domain.c
by m kamal
Please advise on what actions (if any) should be taken so that the changes in the patch is merged into main.
Cheers,
Mostafa Mahmoud.
________________________________
From: m kamal <recenum(a)outlook.com>
Sent: Tuesday, March 12, 2024 5:58 PM
To: Peter Krempa <pkrempa(a)redhat.com>
Cc: devel(a)lists.libvirt.org <devel(a)lists.libvirt.org>
Subject: Re: [PATCH v2] Remove VIR_FREE in favor of g_autofree in some functions in libvrit-domain.c
Thanks a lot for the review, Peter.
The first name I used was by mistake, it's the name of my Github profile, Github desktop probably auto-configured it as the global user name for git on my machine. It's in Arabic so it could confuse many non-Unicode-aware programs or protocols. The other name "m kamal" is just a contraction I wrote when I was subscribing to the mailing list from the web UI, I didn't realize it's important.
I will change my configured name in the .gitpublish config to be the longer name "Mostafa Mahmoud", that's the first 2 names of my legal name, it appears that most names here are also 2 names. If there is also a way to change my forum name "m kamal" please let me know.
Sorry for any inconvenience. One last question: After the patch got your approval, is there something on my end to do so that it gets merged? Will it automatically gets picked up by the Gitlab CI pipeline somehow?
Cheers,
Mostafa Mahmoud.
________________________________
From: Peter Krempa <pkrempa(a)redhat.com>
Sent: Tuesday, March 12, 2024 9:57 AM
To: Mostafa <recenum(a)outlook.com>
Cc: devel(a)lists.libvirt.org <devel(a)lists.libvirt.org>
Subject: Re: [PATCH v2] Remove VIR_FREE in favor of g_autofree in some functions in libvrit-domain.c
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>
1 year, 3 months
[libvirt PATCH 00/12] Add vmx-* features from qemu
by Tim Wiederhake
For rationale, see patch 3 (cpu_map: No longer ignore vmx- features in
sync_qemu_features_i386.py).
Adding features in bunches (one patch per msr index), as this series
is adding ~100 features.
This also adds cpu features "gds-no" and "amx-complex" and brings
libvirt in sync with qemu commit ad6ef0a42e.
Tim Wiederhake (12):
cpu_map: Add missing feature "gds-no"
cpu_map: Add missing feature "amx-complex"
cpu_map: No longer ignore vmx- features in sync_qemu_features_i386.py
cpu_map: Add missing vmx features from MSR 0x480
cpu_map: Add missing vmx features from MSR 0x485
cpu_map: Add missing vmx features from MSR 0x48B
cpu_map: Add missing vmx features from MSR 0x48C
cpu_map: Add missing vmx features from MSR 0x48D
cpu_map: Add missing vmx features from MSR 0x48E
cpu_map: Add missing vmx features from MSR 0x48F
cpu_map: Add missing vmx features from MSR 0x490
cpu_map: Add missing vmx features from MSR 0x491
src/cpu_map/sync_qemu_features_i386.py | 2 +-
src/cpu_map/x86_features.xml | 295 ++++++++++++++++++
.../x86_64-cpuid-Atom-P5362-enabled.xml | 9 +
.../x86_64-cpuid-Atom-P5362-json.xml | 70 +++++
.../x86_64-cpuid-Cooperlake-enabled.xml | 9 +
.../x86_64-cpuid-Cooperlake-json.xml | 71 +++++
.../x86_64-cpuid-Core-i7-8550U-enabled.xml | 9 +
.../x86_64-cpuid-Core-i7-8550U-json.xml | 68 ++++
...86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 9 +
.../x86_64-cpuid-Xeon-Platinum-9242-json.xml | 71 +++++
...-cpuid-baseline-Cooperlake+Cascadelake.xml | 71 +++++
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 68 ++++
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 68 ++++
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 68 ++++
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 68 ++++
.../domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 1 +
tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 1 +
.../cpu-host-model.x86_64-4.2.0.args | 2 +-
.../cpu-host-model.x86_64-5.0.0.args | 2 +-
.../cpu-host-model.x86_64-latest.args | 2 +-
20 files changed, 960 insertions(+), 4 deletions(-)
--
2.39.2
1 year, 3 months
[PATCH 00/22] qemu: Fix migration from libvirt older than 9.10.0 when vmx is enabled
by Jiri Denemark
This series fixes a migration regression introduced in 9.10.0 release
which added support for a bunch of vmx-* CPU features. Domains with vmx
feature enabled started by libvirt 9.9.0 or older cannot be migrated to
current releases 9.10.0 and newer.
After this series migration works again with libvirt 9.9.0 and older in
both directions. Migration from the affected releases to the fixed
version works as well, but the other direction remains broken unless the
fix is backported.
See patches 1/22 and 4/22 for more details about the issue and the fix.
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/568
Jiri Denemark (22):
cpu: x86: Add support for adding features to existing CPU models
qemu: domain: Check arch in qemuDomainMakeCPUMigratable
conf: cpu: Introduce virCPUDefListFeatures
qemu: domain: Drop added features from migratable CPU
cpu_map: Do not ignore VMX features in sync_qemu_models script
Add vmx-* features to Broadwell*
Add vmx-* features to Cascadelake*
Add vmx-* features to Conroe
Add vmx-* features to Cooperlake
Add vmx-* features to core{,2}duo
Add vmx-* features to Haswell*
Add vmx-* features to Icelake*
Add vmx-* features to IvyBridge*
Add vmx-* features to kvm*
Add vmx-* features to Nehalem*
Add vmx-* features to Penryn
Add vmx-* features to SandyBridge*
Add vmx-* features to SapphireRapids
Add vmx-* features to Skylake*
Add vmx-* features to Snowridge
Add vmx-* features to Westmere*
NEWS: Document the fix for migration or vmx enabled domains
NEWS.rst | 12 ++
src/conf/cpu_conf.c | 24 ++++
src/conf/cpu_conf.h | 3 +
src/cpu/cpu_x86.c | 69 ++++++++++-
src/cpu/cpu_x86.h | 3 +
src/cpu_map/sync_qemu_models_i386.py | 114 +++++++++++++++++-
src/cpu_map/x86_Broadwell-IBRS.xml | 75 ++++++++++++
src/cpu_map/x86_Broadwell-noTSX-IBRS.xml | 75 ++++++++++++
src/cpu_map/x86_Broadwell-noTSX.xml | 75 ++++++++++++
src/cpu_map/x86_Broadwell.xml | 75 ++++++++++++
src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 76 ++++++++++++
src/cpu_map/x86_Cascadelake-Server.xml | 74 ++++++++++++
src/cpu_map/x86_Conroe.xml | 26 ++++
src/cpu_map/x86_Cooperlake.xml | 76 ++++++++++++
src/cpu_map/x86_Haswell-IBRS.xml | 73 +++++++++++
src/cpu_map/x86_Haswell-noTSX-IBRS.xml | 73 +++++++++++
src/cpu_map/x86_Haswell-noTSX.xml | 73 +++++++++++
src/cpu_map/x86_Haswell.xml | 73 +++++++++++
src/cpu_map/x86_Icelake-Server-noTSX.xml | 77 ++++++++++++
src/cpu_map/x86_Icelake-Server.xml | 72 +++++++++++
src/cpu_map/x86_IvyBridge-IBRS.xml | 67 ++++++++++
src/cpu_map/x86_IvyBridge.xml | 67 ++++++++++
src/cpu_map/x86_Nehalem-IBRS.xml | 61 ++++++++++
src/cpu_map/x86_Nehalem.xml | 61 ++++++++++
src/cpu_map/x86_Penryn.xml | 29 +++++
src/cpu_map/x86_SandyBridge-IBRS.xml | 63 ++++++++++
src/cpu_map/x86_SandyBridge.xml | 63 ++++++++++
src/cpu_map/x86_SapphireRapids.xml | 77 ++++++++++++
src/cpu_map/x86_Skylake-Client-IBRS.xml | 71 +++++++++++
src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml | 72 +++++++++++
src/cpu_map/x86_Skylake-Client.xml | 71 +++++++++++
src/cpu_map/x86_Skylake-Server-IBRS.xml | 74 ++++++++++++
src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 76 ++++++++++++
src/cpu_map/x86_Skylake-Server.xml | 74 ++++++++++++
src/cpu_map/x86_Snowridge.xml | 76 ++++++++++++
src/cpu_map/x86_Westmere-IBRS.xml | 63 ++++++++++
src/cpu_map/x86_Westmere.xml | 63 ++++++++++
src/cpu_map/x86_core2duo.xml | 26 ++++
src/cpu_map/x86_coreduo.xml | 18 +++
src/cpu_map/x86_kvm32.xml | 18 +++
src/cpu_map/x86_kvm64.xml | 20 +++
src/libvirt_private.syms | 2 +
src/qemu/qemu_domain.c | 60 ++++++++-
src/qemu/qemu_domain.h | 4 +-
src/qemu/qemu_migration_cookie.c | 5 +-
45 files changed, 2487 insertions(+), 12 deletions(-)
--
2.44.0
1 year, 3 months
[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
1 year, 3 months
[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
1 year, 3 months
[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
1 year, 3 months
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>
1 year, 3 months
[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
1 year, 3 months
[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
1 year, 3 months
[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
1 year, 3 months