[libvirt] [PATCH 0/2] Add two string helper methods
by Daniel P. Berrange
As mentioned in my review, I took the first two patches from
this series and polished them up ready for merge
https://www.redhat.com/archives/libvir-list/2014-January/msg01067.html
Hopefully this should be good enough for the vbox snapshot
work to use.
Changes since that posting
- Added unit tests
- Changed virStringSearch API to return all matches in one
go, rather than need repeated calls
- Rewrote virStringReplace to use virBuffer APIs
Daniel P. Berrange (1):
Add virStringReplace method for substring replacement
Manuel VIVES (1):
Add virStringSearch method for regex matching
po/POTFILES.in | 1 +
src/libvirt_private.syms | 2 +
src/util/virstring.c | 146 ++++++++++++++++++++++++++++++++++++++++++-
src/util/virstring.h | 12 ++++
tests/virstringtest.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 319 insertions(+), 1 deletion(-)
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] lxc: Add destroy support for suspended domains
by Richard Weinberger
Destroying a suspended domain needs special action.
We cannot simply terminate all process because they are frozen.
Do deal with that we send them SIGKILL and thaw them.
Upon wakeup the process sees the pending signal and dies immediately.
Signed-off-by: Richard Weinberger <richard(a)nod.at>
---
src/lxc/lxc_process.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index ed729f6..b518dce 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -697,6 +697,30 @@ int virLXCProcessStop(virLXCDriverPtr driver,
VIR_FREE(vm->def->seclabels[0]->imagelabel);
}
+ /* If the LXC domain is suspended we send all processes a SIGKILL
+ * and thaw them. Upon wakeup the process sees the pending signal
+ * and dies immediately. It is guaranteed that priv->cgroup != NULL
+ * here because the domain has aleady been suspended using the
+ * freezer cgroup.
+ */
+ if (reason == VIR_DOMAIN_SHUTOFF_DESTROYED &&
+ virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
+ if (virCgroupKillRecursive(priv->cgroup, SIGKILL) <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to kill all processes"));
+ return -1;
+ }
+
+ if (virCgroupSetFreezerState(priv->cgroup, "THAWED") < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Unable to thaw all processes"));
+
+ return -1;
+ }
+
+ goto cleanup;
+ }
+
if (priv->cgroup) {
rc = virCgroupKillPainfully(priv->cgroup);
if (rc < 0)
@@ -716,6 +740,7 @@ int virLXCProcessStop(virLXCDriverPtr driver,
}
}
+cleanup:
virLXCProcessCleanup(driver, vm, reason);
return 0;
--
1.8.4.5
10 years, 9 months
[libvirt] [PATCH v10] bhyve: add a basic driver
by Roman Bogorodskiy
Changes from v9:
- Fix AC_PATH_PROG macro usage for bhyve tools
- Check for readdir() failures
- Make sure we go only with disk type 'file'
- Remove unneeded locking from bhyveConnectGetCapabilities()
- Don't check for NULL before calling virObjectUnlock()
- s/INFO/DEBUG/ for low level domain operations
- Ignore logfd close errors in bhyve_process.c
- Drop unneeded virReportError for virDomainDefParseString()
- Indent and style fixes
Changes from v8:
- Implement domainUndefine and two more functions it depends on:
domainIsActive and bhyveDomainIsPersistent
Changes from v7:
- Squashed in ACL support
- Check for disk and bus type for bhyve and disk type for bhyveload
- Handle case when URI == NULL in ConnectOpen
- Call bhyveload only after we've built bhyve command to avoid
unneeded load/reload for wrong domain configuration
- Cleanup unload calls on errors
- Minor style fixes
Changes from v6:
- Fix typo: s/LIBIVRT_DRIVER_RESULT_BHYVE/LIBVIRT_DRIVER_RESULT_BHYVE/
- Report domain state in 'dominfo'
- Add a patch which implements ACL support
Now both 'make check' and 'make syntax-check' pass.
Changes from v5:
- Obtain version using uname(3)
- Cleanup driver global objects in StateCleanup instead
of ConnectClose
Changes from v4:
- Set acpi and apic flags based on domain definition
- Add more detailed description about -H and -P flags
of bhyve to justify theirs usage
Roman Bogorodskiy (1):
bhyve: add a basic driver
configure.ac | 7 +
daemon/libvirtd.c | 9 +
include/libvirt/virterror.h | 1 +
m4/virt-driver-bhyve.m4 | 57 +++++
po/POTFILES.in | 3 +
src/Makefile.am | 32 +++
src/bhyve/bhyve_command.c | 331 ++++++++++++++++++++++++
src/bhyve/bhyve_command.h | 41 +++
src/bhyve/bhyve_driver.c | 612 ++++++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_driver.h | 28 ++
src/bhyve/bhyve_process.c | 224 ++++++++++++++++
src/bhyve/bhyve_process.h | 36 +++
src/bhyve/bhyve_utils.h | 48 ++++
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 3 +
src/util/virerror.c | 1 +
18 files changed, 1437 insertions(+), 1 deletion(-)
create mode 100644 m4/virt-driver-bhyve.m4
create mode 100644 src/bhyve/bhyve_command.c
create mode 100644 src/bhyve/bhyve_command.h
create mode 100644 src/bhyve/bhyve_driver.c
create mode 100644 src/bhyve/bhyve_driver.h
create mode 100644 src/bhyve/bhyve_process.c
create mode 100644 src/bhyve/bhyve_process.h
create mode 100644 src/bhyve/bhyve_utils.h
--
1.8.4.3
10 years, 9 months
[libvirt] [PATCHv3 00/10] Add BlkIO and CPU/mem stat API implementations for lxc
by Thorsten Behrens
This patch set adds block io, memory and domain cpu statistics API
slot implementations to the LXC driver, in order to get linux
container monitoring and accounting a bit closer to qemu standards.
The last patch is a tad quirky (happy to hear suggestions on
alternative ways), in that it widens the permissible value set
at the .domainBlockStats slot: for lxc guests, it is relatively
likely to have zero disk devices, since host filesystems can be
used via passthrough bind mounts. Therefore, passing the zero-length
string as device path, is interpreted as 'return summary stats for
the entire domains's block io'.
v3 addresses review comments, and adds unit tests for good measure.
Thorsten Behrens (10):
Add util virCgroupGetBlkioIo*Serviced methods.
Implement domainMemoryStats API slot for LXC driver.
Make qemuGetDomainTotalCPUStats a virCgroup function.
Implement domainGetCPUStats for lxc driver.
Implement lxcDomainBlockStats* for lxc driver
Widening API change - accept empty path for virDomainBlockStats
Add unit test for virCgroupGetBlkioIo*Serviced
Add unit test for virCgroupGetMemoryUsage.
Fix misspelled cpuacct.usage_percpu in cgroup mock.
Add unit test for virCgroupGetPercpuStats.
src/libvirt.c | 8 +-
src/libvirt_private.syms | 4 +
src/lxc/lxc_driver.c | 297 +++++++++++++++++++++++++++++++++
src/qemu/qemu_driver.c | 54 +-----
src/util/vircgroup.c | 382 +++++++++++++++++++++++++++++++++++++++++++
src/util/vircgroup.h | 24 +++
tests/vircgroupmock.c | 109 +++++++++++-
tests/vircgrouptest.c | 234 ++++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 11 +-
tools/virsh.pod | 5 +-
10 files changed, 1066 insertions(+), 62 deletions(-)
--
1.8.4
10 years, 9 months
[libvirt] [PATCH V2 00/13] libxl: add job support
by Jim Fehlig
This patch series adds job support to the libxl driver, using a simplified
version of the technique used in the qemu driver. One benefit of this
series is no longer blocking get operations during long running modify
operations. E.g. with these patches 'vish dominfo dom' will work while
'virsh save dom ...' is in progress.
The first two patches are new to the series, following review of V1.
Patch1 changes the cleanup logic to unconditionally set dom id to -1 on
domain shutdown. Patch2 removes libxlVmReap, giving callers more control
over domain destruction/cleanup.
The remaining patches are updates to V1 based on Daniel's and Michal's
comments.
Jim Fehlig (13):
libxl: always set vm id to -1 on shutdown
libxl: remove libxlVmReap function
libxl: Add job support to libxl driver
libxl: use job functions in libxlVmStart
libxl: use job functions in libxlDomainSetMemoryFlags
libxl: use job functions in libxlDomain{Suspend,Resume}
libxl: use job functions when cleaning up a domain
libxl: use job functions in domain save operations
libxl: use job functions in libxlDomainCoreDump
libxl: use job functions in vcpu set and pin functions
libxl: use job functions in device attach and detach functions
libxl: use job functions in libxlDomainSetAutostart
libxl: use job functions in libxlDomainSetSchedulerParametersFlags
src/libxl/libxl_domain.c | 128 +++++++++++++++
src/libxl/libxl_domain.h | 38 +++++
src/libxl/libxl_driver.c | 405 +++++++++++++++++++++++++++++++----------------
3 files changed, 432 insertions(+), 139 deletions(-)
--
1.8.1.4
10 years, 9 months
[libvirt] [PATCH 0/2] Introduce max_anonymous_clients
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=981729
So far we can limit how many clients are connected,
how many are waiting in accept() line but we could
not control the count of accepted but not
authenticated yet.
Michal Privoznik (2):
virNetServer: Introduce unauth clients counter
daemon: Introduce max_anonymous_clients
daemon/libvirtd-config.c | 1 +
daemon/libvirtd-config.h | 1 +
daemon/libvirtd.aug | 1 +
daemon/libvirtd.c | 1 +
daemon/libvirtd.conf | 3 ++
daemon/remote.c | 21 ++++++++-----
daemon/test_libvirtd.aug.in | 1 +
src/locking/lock_daemon.c | 4 +--
src/lxc/lxc_controller.c | 2 +-
src/rpc/virnetserver.c | 73 +++++++++++++++++++++++++++++++++++++++++----
src/rpc/virnetserver.h | 3 ++
11 files changed, 95 insertions(+), 16 deletions(-)
--
1.8.5.1
10 years, 9 months
[libvirt] [PATCHv6 0/5] Handling of undefine and redefine snapshots with VirtualBox 4.2
by Manuel VIVES
Hi,
This is a serie of patches in order to support undefining and redefining
snapshots with VirtualBox 4.2.
The serie of patches is rather big, and adds among other things some utility
functions unrelated to VirtualBox in patches 1 & 2.
The code review could be done in several parts: e.g. patches 1 & 2 separately to
validate the utility functions.
The VirtualBox API provides only high level operations to manipulate snapshots,
so it not possible to support flags like VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE and
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY with only API calls.
Following an IRC talk with Eric Blake, the decision was taken to emulate these
behaviours by manipulating directly the .vbox XML files.
The first two patches are some util methods for handling regexp and strings that
will be used after.
The third patch brings more details in the snapshot XML returned by libvirt.
We will need those modifications in order to redefine the snapshots.
The fourth patch brings the support of the VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
and VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flags in virDomainSnapshotCreateXML.
The fifth and last patch brings the support of the
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY
flag in virDomainSnapshotDelete.
The patches are only tested with Virtualbox 4.2 but the code is
compliant with Virtualbox 4.3 API.
Regards,
Manuel VIVES
v6:
* Rebased because of a massive change in vbox_tmpl.c due to changes in
the handling of different versions of VirtualBox
v5:
* The patches are modified according to a first review by Laine Stump:
* renamed virSearchUuid to virSearchRegex and moved it from
viruuid.{c,h} to virstring.{c,h}.
* Various fixes.
V4:
* The code is compliant with Virtualbox 4.3 API
* Some minor modifications in order to satisfy "make syntax-check"
V3:
* Use of STREQ_NULLABLE instead of STREQ in one case
* Fix the method for finding uuids according to Ján Tomko review
V2:
* Fix a licence problem with the method for string replacement
Manuel VIVES (5):
virstring.h/c: Util method for finding regexp patterns in some
strings
virstring.h/c: Util method for making some find and replace in
strings
vbox_tmpl.c: Better XML description for snapshots
vbox_tmpl.c: Patch for redefining snapshots
vbox_tmpl.c: Add methods for undefining snapshots
po/POTFILES.in | 1 +
src/libvirt_private.syms | 2 +
src/util/virstring.c | 163 +++-
src/util/virstring.h | 4 +
src/vbox/vbox_tmpl.c | 2346 ++++++++++++++++++++++++++++++++++++++++++----
5 files changed, 2346 insertions(+), 170 deletions(-)
--
1.7.10.4
10 years, 9 months
[libvirt] Reporting log/error messages through capabilities
by Richard W.M. Jones
When qemu is completely broken, libvirtd starts up OK but exists in a
kind of broken state where no guests can possibly be run. I hit this
problem ... again ... today:
https://bugzilla.redhat.com/show_bug.cgi?id=1066630#c0
There is a libvirt bug here, which is that it's very hard to diagnose
what is going on when qemu fails to work at all. The logging system
in libvirt(d) is trememdously powerful, but ultimately confusing to
use, and requires users to edit config files which makes it a
non-starter for programs using libvirt through the API [1].
>From a libguestfs point of view, it's impossible for us to report back
to the user that there is a problem two layers below in qemu.
So my idea is that libvirt capabilities output should have an <info>
section containing log messages/errors.
<capabilities>
...
<info>
Could not run qemu-system-blah:
"symbol lookup error: /usr/bin/qemu-system-s390x: undefined symbol: glfs_discard_async"
</info>
</capabilities>
Libguestfs queries for libvirt capabilities anyway. If we don't get a
satisfactory set of <guest/> elements, then we could list out the
<info/> section. Easy for us.
The problem is the <info/> element hardly fits into capabilities. If
we didn't put it there, could it go some other place? Or a new API?
Are there other unanticipated problems here? I think one is that
libvirt doesn't appear to collect detailed log information by default,
(unless the user edits log_level). That's assuming I understand the
code correctly. Personally I think libvirt should always collect
debug information, because you never know when it could be useful, but
for the above, collecting errors & warnings unconditionally is
sufficient.
Rich.
[1] By the way, this is a general complaint about libvirt. Please
DON'T add any more stuff to the configuration file. Everything should
be configurable through the API, or not at all. There are two other
settings I can think of that libguestfs would like to adjust but
cannot because they are only available in a configuration file.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
10 years, 9 months
[libvirt] [PATCH v2] qemu: Use virtio network device for aarch64/virt
by Oleg Strikov
This patch changes network device type used by default from rtl8139
to virtio when architecture type is aarch64 and machine type is virt.
Qemu doesn't support any other machine types for aarch64 right now and
we can't make any other aarch64-specific tuning in this function yet.
Signed-off-by: Oleg Strikov <oleg.strikov(a)canonical.com>
---
Changes since v1:
* qemuxml2argvtest suite has been extended to validate correct setup
for aarch64 guests when no NIC model is provided in the XML
src/qemu/qemu_domain.c | 3 ++-
.../qemuxml2argv-aarch64-virt-default-nic.args | 6 ++++++
.../qemuxml2argv-aarch64-virt-default-nic.xml | 22 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 +++
4 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a665061..9a040ee 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -797,7 +797,8 @@ qemuDomainDefaultNetModel(const virDomainDef *def)
def->os.arch == VIR_ARCH_S390X)
return "virtio";
- if (def->os.arch == VIR_ARCH_ARMV7L) {
+ if (def->os.arch == VIR_ARCH_ARMV7L ||
+ def->os.arch == VIR_ARCH_AARCH64) {
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
new file mode 100644
index 0000000..d4d403b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 \
+-usb -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
+-net user,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
new file mode 100644
index 0000000..868de94
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
@@ -0,0 +1,22 @@
+<domain type="qemu">
+ <name>aarch64-virt-default-nic</name>
+ <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>1</vcpu>
+ <features>
+ <acpi/>
+ </features>
+ <os>
+ <type arch="aarch64" machine="virt">hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <cmdline>console=ttyAMA0</cmdline>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7a5b50d..43ac1d1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1335,6 +1335,9 @@ mymain(void)
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("aarch64-virt-default-nic",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO);
DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
--
1.7.9.5
10 years, 9 months
[libvirt] [PATCH] networkRunHook: Run hook only if possible
by Michal Privoznik
Currently, networkRunHook() is called in networkAllocateActualDevice and
friends. These functions, however, doesn't necessarily work on networks,
For example, if domain's interface is defined in this fashion:
<interface type='bridge'>
<mac address='52:54:00:0b:3b:16'/>
<source bridge='virbr1'/>
<model type='rtl8139'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</interface>
The networkAllocateActualDevice jumps directly onto 'validate' label as
the interface is not type of 'network'. Hence, @network is left
initialized to NULL and networkRunHook(network, ...) is called. One of
the things that the hook function does is dereference @network. Soupir.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/network/bridge_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index ee264b9..a6c719d 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -150,6 +150,12 @@ networkRunHook(virNetworkObjPtr network,
int ret = -1;
if (virHookPresent(VIR_HOOK_DRIVER_NETWORK)) {
+ if (!network) {
+ VIR_DEBUG("Not running hook as @network is NULL");
+ ret = 0;
+ goto cleanup;
+ }
+
virBufferAddLit(&buf, "<hookData>\n");
virBufferAdjustIndent(&buf, 2);
if (virNetworkDefFormatBuf(&buf, network->def, 0) < 0)
--
1.9.0
10 years, 9 months