[libvirt] [PATCH] qemuDomainNamespaceSetupDisk: Fix const correctness
by Michal Privoznik
The array of strings we are building is indeed array of const
strings. We are not STRDUP()-ing them nor FREE()-ing them.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f03aa03e8a..0486c5527d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11196,7 +11196,7 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
virStorageSourcePtr src)
{
virStorageSourcePtr next;
- char **paths = NULL;
+ const char **paths = NULL;
size_t npaths = 0;
int ret = -1;
@@ -11214,7 +11214,7 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
goto cleanup;
}
- if (qemuDomainNamespaceMknodPaths(vm, (const char **)paths, npaths) < 0)
+ if (qemuDomainNamespaceMknodPaths(vm, paths, npaths) < 0)
return -1;
ret = 0;
--
2.16.1
6 years, 8 months
[libvirt] [jenkins-ci PATCH 0/2] Add libvirt-dbus project
by Andrea Bolognani
Andrea Bolognani (2):
guests: Add libvirt-dbus project
projects: Add libvirt-dbus project
guests/host_vars/libvirt-centos-7/main.yml | 1 +
guests/host_vars/libvirt-debian-9/main.yml | 1 +
guests/host_vars/libvirt-debian-sid/main.yml | 1 +
guests/host_vars/libvirt-fedora-26/main.yml | 1 +
guests/host_vars/libvirt-fedora-27/main.yml | 1 +
guests/host_vars/libvirt-fedora-rawhide/main.yml | 1 +
guests/host_vars/libvirt-freebsd-10/main.yml | 1 +
guests/host_vars/libvirt-freebsd-11/main.yml | 1 +
guests/host_vars/libvirt-freebsd-current/main.yml | 1 +
guests/host_vars/libvirt-ubuntu-16/main.yml | 1 +
guests/vars/mappings.yml | 10 ++++++++
guests/vars/projects/libvirt-dbus.yml | 6 +++++
projects/libvirt-dbus.yaml | 31 +++++++++++++++++++++++
13 files changed, 57 insertions(+)
create mode 100644 guests/vars/projects/libvirt-dbus.yml
create mode 100644 projects/libvirt-dbus.yaml
--
2.14.3
6 years, 8 months
[libvirt] [PATCH 0/6] Add support for TPM emulator and CRB interface
by Stefan Berger
This series of patches add support for the new TPM CRB interface in
QEMU that will become available with QEMU 2.12.
The rest of the patches add support for the TPM emulator backend that
is available in QEMU and based on swtpm + libtpms. Here I hope for
feedback for how to organize the layout of directories, files, and
UnixIO socket files that QEMU needs to talk to 'swtpm'.
Stefan
Stefan Berger (6):
tpm: Enable TPM CRB interface
tpm: Add support for external swtpm TPM emulator
tpm: Label the external swtpm with SELinux labels
tpm: Handle TPM emulator device reconfigurations
tpm: Add support for choosing emulation of a TPM 2
tpm: Add swtpm to emulator cgroup
docs/formatdomain.html.in | 47 ++
docs/schemas/domaincommon.rng | 23 +-
src/conf/domain_audit.c | 2 +
src/conf/domain_conf.c | 131 ++++-
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 8 +
src/qemu/Makefile.inc.am | 2 +
src/qemu/libvirtd_qemu.aug | 3 +
src/qemu/qemu.conf | 7 +
src/qemu/qemu_capabilities.c | 10 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_cgroup.c | 54 ++
src/qemu/qemu_cgroup.h | 1 +
src/qemu/qemu_command.c | 52 +-
src/qemu/qemu_conf.c | 11 +-
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_driver.c | 16 +-
src/qemu/qemu_extdevice.c | 245 +++++++++
src/qemu/qemu_extdevice.h | 36 ++
src/qemu/qemu_process.c | 12 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/security/security_dac.c | 6 +
src/security/security_driver.h | 5 +-
src/security/security_manager.c | 15 +
src/security/security_manager.h | 3 +
src/security/security_selinux.c | 101 ++++
src/security/security_stack.c | 19 +
src/util/vircgroup.c | 42 ++
src/util/vircgroup.h | 1 +
src/util/virfile.c | 12 +
src/util/virfile.h | 2 +-
src/util/virtpm.c | 550 +++++++++++++++++++++
src/util/virtpm.h | 14 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 2 +
tests/qemuxml2argvdata/tpm-emulator-tpm2.args | 24 +
tests/qemuxml2argvdata/tpm-emulator-tpm2.xml | 30 ++
tests/qemuxml2argvdata/tpm-emulator.args | 24 +
tests/qemuxml2argvdata/tpm-emulator.xml | 30 ++
tests/qemuxml2argvdata/tpm-passthrough-crb.args | 24 +
tests/qemuxml2argvdata/tpm-passthrough-crb.xml | 32 ++
tests/qemuxml2argvmock.c | 2 +
tests/qemuxml2argvtest.c | 23 +
tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml | 34 ++
tests/qemuxml2xmloutdata/tpm-emulator.xml | 34 ++
tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml | 36 ++
tests/qemuxml2xmltest.c | 1 +
51 files changed, 1736 insertions(+), 20 deletions(-)
create mode 100644 src/qemu/qemu_extdevice.c
create mode 100644 src/qemu/qemu_extdevice.h
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.args
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.xml
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.args
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.xml
create mode 100644 tests/qemuxml2argvdata/tpm-passthrough-crb.args
create mode 100644 tests/qemuxml2argvdata/tpm-passthrough-crb.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-passthrough-crb.xml
--
2.5.5
6 years, 8 months
[libvirt] [PATCH v1 0/2] Fix qcow2 fully allocated filesystem objects.
by Wim Ten Have
From: Wim ten Have <wim.ten.have(a)oracle.com>
When tools like virt-install request to create a fully allocated
filesystem object storage by setting the parameter sparse=no, libvirt
doesn't allow that to happen for qcow2 formatted files.
Regardless of its XML instuction request libvirt always targets its
filesystem object storage with preallocation=metadata if format=qcow2
is in effect. This results in sparse files which could cause problems
since total image storage potentially can overrun actual filesystem
available space.
(NOTE: This is a RESEND holding corrected cover letter and commit
messages / Subject headers.)
Wim ten Have (2):
storage: extend preallocation flags support for qemu-img
tests: add qemu-img test for preallocation=falloc
include/libvirt/libvirt-storage.h | 5 ++++-
src/storage/storage_util.c | 21 +++++++++++++++++----
.../qcow2-nocapacity-convert-prealloc.argv | 2 +-
3 files changed, 22 insertions(+), 6 deletions(-)
--
2.14.3
6 years, 8 months
[libvirt] Race condition between qemuDomainCreate and qemuDomainDestroy
by Marc Hartmayer
Hi,
there is a race condition between 'qemuDomainCreate' and
'qemuDomainDestroy' causing a NULL pointer segmentation fault when
accessing priv->monConfig. The race condition can be easily reproduced
using gdb.
(gdb) set non-stop on
# set breakpoint on line 'mon = qemuMonitorOpen(vm, …)'
(gdb) b qemu_process.c:1799
# Actually, this second breakpoint is optional but it’s good to see
where priv->monConfig is set to NULL
# set breakpoint on line priv->monConfig = NULL;
(gdb) b qemu_process.c:6589
(gdb) run
# continue all threads - just for the case we hit a breakpoint already
(gdb) c -a
Now start a domain (that is using QEMU)
$ virsh start domain
The first breakpoint will be hit. Now run in a second shell
$ virsh destroy domain
The second breakpoint will be hit. Continue the thread where the second
breakpoint was hit (for this example this is thread 4)
(gdb) thread apply 4 continue
Now continue the thread where the first breakpoint was hit.
=> Segmentation fault because of a NULL pointer dereference at
config->value
Since I'm not very familiar with that part of the code, I wanted to ask
for your advice.
Thanks in advance.
Beste Grüße / Kind regards
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
6 years, 8 months
[libvirt] [dbus PATCH] APIs should appear in aplhabetical order in all files.
by Katerina Koukiou
In C and XML files the order is:
1) properties
2) methods
3) signals
All of them sorted in their category alphabetically.
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 12 +--
data/org.libvirt.Domain.xml | 54 ++++++------
src/connect.c | 2 +-
src/domain.c | 200 +++++++++++++++++++++----------------------
4 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 5b49ed9..55260cc 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -25,12 +25,6 @@
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion"/>
</property>
- <method name="ListDomains">
- <annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDom..."/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="domains" type="ao" direction="out"/>
- </method>
<method name="DomainCreateXML">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateXML"/>
@@ -73,6 +67,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="sysinfo" type="s" direction="out"/>
</method>
+ <method name="ListDomains">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDom..."/>
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="domains" type="ao" direction="out"/>
+ </method>
<method name="ListNetworks">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListAllNe..."/>
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 7679018..78378bb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -3,25 +3,25 @@
<node name="/org/libvirt/domain">
<interface name="org.libvirt.Domain">
- <property name="Name" type="s" access="read">
+ <property name="Active" type="b" access="read">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
</property>
- <property name="UUID" type="s" access="read">
+ <property name="Autostart" type="b" access="read">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
</property>
<property name="Id" type="u" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetID"/>
</property>
- <property name="OSType" type="s" access="read">
+ <property name="Name" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName"/>
</property>
- <property name="Active" type="b" access="read">
+ <property name="OSType" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType"/>
</property>
<property name="Persistent" type="b" access="read">
<annotation name="org.gtk.GDBus.DocString"
@@ -31,21 +31,19 @@
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/>
</property>
- <property name="Autostart" type="b" access="read">
+ <property name="UUID" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
</property>
- <method name="GetVcpus">
+ <method name="Create">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithF..."/>
<arg name="flags" type="u" direction="in"/>
- <arg name="vcpus" type="u" direction="out"/>
</method>
- <method name="GetXMLDesc">
+ <method name="Destroy">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
<arg name="flags" type="u" direction="in"/>
- <arg name="xml" type="s" direction="out"/>
</method>
<method name="GetStats">
<annotation name="org.gtk.GDBus.DocString"
@@ -54,15 +52,17 @@
<arg name="flags" type="u" direction="in"/>
<arg name="records" type="a{sv}" direction="out"/>
</method>
- <method name="Shutdown">
+ <method name="GetVcpus">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/>
<arg name="flags" type="u" direction="in"/>
+ <arg name="vcpus" type="u" direction="out"/>
</method>
- <method name="Destroy">
+ <method name="GetXMLDesc">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc"/>
<arg name="flags" type="u" direction="in"/>
+ <arg name="xml" type="s" direction="out"/>
</method>
<method name="Reboot">
<annotation name="org.gtk.GDBus.DocString"
@@ -74,23 +74,23 @@
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReset"/>
<arg name="flags" type="u" direction="in"/>
</method>
- <method name="Create">
+ <method name="Resume">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithF..."/>
- <arg name="flags" type="u" direction="in"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
</method>
- <method name="Undefine">
+ <method name="Shutdown">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags"/>
<arg name="flags" type="u" direction="in"/>
</method>
<method name="Suspend">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend"/>
</method>
- <method name="Resume">
+ <method name="Undefine">
<annotation name="org.gtk.GDBus.DocString"
- value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
+ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags"/>
+ <arg name="flags" type="u" direction="in"/>
</method>
<signal name="DeviceAdded">
<annotation name="org.gtk.GDBus.DocString"
diff --git a/src/connect.c b/src/connect.c
index 9820de5..d18f77d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -575,7 +575,6 @@ static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
};
static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
- { "ListDomains", virtDBusConnectListDomains },
{ "DomainCreateXML", virtDBusConnectDomainCreateXML },
{ "DomainDefineXML", virtDBusConnectDomainDefineXML },
{ "DomainLookupByID", virtDBusConnectDomainLookupByID },
@@ -583,6 +582,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "DomainLookupByUUID", virtDBusConnectDomainLookupByUUID },
{ "GetCapabilities", virtDBusConnectGetCapabilities },
{ "GetSysinfo", virtDBusConnectGetSysinfo },
+ { "ListDomains", virtDBusConnectListDomains },
{ "ListNetworks", virtDBusConnectListNetworks },
{ "NetworkCreateXML", virtDBusConnectNetworkCreateXML },
{ "NetworkDefineXML", virtDBusConnectNetworkDefineXML },
diff --git a/src/domain.c b/src/domain.c
index 0066788..b3b3630 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -25,44 +25,44 @@ virtDBusDomainGetVirDomain(virtDBusConnect *connect,
}
static void
-virtDBusDomainGetName(const gchar *objectPath,
- gpointer userData,
- GVariant **value,
- GError **error)
+virtDBusDomainGetActive(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- const gchar *name;
+ gint active;
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- name = virDomainGetName(domain);
- if (!name)
+ active = virDomainIsActive(domain);
+ if (active < 0)
return virtDBusUtilSetLastVirtError(error);
- *value = g_variant_new("s", name);
+ *value = g_variant_new("b", !!active);
}
static void
-virtDBusDomainGetUUID(const gchar *objectPath,
- gpointer userData,
- GVariant **value,
- GError **error)
+virtDBusDomainGetAutostart(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- gchar uuid[VIR_UUID_STRING_BUFLEN] = "";
+ gint autostart = 0;
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainGetUUIDString(domain, uuid) < 0)
+ if (virDomainGetAutostart(domain, &autostart) < 0)
return virtDBusUtilSetLastVirtError(error);
- *value = g_variant_new("s", uuid);
+ *value = g_variant_new("b", !!autostart);
}
static void
@@ -87,45 +87,45 @@ virtDBusDomainGetId(const gchar *objectPath,
}
static void
-virtDBusDomainGetOsType(const gchar *objectPath,
- gpointer userData,
- GVariant **value,
- GError **error)
+virtDBusDomainGetName(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- g_autofree gchar *osType = NULL;
+ const gchar *name;
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- osType = virDomainGetOSType(domain);
- if (!osType)
+ name = virDomainGetName(domain);
+ if (!name)
return virtDBusUtilSetLastVirtError(error);
- *value = g_variant_new("s", osType);
+ *value = g_variant_new("s", name);
}
static void
-virtDBusDomainGetActive(const gchar *objectPath,
+virtDBusDomainGetOsType(const gchar *objectPath,
gpointer userData,
GVariant **value,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- gint active;
+ g_autofree gchar *osType = NULL;
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- active = virDomainIsActive(domain);
- if (active < 0)
+ osType = virDomainGetOSType(domain);
+ if (!osType)
return virtDBusUtilSetLastVirtError(error);
- *value = g_variant_new("b", !!active);
+ *value = g_variant_new("s", osType);
}
static void
@@ -199,38 +199,36 @@ virtDBusDomainGetState(const gchar *objectPath,
}
static void
-virtDBusDomainGetAutostart(const gchar *objectPath,
- gpointer userData,
- GVariant **value,
- GError **error)
+virtDBusDomainGetUUID(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- gint autostart = 0;
+ gchar uuid[VIR_UUID_STRING_BUFLEN] = "";
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainGetAutostart(domain, &autostart) < 0)
+ if (virDomainGetUUIDString(domain, uuid) < 0)
return virtDBusUtilSetLastVirtError(error);
- *value = g_variant_new("b", !!autostart);
+ *value = g_variant_new("s", uuid);
}
static void
-virtDBusDomainGetVcpus(GVariant *inArgs,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
-
+virtDBusDomainCreate(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- gint vcpus;
guint flags;
g_variant_get(inArgs, "(u)", &flags);
@@ -239,25 +237,21 @@ virtDBusDomainGetVcpus(GVariant *inArgs,
if (!domain)
return;
- vcpus = virDomainGetVcpusFlags(domain, flags);
- if (vcpus < 0)
- return virtDBusUtilSetLastVirtError(error);
-
- *outArgs = g_variant_new("(u)", vcpus);
+ if (virDomainCreateWithFlags(domain, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
}
static void
-virtDBusDomainGetXMLDesc(GVariant *inArgs,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
+virtDBusDomainDestroy(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- g_autofree gchar *xml = NULL;
guint flags;
g_variant_get(inArgs, "(u)", &flags);
@@ -266,11 +260,8 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs,
if (!domain)
return;
- xml = virDomainGetXMLDesc(domain, flags);
- if (!xml)
- return virtDBusUtilSetLastVirtError(error);
-
- *outArgs = g_variant_new("(s)", xml);
+ if (virDomainDestroyFlags(domain, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecordListFree);
@@ -311,16 +302,18 @@ virtDBusDomainGetStats(GVariant *inArgs,
}
static void
-virtDBusDomainShutdown(GVariant *inArgs,
+virtDBusDomainGetVcpus(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
const gchar *objectPath,
gpointer userData,
- GVariant **outArgs G_GNUC_UNUSED,
+ GVariant **outArgs,
GUnixFDList **outFDs G_GNUC_UNUSED,
GError **error)
+
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
+ gint vcpus;
guint flags;
g_variant_get(inArgs, "(u)", &flags);
@@ -329,21 +322,25 @@ virtDBusDomainShutdown(GVariant *inArgs,
if (!domain)
return;
- if (virDomainShutdownFlags(domain, flags) < 0)
- virtDBusUtilSetLastVirtError(error);
+ vcpus = virDomainGetVcpusFlags(domain, flags);
+ if (vcpus < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(u)", vcpus);
}
static void
-virtDBusDomainDestroy(GVariant *inArgs,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs G_GNUC_UNUSED,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
+virtDBusDomainGetXMLDesc(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
+ g_autofree gchar *xml = NULL;
guint flags;
g_variant_get(inArgs, "(u)", &flags);
@@ -352,8 +349,11 @@ virtDBusDomainDestroy(GVariant *inArgs,
if (!domain)
return;
- if (virDomainDestroyFlags(domain, flags) < 0)
- virtDBusUtilSetLastVirtError(error);
+ xml = virDomainGetXMLDesc(domain, flags);
+ if (!xml)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(s)", xml);
}
static void
@@ -405,7 +405,7 @@ virtDBusDomainReset(GVariant *inArgs,
}
static void
-virtDBusDomainCreate(GVariant *inArgs,
+virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
GUnixFDList *inFDs G_GNUC_UNUSED,
const gchar *objectPath,
gpointer userData,
@@ -415,20 +415,17 @@ virtDBusDomainCreate(GVariant *inArgs,
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- guint flags;
-
- g_variant_get(inArgs, "(u)", &flags);
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainCreateWithFlags(domain, flags) < 0)
+ if (virDomainResume(domain) < 0)
virtDBusUtilSetLastVirtError(error);
}
static void
-virtDBusDomainUndefine(GVariant *inArgs,
+virtDBusDomainShutdown(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
const gchar *objectPath,
gpointer userData,
@@ -446,7 +443,7 @@ virtDBusDomainUndefine(GVariant *inArgs,
if (!domain)
return;
- if (virDomainUndefineFlags(domain, flags) < 0)
+ if (virDomainShutdownFlags(domain, flags) < 0)
virtDBusUtilSetLastVirtError(error);
}
@@ -471,49 +468,52 @@ virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED,
}
static void
-virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs G_GNUC_UNUSED,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
+virtDBusDomainUndefine(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainResume(domain) < 0)
+ if (virDomainUndefineFlags(domain, flags) < 0)
virtDBusUtilSetLastVirtError(error);
}
static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = {
- { "Name", virtDBusDomainGetName, NULL },
- { "UUID", virtDBusDomainGetUUID, NULL },
+ { "Active", virtDBusDomainGetActive, NULL },
+ { "Autostart", virtDBusDomainGetAutostart, NULL },
{ "Id", virtDBusDomainGetId, NULL },
+ { "Name", virtDBusDomainGetName, NULL },
{ "OSType", virtDBusDomainGetOsType, NULL },
- { "Active", virtDBusDomainGetActive, NULL },
{ "Persistent", virtDBusDomainGetPersistent, NULL },
{ "State", virtDBusDomainGetState, NULL },
- { "Autostart", virtDBusDomainGetAutostart, NULL },
+ { "UUID", virtDBusDomainGetUUID, NULL },
{ 0 }
};
static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
+ { "Create", virtDBusDomainCreate },
+ { "Destroy", virtDBusDomainDestroy },
+ { "GetStats", virtDBusDomainGetStats },
{ "GetVcpus", virtDBusDomainGetVcpus },
{ "GetXMLDesc", virtDBusDomainGetXMLDesc },
- { "GetStats", virtDBusDomainGetStats },
- { "Shutdown", virtDBusDomainShutdown },
- { "Destroy", virtDBusDomainDestroy },
{ "Reboot", virtDBusDomainReboot },
{ "Reset", virtDBusDomainReset },
- { "Create", virtDBusDomainCreate },
- { "Undefine", virtDBusDomainUndefine },
- { "Suspend", virtDBusDomainSuspend },
{ "Resume", virtDBusDomainResume },
+ { "Shutdown", virtDBusDomainShutdown },
+ { "Suspend", virtDBusDomainSuspend },
+ { "Undefine", virtDBusDomainUndefine },
{ 0 }
};
--
2.15.0
6 years, 8 months
[libvirt] [RFC] Defining firmware (OVMF, et al) metadata format & file
by Kashyap Chamarthy
Problem background
------------------
The various OVMF binary file names and paths are slightly different[+]
for each Linux distribution. And each high-level management tool
(libguestfs, oVirt, `virt-manager` and OpenStack Nova) is inventing its
own approach to detect and configure the said OVMF files. This email
thread is about arriving at some common understanding to make this a bit
more "unified" by addressing these needs in QEMU and libvirt.
Suggested approach
------------------
Based on an upstream discussion on 'virt-tools'[1] mailing list and some
Bugzillas, Gerd Hoffmann, Laszlo Ersek and Dan Berrangé had a suggestion
to define a firmware metadata format and file (example in [1]):
- For each firmware file we need a metadata file in a well defined
location, e.g. /usr/share/qemu/bios/ that lists stuff like:
- Path to the firmware binary
- Path to the pre-built OVMF 'vars' file (if any)
- Support architectures - associated QEMU feature flags (Secure
Boot)
- If the binary provides / requires SMM (System Management Mode)
Essentially, QEMU would define[*] the file format, and provide
metadata files from any ROMs it ships directly. If Linux
distributions / vendors ship extra ROMs like OVMF, etc then they
should provide suitable metadata files.
- Libvirt can read these metadata files and then pick the correct
firmware binary based on the settings for the guest.
- Management tools can then wire up the libvirt-based OVMF SB (Secure
Boot) configuration.
[*] Open question: Who, between QEMU and libvirt, should define the said
firmware metadata format and file?
References
----------
[1] A past proposal from Gerd to create a sort of a "firmware registry"
https://www.redhat.com/archives/virt-tools-list/2014-September/msg00145.html
[2] A libvirt upstream RFE bug requesting to simplify handling UEFI
https://bugzilla.redhat.com/show_bug.cgi?id=1295146 -- RFE: provide
a bios=uefi XML convenience option
[3] DanPB wrote a PoC in libvirt:
https://www.redhat.com/archives/libvir-list/2016-October/msg00045.html
-- [libvirt] [PATCH 0/3] Make UEFI firmware config simpler
But later came to the conclusion that it is flawed, and said we go
the route of "Suggested approach" mentioned earlier).
[*] OVMF package path names for different distributions
-------------------------------------------------------
- Debian (https://packages.debian.org/stretch/all/ovmf/filelist)
- /usr/share/OVMF/OVMF_CODE.fd
- /usr/share/OVMF/OVMF_VARS.fd
- OpenSUSE (package: "qemu-ovmf-x86_64" -- and it has *35*
files in that package):
- /usr/share/qemu/ovmf-x86_64-opensuse-code.bin
- /usr/share/qemu/ovmf-x86_64-opensuse-vars.bin [...]
Their RPM spec file gives some hints (where all the files with
'ms' means signed with MS keys; the files with 'opensuse-4096'
means signed with OpenSUSE 4096 bit CA keys -- I think that's one
of the points of Secure Boot, to let people have control over
system keys):
https://build.opensuse.org/package/view_file/openSUSE:Factory/ovmf/ovmf.s...
- Fedora 27 (package: "edk2-ovmf", x86_64):
- /usr/share/edk2/ovmf/OVMF_CODE.fd
- /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd
- /usr/share/edk2/ovmf/OVMF_VARS.fd
- RHEL-7.4 (package: "OVMF", x86_64):
- /usr/share/OVMF/OVMF_CODE.secboot.fd
- /usr/share/OVMF/OVMF_VARS.fd
- Gerd's firmware repo from Git:
- /usr/share/edk2.git/ovmf-x64/OVMF_VARS-need-smm.fd
- /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
--
/kashyap
6 years, 8 months
[libvirt] [PATCH 0/4] Fix a race to using monConfig
by John Ferlan
As reported by Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>:
https://www.redhat.com/archives/libvir-list/2018-March/msg01156.html
there is a race to using the priv->monConfig between the Create
and destroy domain processing. The patches describe the steps taken
to resolve the issue.
John Ferlan (4):
conf: Use virDomainChrSourceDefNew for vhostuser
qemu: Use virDomainChrSourceDefNew for monConfig
conf: Convert virDomainChrSourceDefNew to return object
qemu: Obtain reference on monConfig
src/conf/domain_conf.c | 37 ++++++++++++++++++++++++++++++++-----
src/conf/domain_conf.h | 3 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_process.c | 8 ++++++--
5 files changed, 43 insertions(+), 8 deletions(-)
--
2.13.6
6 years, 8 months
[libvirt] [dbus PATCH v2 0/8] Properties/Methods for Connect Interface
by Katerina Koukiou
Plus some minor fixes.
Changes from v1:
* Cabalitities property rewritten as method as dnb suggested.
* Added documentation on Secure and Encrypted properties as discussed.
Katerina Koukiou (8):
Implement GetCapabilities method for connect Interface
Implement Hostname property for Connect Interface
Implement LibVersion property for Connect Interface
Implement Encrypted property for Connect Interface
Implement Secure property for Connect Interface
Implement GetSysinfo method for connect Interface
All functions in src/connect.c should have virtDBusConnect prefix
Removing G_GNUC_UNUSED in cases where the parameter is used
data/org.libvirt.Connect.xml | 29 ++++++
src/connect.c | 209 ++++++++++++++++++++++++++++++++++---------
src/domain.c | 10 +--
test/test_connect.py | 11 +++
4 files changed, 214 insertions(+), 45 deletions(-)
--
2.15.0
6 years, 8 months