[libvirt] [PATCH] nodedev: stub nodeDeviceSysfsGetPCIRelatedDevCaps
by Roman Bogorodskiy
Add a stub for nodeDeviceSysfsGetPCIRelatedDevCaps() for non-Linux
platforms. It allows nodedev driver to work on non-Linux platoforms
that, however, have HAL.
---
src/node_device/node_device_linux_sysfs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 431f471..24a6a2e 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -238,4 +238,11 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapDataPtr d ATTRIBUTE_UNUSED)
return -1;
}
+int
+nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath ATTRIBUTE_UNUSED,
+ virNodeDevCapDataPtr data ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
#endif /* __linux__ */
--
2.4.6
8 years, 9 months
[libvirt] set a different default gateway in an isolated network
by pichon
Hello,
I would like to set a specify default gateway for my VMs. However I’m not succeeding
Here after is the isolated lan, where I added the statement <route address='10.0.0.0' prefix='8' gateway='10.10.0.7’/> where my aim is to route to the 10.10.0.7
What should I do , to make it works ?
Thanks
<network>
<name>prd-private-lan</name>
<uuid>255083f4-05a1-4a24-bc66-d3a3a9ab0724</uuid>
<bridge name='virbr3' stp='off' delay='0'/>
<mac address='52:54:00:08:1e:d8'/>
<domain name='prd.pipiche.net'/>
<dns>
<forwarder addr='8.8.4.4'/>
<forwarder addr='8.8.8.8'/>
</dns>
<ip address='10.10.0.1' netmask='255.255.255.0'>
<dhcp>
<range start='10.10.0.128' end='10.10.0.254'/>
<host mac='52:54:10:b6:35:ca' ip='10.10.0.3'/>
<host mac='52:54:10:5f:92:05' ip='10.10.0.7'/>
<host mac='52:54:10:7d:3a:3f' ip='10.10.0.10'/>
<host mac='52:54:10:30:93:56' ip='10.10.0.21'/>
<host mac='52:54:10:78:c1:c2' ip='10.10.0.22'/>
<host mac='52:54:10:64:00:21' ip='10.10.0.25'/>
<host mac='52:54:10:5a:5f:63' ip='10.10.0.26'/>
<host mac='52:54:10:4c:b2:61' ip='10.10.0.27'/>
<host mac='52:54:10:62:de:5f' ' ip='10.10.0.62'/>
</dhcp>
</ip>
<route address='10.0.0.0' prefix='8' gateway='10.10.0.7'/>
</network>
When looking on the VM (guest) the route is not correctly set
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.0.0 0.0.0.0 255.255.255.0 U 100 0 0 ens4
arp -a
? (10.10.0.1) at 52:54:00:08:1e:d8 [ether] on ensue
ifconfig
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.0.27 netmask 255.255.255.0 broadcast 10.10.0.255
inet6 fe80::5054:10ff:fe4c:b261 prefixlen 64 scopeid 0x20<link>
ether 52:54:10:4c:b2:61 txqueuelen 1000 (Ethernet)
RX packets 1805 bytes 153644 (150.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1745 bytes 136075 (132.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
8 years, 9 months
[libvirt] [PATCH v4 0/9] add close callback for drivers with persistent connection
by Nikolay Shirokovskiy
Currently close callback API can only inform us of closing the connection
between remote driver and daemon. But what if a driver running in the
daemon itself can have another persistent connection? In this case
we want to be informed of that connection changes state too.
This patch series extends meaning of current close callback API so
that now it notifies of closing of any internal persistent connection.
The overall approach is to move close callback support to drivers.
Changes from v3:
================
Add patch [3] "close callback: make unregister clean after connect close event."
Make register/unregister methods of connection close callback object
return void. This solves the problem of patch [8] "daemon: add connection close rpc"
([7] in previous version) of consistent unregistering. All checks are
moved outside of the methods. I hesitate whether to add or not means
that track connection close callback object consinstency and finally
decided to add (checks and warnings inside methods). The reason is that
without these checks we get memory leaks which are rather difficult
to find out. Unfortunately this change touch a number of patches as
the first change is done in the first patch of the series.
Changes from v2:
================
Split patches further to make it more comprehensible.
Nikolay Shirokovskiy (9):
factor out virConnectCloseCallbackDataPtr methods
virConnectCloseCallbackData: fix connection object refcount
close callback: make unregister clean after connect close event
virConnectCloseCallbackData: factor out callback disarming
close callback API: remove unnecessary locks
virConnectCloseCallbackDataDispose: remove unnecessary locks
close callback: move it to driver
daemon: add connection close rpc
vz: implement connection close notification
daemon/libvirtd.h | 1 +
daemon/remote.c | 84 ++++++++++++++++++++++++++++++
src/datatypes.c | 118 ++++++++++++++++++++++++++++++++++---------
src/datatypes.h | 16 ++++--
src/driver-hypervisor.h | 12 +++++
src/libvirt-host.c | 46 ++---------------
src/remote/remote_driver.c | 114 ++++++++++++++++++++++++++++++++++-------
src/remote/remote_protocol.x | 24 ++++++++-
src/remote_protocol-structs | 6 +++
src/vz/vz_driver.c | 59 ++++++++++++++++++++++
src/vz/vz_sdk.c | 4 ++
src/vz/vz_utils.h | 3 ++
12 files changed, 397 insertions(+), 90 deletions(-)
--
1.8.3.1
8 years, 9 months
[libvirt] [PATCH] rbd: Allow shrinking and deltas when resizing RBD volumes
by Wido den Hollander
Modify virCheckFlags that it accepts both VIR_STORAGE_VOL_RESIZE_DELTA
and VIR_STORAGE_VOL_RESIZE_SHRINK as valid flags for resizing RBD
volumes.
This still does not solve the problem where RBD volumes can't be
shrinked using libvirt. The allocation and capacity of RBD volumes
are equal for a RBD volume and this makes libvirt think the volume
is fully allocated and therefor can't be shrinked.
Signed-off-by: Wido den Hollander <wido(a)widodh.nl>
---
src/storage/storage_backend_rbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 80a1d33..88b613a 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -1041,7 +1041,8 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
int ret = -1;
int r = 0;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STORAGE_VOL_RESIZE_DELTA |
+ VIR_STORAGE_VOL_RESIZE_SHRINK, -1);
if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
goto cleanup;
--
1.9.1
8 years, 9 months
[libvirt] [PATCH] util: Fix virCgroupNewMachine ATTRIBUTE_NONNULL args
by John Ferlan
Commit id 'c3bd0019c0' removed arg3, but forgot to adjust the numbers
for NONNULL - caused build failure for coverity
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed as build breaker
src/util/vircgroup.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index bec88dc..46d3ace 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -110,7 +110,7 @@ int virCgroupNewMachine(const char *name,
int controllers,
virCgroupPtr *group)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
- ATTRIBUTE_NONNULL(4);
+ ATTRIBUTE_NONNULL(3);
int virCgroupTerminateMachine(const char *name)
ATTRIBUTE_NONNULL(1);
--
2.5.0
8 years, 9 months
[libvirt] [PATCH] bhyve: fix preprocessor indentation
by Roman Bogorodskiy
Syntax-check fails with:
cppi: src/bhyve/bhyve_driver.h: line 26: not properly indented
cppi: src/bhyve/bhyve_driver.h: line 27: not properly indented
maint.mk: incorrect preprocessor indentation
Fix by properly indenting '#include's.
Pushed as trivial.
---
src/bhyve/bhyve_driver.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bhyve/bhyve_driver.h b/src/bhyve/bhyve_driver.h
index a290c4a..fb57d28 100644
--- a/src/bhyve/bhyve_driver.h
+++ b/src/bhyve/bhyve_driver.h
@@ -23,8 +23,8 @@
#ifndef __BHYVE_DRIVER_H__
# define __BHYVE_DRIVER_H__
-#include "capabilities.h"
-#include "bhyve_utils.h"
+# include "capabilities.h"
+# include "bhyve_utils.h"
int bhyveRegister(void);
--
2.4.6
8 years, 9 months
[libvirt] [PATCH] bhyve: Fix the build
by Michal Privoznik
After 1036ddadb276e we use bhyveDriverGetCapabilities from other
sources too, not only from bhyve_driver.c. However, the function
was static so not properly expose to other files. In order to
expose it, we need to move couple of #include-s too.
Then, there has been a copy paste error in
virBhyveProcessReconnect: s/privconn/data->driver/.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build breaker rule.
src/bhyve/bhyve_driver.c | 4 +---
src/bhyve/bhyve_driver.h | 5 +++++
src/bhyve/bhyve_process.c | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index f486f86..9219890 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -30,7 +30,6 @@
#include "datatypes.h"
#include "virbuffer.h"
#include "viruuid.h"
-#include "capabilities.h"
#include "configmake.h"
#include "viralloc.h"
#include "network_conf.h"
@@ -58,7 +57,6 @@
#include "bhyve_command.h"
#include "bhyve_domain.h"
#include "bhyve_process.h"
-#include "bhyve_utils.h"
#include "bhyve_capabilities.h"
#define VIR_FROM_THIS VIR_FROM_BHYVE
@@ -127,7 +125,7 @@ bhyveAutostartDomains(bhyveConnPtr driver)
*
* Returns: a reference to a virCapsPtr instance or NULL
*/
-static virCapsPtr ATTRIBUTE_NONNULL(1)
+virCapsPtr ATTRIBUTE_NONNULL(1)
bhyveDriverGetCapabilities(bhyveConnPtr driver)
{
diff --git a/src/bhyve/bhyve_driver.h b/src/bhyve/bhyve_driver.h
index 221d5a0..a290c4a 100644
--- a/src/bhyve/bhyve_driver.h
+++ b/src/bhyve/bhyve_driver.h
@@ -23,10 +23,15 @@
#ifndef __BHYVE_DRIVER_H__
# define __BHYVE_DRIVER_H__
+#include "capabilities.h"
+#include "bhyve_utils.h"
+
int bhyveRegister(void);
unsigned bhyveDriverGetCaps(virConnectPtr conn);
unsigned bhyveDriverGetGrubCaps(virConnectPtr conn);
+virCapsPtr bhyveDriverGetCapabilities(bhyveConnPtr driver);
+
#endif /* __BHYVE_DRIVER_H__ */
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 9763d71..14588a9 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -32,6 +32,7 @@
#include <net/if_tap.h>
#include "bhyve_device.h"
+#include "bhyve_driver.h"
#include "bhyve_command.h"
#include "bhyve_monitor.h"
#include "bhyve_process.h"
@@ -375,7 +376,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
if (!vm->pid)
return 0;
- caps = bhyveDriverGetCapabilities(privconn);
+ caps = bhyveDriverGetCapabilities(data->driver);
if (!caps)
return -1;
--
2.4.10
8 years, 9 months
[libvirt] [PATCH v3 00/13] vcpu info storage refactors - part 2
by Peter Krempa
Rest of the series was pushed. Patches with no explicit note were already ACKed
but depend on the rest of the series.
Peter Krempa (13):
cgroup: Prepare for sparse vCPU topologies in virCgroupGetPercpuStats
qemu: Differentiate error codes when VM exits in
qemuDomainDetectVcpuPids
qemu: Reuse qemuDomainDetectVcpuPids in cpu hot(un)plug
conf: Don't copy def->cpumask into cpu pinning info
conf: Store cpu pinning data in def->vcpus
conf: remove unused cpu pinning helpers and data structures
conf: Extract code that formats <cputune>
conf: Don't store vcpusched orthogonally to other vcpu info
conf: Fix how iothread scheduler info is stored
qemu: vcpu: Aggregate code to set vCPU tuning
qemu: vcpu: Reuse qemuProcessSetupVcpu in vcpu hotplug
qemu: iothread: Aggregate code to set IOThread tuning
qemu: iothread: Reuse qemuProcessSetupIOThread in iothread hotplug
src/conf/domain_conf.c | 835 ++++++++++-----------
src/conf/domain_conf.h | 41 +-
src/libvirt_private.syms | 7 -
src/libxl/libxl_domain.c | 20 +-
src/libxl/libxl_driver.c | 38 +-
src/lxc/lxc_driver.c | 2 +-
src/qemu/qemu_cgroup.c | 195 -----
src/qemu/qemu_cgroup.h | 2 -
src/qemu/qemu_domain.c | 4 +-
src/qemu/qemu_driver.c | 380 +++-------
src/qemu/qemu_process.c | 401 ++++++----
src/qemu/qemu_process.h | 6 +
src/test/test_driver.c | 45 +-
src/util/vircgroup.c | 16 +-
src/util/vircgroup.h | 3 +-
src/vz/vz_sdk.c | 16 +-
.../qemuxml2xmlout-cputune-iothreadsched.xml | 3 +-
tests/vircgrouptest.c | 2 +-
18 files changed, 823 insertions(+), 1193 deletions(-)
--
2.6.2
8 years, 9 months
[libvirt] [PATCH] virSystemdGetMachineNameByPID: Initialize @reply
by Michal Privoznik
I've noticed that variable @reply is not initialized and if
something at the beginning of the function fails, e.g.
virDBusGetSystemBus(), the control jump straight to cleanup label
where dbus_message_unref() is then called over this uninitialized
variable.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
src/util/virsystemd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 37007aa..6677798 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -181,7 +181,7 @@ char *
virSystemdGetMachineNameByPID(pid_t pid)
{
DBusConnection *conn;
- DBusMessage *reply;
+ DBusMessage *reply = NULL;
char *name = NULL, *object = NULL;
if (virDBusIsServiceEnabled("org.freedesktop.machine1") < 0)
--
2.4.10
8 years, 9 months
[libvirt] [PATCH] virnetdevbandwidth: Compute quantum value
by Michal Privoznik
I've noticed couple of warning in dmesg while debugging
something:
[ 9683.973754] HTB: quantum of class 10001 is big. Consider r2q change.
[ 9683.976460] HTB: quantum of class 10002 is big. Consider r2q change.
I've read the HTB documentation and linux kernel code to find out
what's wrong. Basically we need to pass another argument to our
tc cmd line because the default computed by HTB does not always
work in which case the warning message is printed out.
You can read more details here:
http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm#sharing
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virnetdevbandwidth.c | 39 +++++++++++++++++++++++++++++++++++++++
tests/virnetdevbandwidthtest.c | 4 ++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index da3a0d3..a74cb1d 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -43,6 +43,36 @@ virNetDevBandwidthFree(virNetDevBandwidthPtr def)
VIR_FREE(def);
}
+static int
+virNetDevBandwidthSetOptimalQuantum(virCommandPtr cmd,
+ const virNetDevBandwidthRate *rate)
+{
+ const unsigned long long mtu = 1500;
+ unsigned long long r2q;
+ char *r2q_str;
+
+ /* When two or more classes compete for unused bandwidth they are each
+ * given some number of bytes before serving other competing class. This
+ * number is called quantum. It's advised in HTB docs that the number
+ * should be equal to MTU. The class quantum is computed from its rate
+ * divided by global r2q parameter. However, if rate is too small the
+ * default value will not suffice and thus we must provide our own value.
+ * */
+
+ r2q = rate->average * 1024 / 8 / mtu;
+ if (!r2q)
+ r2q = 1;
+
+ if (r2q != 10) {
+ if (virAsprintf(&r2q_str, "%llu", r2q) < 0)
+ return -1;
+ virCommandAddArgList(cmd, "quantum", r2q_str, NULL);
+ VIR_FREE(r2q_str);
+ }
+
+ return 0;
+}
+
/**
* virNetDevBandwidthManipulateFilter:
* @ifname: interface to operate on
@@ -280,6 +310,8 @@ virNetDevBandwidthSet(const char *ifname,
virCommandAddArgList(cmd, "class", "add", "dev", ifname, "parent",
"1:", "classid", "1:1", "htb", "rate", average,
"ceil", peak ? peak : average, NULL);
+ if (virNetDevBandwidthSetOptimalQuantum(cmd, bandwidth->in) < 0)
+ goto cleanup;
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
}
@@ -295,6 +327,9 @@ virNetDevBandwidthSet(const char *ifname,
if (burst)
virCommandAddArgList(cmd, "burst", burst, NULL);
+ if (virNetDevBandwidthSetOptimalQuantum(cmd, bandwidth->in) < 0)
+ goto cleanup;
+
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
@@ -549,6 +584,8 @@ virNetDevBandwidthPlug(const char *brname,
virCommandAddArgList(cmd, "class", "add", "dev", brname, "parent", "1:1",
"classid", class_id, "htb", "rate", floor,
"ceil", ceil, NULL);
+ if (virNetDevBandwidthSetOptimalQuantum(cmd, bandwidth->in) < 0)
+ goto cleanup;
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
@@ -672,6 +709,8 @@ virNetDevBandwidthUpdateRate(const char *ifname,
virCommandAddArgList(cmd, "class", "change", "dev", ifname,
"classid", class_id, "htb", "rate", rate,
"ceil", ceil, NULL);
+ if (virNetDevBandwidthSetOptimalQuantum(cmd, bandwidth->in) < 0)
+ goto cleanup;
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 5a3f02c..b29318e 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -137,7 +137,7 @@ mymain(void)
(TC " qdisc del dev eth0 root\n"
TC " qdisc del dev eth0 ingress\n"
TC " qdisc add dev eth0 root handle 1: htb default 1\n"
- TC " class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps\n"
+ TC " class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps quantum 87\n"
TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
TC " filter add dev eth0 parent 1:0 protocol all prio 1 handle 1 fw flowid 1\n"));
@@ -157,7 +157,7 @@ mymain(void)
(TC " qdisc del dev eth0 root\n"
TC " qdisc del dev eth0 ingress\n"
TC " qdisc add dev eth0 root handle 1: htb default 1\n"
- TC " class add dev eth0 parent 1: classid 1:1 htb rate 1kbps ceil 2kbps burst 4kb\n"
+ TC " class add dev eth0 parent 1: classid 1:1 htb rate 1kbps ceil 2kbps burst 4kb quantum 1\n"
TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
TC " filter add dev eth0 parent 1:0 protocol all prio 1 handle 1 fw flowid 1\n"
TC " qdisc add dev eth0 ingress\n"
--
2.4.10
8 years, 9 months