[libvirt] [PATCH v2] Provide a useful README file
by Daniel P. Berrange
The current README file contents has almost no useful info, and that
which does exist is very outdated.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
In v2:
- Use markdown syntax
- Use README.md file
- Symlink README to README.md
- Include travis build status
README | 14 +----------
README.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 13 deletions(-)
mode change 100644 => 120000 README
create mode 100644 README.md
diff --git a/README b/README
deleted file mode 100644
index 3d5167d..0000000
--- a/README
+++ /dev/null
@@ -1,13 +0,0 @@
-
- LibVirt : simple API for virtualization
-
- Libvirt is a C toolkit to interact with the virtualization capabilities
-of recent versions of Linux (and other OSes). It is free software
-available under the GNU Lesser General Public License. Virtualization of
-the Linux Operating System means the ability to run multiple instances of
-Operating Systems concurrently on a single hardware system where the basic
-resources are driven by a Linux instance. The library aim at providing
-long term stable C API initially for the Xen paravirtualization but
-should be able to integrate other virtualization mechanisms if needed.
-
-Daniel Veillard <veillard(a)redhat.com>
diff --git a/README b/README
new file mode 120000
index 0000000..42061c0
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.md
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c2bd2f8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,79 @@
+[](https://travis-ci.org...
+
+Libvirt API for virtualization
+==============================
+
+Libvirt provides a portable, long term stable C API for managing the
+virtualization technologies provided by many operating systems. It
+includes support for QEMU, KVM, Xen, LXC, BHyve, Virtuozzo, VMWare
+vCenter and ESX, VMWare Desktop, Hyper-V, VirtualBox and PowerHyp.
+
+For some of these hypervisors, it provides a stateful management
+daemon runs on the virtualization host allowing access to the API
+both by non-privileged local users and remote users.
+
+Layered packages provide bindings of the Libvirt C API into other
+languages including Python, Perl, Php, Go, Java, OCaml, as well as
+mappings into object systems such as GObject, CIM and SNMP.
+
+Further information about the libvirt project can be found on the
+website:
+
+* <https://libvirt.org>
+
+License
+-------
+
+The libvirt C API is distributed under the terms of GNU Lesser General
+Public License, version 2.1 (or later). Some parts of the code that are
+not part of the C library, may have the more restricted GNU General
+Public License, version 2.1 (or later). See the files COPYING.LESSER
+and COPYING for full license terms & conditions.
+
+Installation
+------------
+
+Libvirt uses the GNU Autotools build system, so in general can be built
+and installed with the normal commands. For example, to build in a manner
+that is suitable for installing as root, use:
+
+```
+# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+# make
+# sudo make install
+```
+
+While to build & install as an unprivileged user
+
+```
+# ./configure --prefix=$HOME/usr
+# make
+# make install
+```
+
+
+The libvirt code relies on a large number of 3rd party libraries. These will
+be detected during execution of the configure script and a summary printed
+which lists any missing (optional) dependancies.
+
+Contributing
+------------
+
+The libvirt project welcomes contributors from all. For most components
+the best way to contributor is to send patches to the primary development
+mailing list, using the 'git send-email' command. Further guidance on this
+can be found in the HACKING file, or the project website
+
+* <https://libvirt.org/contribute.html>
+
+Contact
+-------
+
+The libvirt project has two primary mailing lists:
+
+ * libvir-list(a)redhat.com (**for development**)
+ * libvirt-users(a)redhat.com (**for users**)
+
+Further details on contacting the project are available on the website
+
+* <https://libvirt.org/contact.html>
--
2.9.3
8 years
[libvirt] [libvirt-perl][PATCH] Add LIST_CAP_MDEV & LIST_CAP_MDEV_TYPES constants
by Michal Privoznik
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
The sparse streams are still missing. Working on that.
Changes | 2 +-
Virt.xs | 2 ++
lib/Sys/Virt/NodeDevice.pm | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
index 975de40..2e5bfe4 100644
--- a/Changes
+++ b/Changes
@@ -2,7 +2,7 @@ Revision history for perl module Sys::Virt
3.4.0 2017-06-00
- - XXX
+ - Add LIST_CAP_MDEV & LIST_CAP_MDEV_TYPES constants
3.3.0 2017-05-08
diff --git a/Virt.xs b/Virt.xs
index 99d0db9..9ccdc1f 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8938,6 +8938,8 @@ BOOT:
REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS, LIST_CAP_VPORTS);
REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC, LIST_CAP_SCSI_GENERIC);
REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM, LIST_CAP_DRM);
+ REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV, LIST_CAP_MDEV);
+ REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES, LIST_CAP_MDEV_TYPES);
REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE);
REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_UPDATE, EVENT_ID_UPDATE);
diff --git a/lib/Sys/Virt/NodeDevice.pm b/lib/Sys/Virt/NodeDevice.pm
index 3528c41..32bc75c 100644
--- a/lib/Sys/Virt/NodeDevice.pm
+++ b/lib/Sys/Virt/NodeDevice.pm
@@ -169,6 +169,14 @@ Include devices with the SCSI generic capability
Include devices with the DRM capability
+=item Sys::Virt::NodeDevice::LIST_CAP_MDEV
+
+Include mediated devices
+
+=item Sys::Virt::NodeDevice::LIST_CAP_MDEV_TYPES
+
+Include devices capable of mediated devices
+
=back
=head2 EVENT ID CONSTANTS
--
2.13.0
8 years
[libvirt] [PATCH] virStreamSparseSendAll: Reset @want in each iteration
by Michal Privoznik
There's a slight problem with the current function. Assume we are
currently in a data section and we have say 42 bytes until next
section (okay, in reality sections are capped to the sector size,
but bear with me). Therefore, just before (handler) is called to
fill up the buffer with data, @want is changed to 42 to match the
amount of data left in the current section. However, after hole
is processed, we are back in data section but with incredibly
small @want size. Nobody will ever reset it back. This results in
incredible data fragmentation.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt-stream.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index ed0ed7325..d7a8f5816 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -698,7 +698,7 @@ int virStreamSparseSendAll(virStreamPtr stream,
void *opaque)
{
char *bytes = NULL;
- size_t want = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
+ size_t bufLen = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
int ret = -1;
unsigned long long dataLen = 0;
@@ -718,12 +718,13 @@ int virStreamSparseSendAll(virStreamPtr stream,
goto cleanup;
}
- if (VIR_ALLOC_N(bytes, want) < 0)
+ if (VIR_ALLOC_N(bytes, bufLen) < 0)
goto cleanup;
for (;;) {
int inData, got, offset = 0;
long long sectionLen;
+ size_t want = bufLen;
const unsigned int skipFlags = 0;
if (!dataLen) {
--
2.13.0
8 years
[libvirt] Various apparmor related changes (part 1)
by Stefan Bader
Over the years there have been a bunch of changes to the
apparmor profiles and/or virt-aa-helper which have been
carried in Debian/Ubuntu but never made it upstream.
In an attempt to clean this up and generally improve the
apparmor based environments, we (Christian and I) went
over the changes, cleaned out cruft as much as possible
and would be sending out hunks of changes to this list
for upstream inclusion.
I hope doing multiple but smaller rounds of submissions
will make it simpler to get those reviewed and hopefully
accepted.
This first batch contains a mix of changes from Debian
and Ubuntu.
Thanks,
Stefan
8 years
[libvirt] [PATCH] virCapabilitiesInitCaches: Don't leak cache dir
by Michal Privoznik
To every virDirOpen we must have VIR_DIR_CLOSE otherwise FD is
leaked.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/capabilities.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index d699b0817..a91a72a35 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1555,6 +1555,8 @@ virCapabilitiesInitCaches(virCapsPtr caps)
if (virAsprintf(&path, "%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos) < 0)
goto cleanup;
+ VIR_DIR_CLOSE(dirp);
+
rv = virDirOpenIfExists(&dirp, path);
if (rv < 0)
goto cleanup;
@@ -1639,7 +1641,7 @@ virCapabilitiesInitCaches(virCapsPtr caps)
cleanup:
VIR_FREE(type);
VIR_FREE(path);
- virDirClose(&dirp);
+ VIR_DIR_CLOSE(dirp);
virCapsHostCacheBankFree(bank);
return ret;
}
--
2.13.0
8 years
[libvirt] [PATCH] Revert "qemu: propagate bridge MTU into qemu "host_mtu" option"
by Laine Stump
This reverts commit 2841e675.
It turns out that adding the host_mtu field to the PCI capabilities in
the guest bumps the length of PCI capabilities beyond the 32 byte
boundary, so the virtio-net device gets 64 bytes of ioport space
instead of 32, which offsets the address of all the other following
devices. Migration doesn't work very well when the location and length
of PCI capabilities of devices is changed between source and
destination.
This means that we need to make sure that the absence/presence of
host_mtu on the qemu commandline always matches between source and
destination, which means that we need to make setting of host_mtu an
opt-in thing (it can't happen automatically when the bridge being used
has a non-default MTU, which is what commit 2841e675 implemented).
I do want to re-implement this feature with an <mtu auto='on'/>
setting, but probably won't backport that to any stable branches, so
I'm first reverting the original commit, and that revert can be pushed
to the few releases that have been made since the original (3.1.0 -
3.3.0)
Resolves: https://bugzilla.redhat.com/1449346
---
src/qemu/qemu_command.c | 32 ++++++++++----------------------
src/qemu/qemu_command.h | 3 +--
src/qemu/qemu_hotplug.c | 5 ++---
src/qemu/qemu_interface.c | 5 ++---
src/qemu/qemu_interface.h | 3 +--
5 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4c1a266..aa66e3d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3633,8 +3633,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
int vlan,
unsigned int bootindex,
size_t vhostfdSize,
- virQEMUCapsPtr qemuCaps,
- unsigned int mtu)
+ virQEMUCapsPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *nic = net->model;
@@ -3758,23 +3757,13 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
}
- if (usingVirtio && mtu) {
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
-
- virBufferAsprintf(&buf, ",host_mtu=%u", mtu);
-
- } else {
- /* log an error if mtu was requested specifically for this
- * interface, otherwise, if it's just what was reported by
- * the attached network, ignore it.
- */
- if (net->mtu) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("setting MTU is not supported with "
- "this QEMU binary"));
- goto error;
- }
+ if (usingVirtio && net->mtu) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("setting MTU is not supported with this QEMU binary"));
+ goto error;
}
+ virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu);
}
if (vlan == -1)
@@ -8320,7 +8309,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
VIR_FREE(netdev);
if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
- queues, qemuCaps, net->mtu))) {
+ queues, qemuCaps))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error generating NIC -device string"));
goto error;
@@ -8366,7 +8355,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
virDomainNetType actualType = virDomainNetGetActualType(net);
virNetDevBandwidthPtr actualBandwidth;
size_t i;
- unsigned int mtu = net->mtu;
if (!bootindex)
@@ -8421,7 +8409,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
if (qemuInterfaceBridgeConnect(def, driver, net,
- tapfd, &tapfdSize, &mtu) < 0)
+ tapfd, &tapfdSize) < 0)
goto cleanup;
break;
@@ -8601,7 +8589,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
}
if (qemuDomainSupportsNicdev(def, net)) {
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
- vhostfdSize, qemuCaps, mtu)))
+ vhostfdSize, qemuCaps)))
goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL);
} else {
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 7da92c8..09cb00e 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -101,8 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def,
int vlan,
unsigned int bootindex,
size_t vhostfdSize,
- virQEMUCapsPtr qemuCaps,
- unsigned int mtu);
+ virQEMUCapsPtr qemuCaps);
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e8d2918..a1909e3 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -968,7 +968,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool charDevPlugged = false;
bool netdevPlugged = false;
bool hostPlugged = false;
- unsigned int mtu = net->mtu;
/* preallocate new slot for device */
if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
@@ -1025,7 +1024,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
goto cleanup;
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
if (qemuInterfaceBridgeConnect(vm->def, driver, net,
- tapfd, &tapfdSize, &mtu) < 0)
+ tapfd, &tapfdSize) < 0)
goto cleanup;
iface_connected = true;
if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
@@ -1239,7 +1238,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
VIR_FORCE_CLOSE(vhostfd[i]);
if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
- queueSize, priv->qemuCaps, mtu)))
+ queueSize, priv->qemuCaps)))
goto try_remove;
qemuDomainObjEnterMonitor(driver, vm);
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index d8a678b..cebb490 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -503,8 +503,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
int *tapfd,
- size_t *tapfdSize,
- unsigned int *mtu)
+ size_t *tapfdSize)
{
const char *brname;
int ret = -1;
@@ -545,7 +544,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
def->uuid, tunpath, tapfd, *tapfdSize,
virDomainNetGetActualVirtPortProfile(net),
virDomainNetGetActualVlan(net),
- net->coalesce, net->mtu, mtu,
+ net->coalesce, 0, NULL,
tap_create_flags) < 0) {
virDomainAuditNetDevice(def, net, tunpath, false);
goto cleanup;
diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h
index ba74ac2..a7faa0b 100644
--- a/src/qemu/qemu_interface.h
+++ b/src/qemu/qemu_interface.h
@@ -51,8 +51,7 @@ int qemuInterfaceBridgeConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
int *tapfd,
- size_t *tapfdSize,
- unsigned int *mtu)
+ size_t *tapfdSize)
ATTRIBUTE_NONNULL(2);
int qemuInterfaceOpenVhostNet(virDomainDefPtr def,
--
2.9.4
8 years
[libvirt] [PATCH] util: Don't leak @replay in virSystemdGetMachineNameByPID
by Wang King
@reply is a DBusMessage object returned by virDBusCallMethod in
get machine object call path, dereference it before calling
virDBusCallMethod again to get machine name.
---
src/util/virsystemd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 83737a2..5d9746f 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -247,6 +247,9 @@ virSystemdGetMachineNameByPID(pid_t pid)
if (virDBusMessageRead(reply, "o", &object) < 0)
goto cleanup;
+ virDBusMessageUnref(reply);
+ reply = NULL;
+
VIR_DEBUG("Domain with pid %lld has object path '%s'",
(long long) pid, object);
--
2.8.3
8 years
[libvirt] [PATCH] allow to control host side link status of ethernet network device
by Vasiliy Tolstov
Back to old thread with Laine Stump with message title:
"qemu: remove unnecessary setting of tap device online state"
I'm not tested ip and route assign in case of up/down link and
device update on the fly. But host side link status tested and worked
fine.
Vasiliy Tolstov (1):
qemu: allow to control host side link status of network device
docs/formatdomain.html.in | 21 +++++++++++++++++++++
docs/schemas/domaincommon.rng | 11 +++++++++++
src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_hotplug.c | 17 +++++++++++++++++
src/qemu/qemu_interface.c | 8 ++++----
6 files changed, 82 insertions(+), 4 deletions(-)
--
2.9.3
8 years
[libvirt] [PATCH] Do not release unreserved address in qemuDomainAttachRNGDevice
by Ján Tomko
Only set releaseaddr to true after the address has been
reserved successfully.
https://bugzilla.redhat.com/show_bug.cgi?id=1452581
---
src/qemu/qemu_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e8d2918..22759d4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2090,7 +2090,6 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
rng->source.file))
goto cleanup;
}
- releaseaddr = true;
if (rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
@@ -2103,6 +2102,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
!rng->info.addr.ccw.assigned) < 0)
goto cleanup;
}
+ releaseaddr = true;
if (qemuDomainNamespaceSetupRNG(driver, vm, rng) < 0)
goto cleanup;
--
2.10.2
8 years
[libvirt] [PATCH] libxl: add default VNC listen address
by Jim Fehlig
If a VNC listen address is not specified in domXML, libxl will
default to 127.0.0.1, but this is never reflected in the domXML.
If not specified, set the listen address in virDomainGraphicsDef
struct to the libxl default when creating the frame buffer device.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334562
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 56bc09719..0c5d7a700 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1227,12 +1227,16 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
}
x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN;
- if ((glisten = virDomainGraphicsGetListen(l_vfb, 0)) &&
- glisten->address) {
- /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */
- VIR_FREE(x_vfb->vnc.listen);
- if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0)
- return -1;
+ if ((glisten = virDomainGraphicsGetListen(l_vfb, 0))) {
+ if (glisten->address) {
+ /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */
+ VIR_FREE(x_vfb->vnc.listen);
+ if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0)
+ return -1;
+ } else {
+ if (VIR_STRDUP(glisten->address, "127.0.0.1") < 0)
+ return -1;
+ }
}
if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0)
return -1;
--
2.11.0
8 years