[PATCH] virsh: Support vhostuser in attach-interface
by Michal Privoznik
Recently, I wanted to attach an vhost-user interface but found
out that attach-interface command doesn't support it.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/manpages/virsh.rst | 11 ++++++++++-
tools/virsh-completer-domain.c | 19 +++++++++++++++++++
tools/virsh-completer-domain.h | 5 +++++
tools/virsh-domain.c | 32 ++++++++++++++++++++++++++++++--
tools/virsh-domain.h | 8 ++++++++
5 files changed, 72 insertions(+), 3 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 20936994ce..8a875d0d2e 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4676,6 +4676,7 @@ attach-interface
[--target target] [--mac mac] [--script script] [--model model]
[--inbound average,peak,burst,floor] [--outbound average,peak,burst]
[--alias alias] [--managed] [--print-xml]
+ [--source-mode mode]
Attach a new network interface to the domain.
@@ -4689,7 +4690,9 @@ Attach a new network interface to the domain.
interfaces or bridges,
*hostdev* to indicate connection using a passthrough of PCI device
-on the host.
+on the host,
+
+*vhostuser* to indicate connection using a virtio transport protocol.
``source`` indicates the source of the connection. The source depends
on the type of the interface:
@@ -4703,6 +4706,8 @@ on the type of the interface:
*hostdev* the PCI address of the host's interface formatted
as domain:bus:slot.function.
+*vhostuser* the path to UNIX socket (control plane)
+
``--target`` is used to specify the tap/macvtap device to be used to
connect the domain to the source. Names starting with 'vnet' are
considered as auto-generated and are blanked out/regenerated each
@@ -4737,6 +4742,10 @@ Network XML documentation at
that the interface should be managed, which means detached and reattached
from/to the host by libvirt.
+``--source-mode`` is mandatory for *vhostuser* interface and accepts values
+*server* and *client* that control whether hypervisor waits for the other
+process to connect, or initiates connection, respectively.
+
If ``--print-xml`` is specified, then the XML of the interface that would be
attached is printed instead.
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index c86d8e8156..3ef6c82388 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -372,6 +372,25 @@ virshDomainInterfaceAddrSourceCompleter(vshControl *ctl G_GNUC_UNUSED,
}
+char **
+virshDomainInterfaceSourceModeCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ char **ret = NULL;
+ size_t i;
+
+ virCheckFlags(0, NULL);
+
+ ret = g_new0(char *, VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST);
+
+ for (i = 0; i < VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST; i++)
+ ret[i] = g_strdup(virshDomainInterfaceSourceModeTypeToString(i));
+
+ return ret;
+}
+
+
char **
virshDomainHostnameSourceCompleter(vshControl *ctl G_GNUC_UNUSED,
const vshCmd *cmd G_GNUC_UNUSED,
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index 45380906f9..39cedf0141 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -59,6 +59,11 @@ virshDomainInterfaceAddrSourceCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+char **
+virshDomainInterfaceSourceModeCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
char ** virshDomainHostnameSourceCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 62912aaf01..e5bd1fdd75 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -831,9 +831,19 @@ static const vshCmdOptDef opts_attach_interface[] = {
.type = VSH_OT_BOOL,
.help = N_("libvirt will automatically detach/attach the device from/to host")
},
+ {.name = "source-mode",
+ .type = VSH_OT_STRING,
+ .completer = virshDomainInterfaceSourceModeCompleter,
+ .help = N_("mode attribute of <source/> element")
+ },
{.name = NULL}
};
+VIR_ENUM_IMPL(virshDomainInterfaceSourceMode,
+ VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST,
+ "server",
+ "client");
+
/* parse inbound and outbound which are in the format of
* 'average,peak,burst,floor', in which peak and burst are optional,
* thus 'average,,burst' and 'average,peak' are also legal. */
@@ -881,6 +891,8 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
const char *mac = NULL, *target = NULL, *script = NULL,
*type = NULL, *source = NULL, *model = NULL,
*inboundStr = NULL, *outboundStr = NULL, *alias = NULL;
+ const char *sourceModeStr = NULL;
+ int sourceMode = -1;
virNetDevBandwidthRate inbound, outbound;
virDomainNetType typ;
int ret;
@@ -911,7 +923,8 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
vshCommandOptStringReq(ctl, cmd, "model", &model) < 0 ||
vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 ||
vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 ||
- vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0)
+ vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0 ||
+ vshCommandOptStringReq(ctl, cmd, "source-mode", &sourceModeStr) < 0)
return false;
/* check interface type */
@@ -921,6 +934,12 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ if (sourceModeStr &&
+ (sourceMode = virshDomainInterfaceSourceModeTypeFromString(sourceModeStr)) < 0) {
+ vshError(ctl, _("Invalid source mode: %s"), sourceModeStr);
+ return false;
+ }
+
if (inboundStr) {
memset(&inbound, 0, sizeof(inbound));
if (virshParseRateStr(ctl, inboundStr, &inbound) < 0)
@@ -981,9 +1000,18 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
break;
}
+ case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+ if (sourceMode < 0) {
+ vshError(ctl, _("source-mode is mandatory"));
+ return false;
+ }
+ virBufferAsprintf(&buf, "<source type='unix' path='%s' mode='%s'/>\n",
+ source,
+ virshDomainInterfaceSourceModeTypeToString(sourceMode));
+ break;
+
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_ETHERNET:
- case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_CLIENT:
case VIR_DOMAIN_NET_TYPE_MCAST:
diff --git a/tools/virsh-domain.h b/tools/virsh-domain.h
index a1ac1cf1d4..cf5ce28825 100644
--- a/tools/virsh-domain.h
+++ b/tools/virsh-domain.h
@@ -38,6 +38,14 @@ typedef enum {
VIR_ENUM_DECL(virshDomainHostnameSource);
+typedef enum {
+ VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_SERVER,
+ VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_CLIENT,
+ VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST
+} virshDomainInterfaceSourceMode;
+
+VIR_ENUM_DECL(virshDomainInterfaceSourceMode);
+
extern const vshCmdDef domManagementCmds[];
VIR_ENUM_DECL(virshDomainProcessSignal);
--
2.31.1
3 years, 3 months
[libvirt PATCH] ci: Swap mips64el and armv7l builds
by Andrea Bolognani
Debian sid is currently broken on mips64el, so use Debian 10 for
that specific build and move a different architecture (armv7l)
from Debian 10 to Debian sid to maintain the rough 1:1 split.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/355057402
Just started, but I'm optimistic about the outcome :)
.gitlab-ci.yml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d1609c260d..c1bca36a93 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -225,7 +225,7 @@ armv6l-debian-10-container:
NAME: debian-10-cross-armv6l
armv7l-debian-10-container:
- extends: .container_job
+ extends: .container_optional_job
variables:
NAME: debian-10-cross-armv7l
@@ -240,7 +240,7 @@ mips-debian-10-container:
NAME: debian-10-cross-mips
mips64el-debian-10-container:
- extends: .container_optional_job
+ extends: .container_job
variables:
NAME: debian-10-cross-mips64el
@@ -270,7 +270,7 @@ armv6l-debian-sid-container:
NAME: debian-sid-cross-armv6l
armv7l-debian-sid-container:
- extends: .container_optional_job
+ extends: .container_job
variables:
NAME: debian-sid-cross-armv7l
@@ -280,7 +280,7 @@ i686-debian-sid-container:
NAME: debian-sid-cross-i686
mips64el-debian-sid-container:
- extends: .container_job
+ extends: .container_optional_job
variables:
NAME: debian-sid-cross-mips64el
@@ -473,12 +473,12 @@ armv6l-debian-10:
NAME: debian-10
CROSS: armv6l
-armv7l-debian-10:
+armv7l-debian-sid:
extends: .cross_build_job
needs:
- - armv7l-debian-10-container
+ - armv7l-debian-sid-container
variables:
- NAME: debian-10
+ NAME: debian-sid
CROSS: armv7l
i686-debian-sid:
@@ -497,12 +497,12 @@ mips-debian-10:
NAME: debian-10
CROSS: mips
-mips64el-debian-sid:
+mips64el-debian-10:
extends: .cross_build_job
needs:
- - mips64el-debian-sid-container
+ - mips64el-debian-10-container
variables:
- NAME: debian-sid
+ NAME: debian-10
CROSS: mips64el
mipsel-debian-10:
--
2.31.1
3 years, 3 months
[PATCH v2 00/23] tests: qemu: Don't crash when capability file can't be parsed
by Peter Krempa
The original patch was replaced. A nice side effect of this series is
substantial improvement of compile times for:
qemuxml2xmltest 15.8s -> 1.3s
qemuxml2argvtest 6.4s -> 1.8s
In addition this also cleans up the messy parsing of fake caps and
removes the somewhat ambiguous NONE macro.
Peter Krempa (23):
qemu: capabilities: Remove virQEMUCapsSetList
qemuxml2argvtest: Add 'ARG_END' from higher level macros
qemuxml2argvtest: Fix broken invocation of "pseries-spaprvio-invalid"
qemuxml2argvtest: Fix broken invocation of "aarch64-tpm-wrong-model"
testQemuInfoSetArgs: Always allocate 'info->qemuCaps'
qemustatusxml2xmltest: Remove hack for qemuCaps allocation
qemuxml2argvtest: Add QEMU_CAPS_LAST in places where ARG_QEMU_CAPS is
used
qemuxml2argvtest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix
users
qemuxml2argvtest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah",
NONE);'
qemuxml2argvtest: Add 'DO_TEST_PARSE_ERROR_NOCAPS' to replace
'DO_TEST_PARSE_ERROR("blah", NONE);'
qemuxml2argvtest: Add 'DO_TEST_FAILURE_NOCAPS' to replace
'DO_TEST_FAILURE("blah", NONE);'
qemuxml2xmltest: Add 'ARG_END' from higher level macros
qemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users
qemuxml2xmltest: Remove hack for qemuCaps allocation
qemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah",
NONE);'
qemuxml2xmltest: Remove 'NONE' macro
testutilsqemu: Ensure that ARG_* macros are out of range of
QEMU_CAPS_*
testQemuInfoSetArgs: Remove hack for double QEMU_CAPS_LAST in caps
list
testQemuInfoSetArgs: Move argument fetching to the loop
testutilsqemu: Introduce struct to hold data valid for all test runs
testutilsqemu: Improve error propagation from 'testQemuInfoSetArgs'
qemuxml2argvtest: Avoid conditions in test macro
qemuxml2xmltesttest: Avoid conditions in test macro
src/qemu/qemu_capabilities.c | 13 -
src/qemu/qemu_capabilities.h | 2 -
tests/qemustatusxml2xmltest.c | 21 +-
tests/qemuxml2argvtest.c | 666 +++++++++++++++++-----------------
tests/qemuxml2xmltest.c | 578 ++++++++++++++---------------
tests/testutilsqemu.c | 140 ++++---
tests/testutilsqemu.h | 30 +-
7 files changed, 706 insertions(+), 744 deletions(-)
--
2.31.1
3 years, 3 months
[RFC PATCH] add support for two global pm options that controls acpi hotplug on q35/i440fx
by Ani Sinha
'acpi-pci-hotplug-with-bridge-support' and 'acpi-root-pci-hotplug' are two pm
options in qemu that governs acpi hotplug support. This is a WIP patch that
tries to implement support for both these two global qemu options.
'acpi-pci-hotplug-with-bridge-support' applies both for q35 as well as i440fx
platforms. The 'acpi-root-pci-hotplug' only applies for i440fx.
'acpi-pci-hotplug-with-bridge-support' can be turned off by providing the
following xml snippet:
<pm>
<acpi-hotplug-bridge enabled='no'>
</pm>
Similarly, 'acpi-root-pci-hotplug' can be turned off by providing the following
xml snippet:
<pm>
<acpi-root-hotplug enabled='no'>
</pm>
This change adds no unit tests. It will be added later on. It it sent for
initial comments and suggestions.
Signed-off-by: Ani Sinha <ani(a)anisinha.ca>
---
src/conf/domain_conf.c | 10 ++++++++++
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 9 +++++++++
src/qemu/qemu_capabilities.h | 5 +++++
src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++
src/qemu/qemu_validate.c | 21 +++++++++++++++++++++
6 files changed, 75 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 06c1fcf5e5..512973e6f4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19351,6 +19351,16 @@ virDomainDefLifecycleParse(virDomainDef *def,
&def->pm.s4) < 0)
goto error;
+ if (virDomainPMStateParseXML(ctxt,
+ "string(./pm/acpi-hotplug-bridge/@enabled)",
+ &def->pm.acpi_hp_bridge) < 0)
+ goto error;
+
+ if (virDomainPMStateParseXML(ctxt,
+ "string(./pm/acpi-root-hotplug/@enabled)",
+ &def->pm.acpi_root_hp) < 0)
+ goto error;
+
return 0;
error:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ca21082624..94283cbb04 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2643,6 +2643,8 @@ struct _virDomainPowerManagement {
/* These options are of type enum virTristateBool */
int s3;
int s4;
+ int acpi_hp_bridge;
+ int acpi_root_hp;
};
struct _virDomainPerfDef {
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9558938866..8dad4a6351 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -637,6 +637,11 @@ VIR_ENUM_IMPL(virQEMUCaps,
"confidential-guest-support",
"query-display-options",
"s390-pv-guest",
+ "piix4-acpi-hotplug-bridge",
+ "piix4-acpi-root-hotplug-en",
+
+ /* 410 */
+ "ich9-acpi-hotplug-bridge",
);
@@ -1467,6 +1472,9 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsIDEDrive[] = {
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPiix4PM[] = {
{ "disable_s3", QEMU_CAPS_PIIX_DISABLE_S3, NULL },
{ "disable_s4", QEMU_CAPS_PIIX_DISABLE_S4, NULL },
+ { "acpi-pci-hotplug-with-bridge-support", QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE, NULL },
+ { "acpi-root-pci-hotplug", QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG, NULL },
+
};
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBRedir[] = {
@@ -1519,6 +1527,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioGpu[] = {
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsICH9[] = {
{ "disable_s3", QEMU_CAPS_ICH9_DISABLE_S3, NULL },
{ "disable_s4", QEMU_CAPS_ICH9_DISABLE_S4, NULL },
+ { "acpi-pci-hotplug-with-bridge-support", QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE, NULL },
};
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBNECXHCI[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 2b1bb57a49..e988527f39 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -617,6 +617,11 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-guest-support */
QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp command present */
QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */
+ QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE, /* -M pc PIIX4_PM.acpi-pci-hotplug-with-bridge-support */
+ QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG, /* -M pc PIIX4_PM.acpi-root-pci-hotplug */
+
+ /* 410 */
+ QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE, /* -M q35 PIIX4_PM.acpi-pci-hotplug-with-bridge-support */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 156af4caee..5a7a23d5b9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6171,6 +6171,34 @@ qemuBuildPMCommandLine(virCommand *cmd,
pm_object, def->pm.s4 == VIR_TRISTATE_BOOL_NO);
}
+ if (def->pm.acpi_hp_bridge) {
+ const char *pm_object = "PIIX4_PM";
+ const char *switch_str = "on";
+
+ if (def->pm.acpi_hp_bridge == VIR_TRISTATE_BOOL_NO)
+ switch_str = "off";
+
+ if (qemuDomainIsQ35(def) &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE))
+ pm_object = "ICH9-LPC";
+
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.acpi-pci-hotplug-with-bridge-support=%s",
+ pm_object, switch_str);
+ }
+
+ if (def->pm.acpi_root_hp) {
+ const char *pm_object = "PIIX4_PM";
+ const char *switch_str = "on";
+
+ if (def->pm.acpi_hp_bridge == VIR_TRISTATE_BOOL_NO)
+ switch_str = "off";
+
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.acpi-root-pci-hotplug=%s",
+ pm_object, switch_str);
+ }
+
return 0;
}
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a964c8593d..22403e6d01 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -560,6 +560,27 @@ qemuValidateDomainDefPM(const virDomainDef *def,
}
}
+ if (def->pm.acpi_hp_bridge) {
+ bool q35ICH9_pcihpbr = q35Dom &&
+ virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE);
+
+ if (!q35ICH9_pcihpbr && !virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("setting ACPI hotplug bridge not supported"));
+ return -1;
+ }
+ }
+
+ if (def->pm.acpi_root_hp) {
+ if (!q35Dom && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("setting ACPI root pci hotplug not supported"));
+ return -1;
+ }
+ }
+
return 0;
}
--
2.25.1
3 years, 3 months
Add support for two i386 pm options which control acpi hotplug
by Ani Sinha
Hi :
The previous patch I sent was half baked and had issues. I am sending the
fixed patch complete with added unit tests for the new libvirt xml options.
The first patch in the series is the actual change. It also adds related
schema modifications. Additionally, it makes the necessary capability
additions as well.
The second patch in the series is the related unit tests for this feature.
The unit tests all pass when run.
[PATCH 1/2] pm/i386: add support for two options that controls acpi
[PATCH 2/2] tests: add unit tests to exercize pm options that control
I hope I shall get some traction on this. Please provide feedback and
suggestions.
Thanks
ani
3 years, 3 months
[libvirt PATCH] vircgroup: fix build on non-linux systems
by Pavel Hrdina
virCgroupGetInode needs to be in '#ifdef __linux__'.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroup.c | 70 ++++++++++++++++++++++++--------------------
1 file changed, 39 insertions(+), 31 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 4c9445340e..dc040a4822 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -3005,6 +3005,37 @@ virCgroupControllerAvailable(int controller)
return virCgroupHasController(cgroup, controller);
}
+
+/**
+ * virCgroupGetInode:
+ *
+ * @cgroup: the cgroup to get inode for
+ *
+ * Get the @cgroup inode and return its value to the caller.
+ *
+ * Returns inode on success, -1 on error with error message reported.
+ */
+int
+virCgroupGetInode(virCgroup *cgroup)
+{
+ struct stat st;
+ int controller = virCgroupGetAnyController(cgroup);
+ g_autofree char *path = NULL;
+
+ if (controller < 0)
+ return -1;
+
+ if (virCgroupPathOfController(cgroup, controller, "", &path) < 0)
+ return -1;
+
+ if (stat(path, &st) < 0) {
+ virReportSystemError(errno, _("failed to get stat for '%s'"), path);
+ return -1;
+ }
+
+ return st.st_ino;
+}
+
#else /* !__linux__ */
bool
@@ -3769,6 +3800,14 @@ virCgroupControllerAvailable(int controller G_GNUC_UNUSED)
{
return false;
}
+
+int
+virCgroupGetInode(virCgroup *cgroup)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Control groups not supported on this platform"));
+ return -1;
+}
#endif /* !__linux__ */
@@ -3973,34 +4012,3 @@ virCgroupGetCpuPeriodQuota(virCgroup *cgroup, unsigned long long *period,
return 0;
}
-
-
-/**
- * virCgroupGetInode:
- *
- * @cgroup: the cgroup to get inode for
- *
- * Get the @cgroup inode and return its value to the caller.
- *
- * Returns inode on success, -1 on error with error message reported.
- */
-int
-virCgroupGetInode(virCgroup *cgroup)
-{
- struct stat st;
- int controller = virCgroupGetAnyController(cgroup);
- g_autofree char *path = NULL;
-
- if (controller < 0)
- return -1;
-
- if (virCgroupPathOfController(cgroup, controller, "", &path) < 0)
- return -1;
-
- if (stat(path, &st) < 0) {
- virReportSystemError(errno, _("failed to get stat for '%s'"), path);
- return -1;
- }
-
- return st.st_ino;
-}
--
2.31.1
3 years, 3 months
[PATCH 0/5] Implement detach device related APIs for test driver
by Luke Yue
Luke Yue (5):
test_driver: Implement virDomainDetachDeviceFlags
test_driver: Implement virDomainDetachDeviceAlias
test_driver: Implement virDomainDetachDevice
examples: xml: test: add xml for testing devices related APIs
tests: Test detach-device and detach-device-alias for test driver
examples/xml/test/testdevcontroller.xml | 1 +
examples/xml/test/testdevdiskcdrom.xml | 5 +
examples/xml/test/testdevfs.xml | 6 +
examples/xml/test/testdevhostdev.xml | 5 +
examples/xml/test/testdevif.xml | 6 +
examples/xml/test/testdevinput.xml | 1 +
examples/xml/test/testdevlease.xml | 5 +
examples/xml/test/testdevmem.xml | 6 +
examples/xml/test/testdevnetif.xml | 6 +
examples/xml/test/testdevrng.xml | 4 +
examples/xml/test/testdevshmem.xml | 4 +
examples/xml/test/testdevsound.xml | 3 +
examples/xml/test/testdevvsock.xml | 3 +
examples/xml/test/testdevwatchdog.xml | 1 +
examples/xml/test/testdomfc5.xml | 46 ++++
examples/xml/test/testnodeinline.xml | 46 ++++
src/test/test_driver.c | 290 ++++++++++++++++++++++++
tests/virshtest.c | 24 ++
18 files changed, 462 insertions(+)
create mode 100644 examples/xml/test/testdevcontroller.xml
create mode 100644 examples/xml/test/testdevdiskcdrom.xml
create mode 100644 examples/xml/test/testdevfs.xml
create mode 100644 examples/xml/test/testdevhostdev.xml
create mode 100644 examples/xml/test/testdevif.xml
create mode 100644 examples/xml/test/testdevinput.xml
create mode 100644 examples/xml/test/testdevlease.xml
create mode 100644 examples/xml/test/testdevmem.xml
create mode 100644 examples/xml/test/testdevnetif.xml
create mode 100644 examples/xml/test/testdevrng.xml
create mode 100644 examples/xml/test/testdevshmem.xml
create mode 100644 examples/xml/test/testdevsound.xml
create mode 100644 examples/xml/test/testdevvsock.xml
create mode 100644 examples/xml/test/testdevwatchdog.xml
--
2.32.0
3 years, 3 months
[libvirt PATCH 0/6] Use g_auto for more libxml2 functions (glib chronicles)
by Ján Tomko
Use g_auto for the remaining users of xmlFreeDoc and
xmlXPathFreeContext. Also, remove redundant labels where easily
possible.
Ján Tomko (6):
conf: virCPUDefListParse: reduce scope of variables
conf: refactor virNetworkLoadState
Use g_auto for xmlXPathContext everywhere
Use g_auto for xmlFreeDoc everywhere
Use g_autofree in affected functions
Remove redundant labels
src/conf/checkpoint_conf.c | 3 +--
src/conf/cpu_conf.c | 30 ++++++++------------------
src/conf/domain_conf.c | 6 ++----
src/conf/interface_conf.c | 3 +--
src/conf/node_device_conf.c | 3 +--
src/conf/nwfilter_conf.c | 3 +--
src/conf/secret_conf.c | 3 +--
src/conf/snapshot_conf.c | 3 +--
src/conf/storage_conf.c | 6 ++----
src/conf/virnetworkobj.c | 37 +++++++++++---------------------
src/conf/virnetworkportdef.c | 16 +++++---------
src/conf/virnwfilterbindingdef.c | 16 +++++---------
src/conf/virnwfilterbindingobj.c | 16 +++++---------
src/conf/virsavecookie.c | 20 ++++++-----------
src/conf/virstorageobj.c | 21 +++++++-----------
src/esx/esx_vi.c | 4 +---
src/libxl/libxl_migration.c | 14 ++++--------
src/qemu/qemu_capabilities.c | 6 ++----
src/qemu/qemu_migration_cookie.c | 15 ++++---------
src/security/virt-aa-helper.c | 23 +++++++-------------
src/storage/storage_util.c | 23 +++++++-------------
src/test/test_driver.c | 17 +++++----------
src/util/virxml.c | 3 +--
src/vbox/vbox_snapshot_conf.c | 21 ++++++------------
src/vz/vz_driver.c | 10 +++------
src/vz/vz_sdk.c | 6 ++----
tests/cputest.c | 35 +++++++++++-------------------
tests/metadatatest.c | 22 ++++++-------------
tests/qemucaps2xmltest.c | 8 ++-----
tests/virnetdevbandwidthtest.c | 6 ++----
30 files changed, 129 insertions(+), 270 deletions(-)
--
2.31.1
3 years, 3 months
[PATCH v2 0/4] Implement some job related APIs for test driver
by Luke Yue
v2:
- Change to priv->jobState to store job type directly instead of using
time
- Use priv->jobOperation to store job operation for virDomainGetJobStats
Luke Yue (4):
test_driver: Implement virDomainGetJobInfo
test_driver: Implement virDomainGetJobStats
test_driver: Implement virDomainAbortJob
virshtest: add test for domjobinfo
src/test/test_driver.c | 223 +++++++++++++++++++++++++++++++++++++++++
tests/virshtest.c | 11 ++
2 files changed, 234 insertions(+)
--
2.32.0
3 years, 3 months
[libvirt PATCH v4 0/5] add support for Fibre Channel VMID
by Pavel Hrdina
changes in v4:
- documentation fixes
- allow only printable characters to be used in appid
- properly check inode in qemuSetupCgroupAppid
changes in v3:
- rename the XML attribute to appid as technically what user
provides is not VMID, that is created by kernel
changes in v2:
- refactor of resource parsing and formatting code
- use <fibrechannel vmid=''/> element
- use stat() directly
- report only single system error
Pavel Hrdina (5):
vircgroup: introduce virCgroupGetInode function
conf: refactor virDomainResourceDefParse
conf: refactor virDomainResourceDefFormat
conf: introduce support for Fibre Channel VMID
qemu: implement support for Fibre Channel VMID
docs/formatdomain.rst | 21 ++++++++++
docs/schemas/domaincommon.rng | 22 ++++++++--
src/conf/domain_conf.c | 42 +++++++++++--------
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 34 +++++++++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_cgroup.c | 30 +++++++++++++
src/util/vircgroup.c | 31 ++++++++++++++
src/util/vircgroup.h | 2 +
.../fibrechannel-appid.xml | 21 ++++++++++
tests/genericxml2xmltest.c | 2 +
11 files changed, 186 insertions(+), 21 deletions(-)
create mode 100644 tests/genericxml2xmlindata/fibrechannel-appid.xml
--
2.31.1
3 years, 3 months