[libvirt] [PATCH v5 0/5] vz: add migration support
by Nikolay Shirokovskiy
NOTE that minimal command to migrate vz domain is like next:
virsh -c vz:///system migrate 200 vz+ssh://shiny0/system --p2p
--live --compressed --persistent --undefinesource
Difference from v4:
1. move preparation of the migration uri from src to dst as dst intended to do it.
2. change hypervisor migration scheme from 'tcp' to 'vzmigr'
3. declare this scheme in host caps
src/vz/vz_driver.c | 356 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/vz/vz_sdk.c | 86 +++++++++++--
src/vz/vz_sdk.h | 6 +
src/vz/vz_utils.h | 4 +-
4 files changed, 437 insertions(+), 15 deletions(-)
9 years, 1 month
[libvirt] crash in virDomainNumaGetMemorySize
by Olaf Hering
With current master (56945e1), while toying around with a WS2008R2 Hyper-V host:
root@probook:~ # gdb --quiet -ex 'r -c hv dumpxml all-sles12-dev' -ex bt -ex detach -ex quit virsh
Reading symbols from virsh...Reading symbols from /usr/lib/debug/usr/bin/virsh.debug...done.
done.
Starting program: /usr/bin/virsh -c hv dumpxml all-sles12-dev
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Enter Administrator's password for optiplex.fritz.box:
[New Thread 0x7fffee601700 (LWP 26921)]
Program received signal SIGSEGV, Segmentation fault.
virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971
971 for (i = 0; i < numa->nmem_nodes; i++)
#0 virDomainNumaGetMemorySize (numa=0x0) at conf/numa_conf.c:971
#1 0x00007ffff793bce0 in virDomainDefGetMemoryActual (def=def@entry=0x55555582ead0) at conf/domain_conf.c:7857
#2 0x00007ffff7948978 in virDomainDefFormatInternal (def=0x55555582ead0, flags=0, buf=buf@entry=0x7fffffffdde0) at conf/domain_conf.c:21677
#3 0x00007ffff794b8bc in virDomainDefFormat (def=<optimized out>, flags=<optimized out>) at conf/domain_conf.c:22507
#4 0x00007ffff7a94c33 in hypervDomainGetXMLDesc (domain=<optimized out>, flags=0) at hyperv/hyperv_driver.c:882
#5 0x00007ffff79b5351 in virDomainGetXMLDesc (domain=domain@entry=0x5555558237a0, flags=0) at libvirt-domain.c:2591
#6 0x000055555558b978 in cmdDumpXML (ctl=0x7fffffffe1c0, cmd=<optimized out>) at virsh-domain.c:9634
#7 0x000055555557d04f in vshCommandRun (ctl=0x7fffffffe1c0, cmd=0x555555822580) at vsh.c:1212
#8 0x0000555555579a4d in main (argc=5, argv=0x7fffffffe3c8) at virsh.c:921
Detaching from program: /usr/bin/virsh, process 26917
root@probook:~ # rpm -qf `which virsh`
libvirt-client-20150917T085913.56945e1-3.xen_unstable.1.x86_64
Olaf
9 years, 1 month
[libvirt] cpu affinity, isolcpus and cgroups
by Henning Schild
Hi,
i am currently looking into realtime VMs using libvirt. My first
starting point was reserving a couple of cores using isolcpus and later
tuning the affinity to place my vcpus on the reserved pcpus.
My first observation was that libvirt ignores isolcpus. Affinity masks
of new qemus will default to all cpus and will not be inherited from
libvirtd. A comment in the code suggests that this is done on purpose.
After that i changed the code to use only the available cpus by
default. But taskset was still showing all 'f's on my qemus. Then i
traced my change down to sched_setaffinity assuming that some other
mechanism might have reverted my hack, but it is still in place.
Libvirt is setting up cgroups and now my suspicion is that cgroups and
taskset might not work well together.
> /sys/fs/cgroup/cpu/machine.slice/machine-qemu\x2dvm1.scope/vcpu0#
> cpuacct.usage_percpu
> 247340587 50851635 89631114 23383025 412639264 1241965 55442753 19923
> 14093629 15863859 27403280 1292195745 82031088 53690508 135826421
> 124915000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Looks like the last 16 cores are not used.
But if i use taskset to ask for the affinity mask i get all 32 cpus.
> taskset -p `cat tasks`
> pid 12905's current affinity mask: ffffffff
I know that is not strictly libvirt but also a kernel question, still
you guys are probably able to point me to what i am missing here.
> Linux 3.18.11+ #4 SMP PREEMPT RT
regards,
Henning
9 years, 1 month
[libvirt] [PATCH RFC 0/7] libxl: domain statistics support
by Joao Martins
Hey Jim,
This series bring support for various statistics about domains
regarding CPU, Memory, Network Interfaces and BlockStats. Not all of
the statistics are implemented: qdisk support is missing in this series
and some of the memory statistics aren't available.
With this series we further implement 7 more functions of libvirt APIs.
It is organized as follows:
* Patch 1, 2: implements cpu/memory statistics.
* Patch 3, 4: implements (netback) network statistics and VBD block
statistics. QDisk will follow up in a separate series
regarding QEMU monitor integration.
* Patch 5: implement fetching all domain statistics
* Patch 6, 7: implements Job information.
Overall it looks big but 70% of the patch is due to #4 and #5 but doesn't
add necessarily more complexity to the driver I believe. Patch #6 and #7
are of special importance because GetJobInfo and GetJobStats are now used
in Openstack Kilo to monitor live-migration progress. This two patches
together with an earlier series [0] I sent before let us sucessfully
live-migrate with Openstack Kilo. Further with this series we get to
support nova diagnostics.
Tested this series on 4.4.3 and 4.5 setups plus Openstack Kilo.
Any comments or suggestions are welcome,
Thanks!
Joao
Joao Martins (7):
libxl: implement virDomainGetCPUStats
libxl: implement virDomainMemorystats
libxl: implement virDomainInterfaceStats
libxl: implement virDomainBlockStats
libxl: implement virConnectGetAllDomainStats
libxl: implement virDomainGetJobInfo
libxl: implement virDomainGetJobStats
configure.ac | 2 +-
src/libxl/libxl_domain.c | 29 ++
src/libxl/libxl_domain.h | 6 +
src/libxl/libxl_driver.c | 1010 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 1046 insertions(+), 1 deletion(-)
--
2.1.4
9 years, 1 month
[libvirt] [RFC PATCH 0/8] Make loading domains with invalid XML possible
by Martin Kletzander
We always had to deal with new parsing errors in a weird way. All of
them needed to go into functions starting the domains. That messes up
the code, it's confusing to newcomers and so on.
I once had an idea that we can handle this stuff. We know what
failed, we have the XML that failed parsing and if the problem is not
in the domain name nor UUID, we can create a domain object out of that
as well. This way we are able to do something we weren't with this
series applied. Example follows.
Assume "dummy" is a domain with invalid XML (I just modified the
file). Now, just for the purpose of this silly example, let's say we
allowed domains with archtecture x86_*, but now we've realized that
x86_64 is the only one we want to allow, but there already is a domain
defined that has <type arch='x86_256' .../>. With the current master,
the domain would be lost, so we would need to modify the funstion
starting the domain (e.g. qemuProcessStart for qemu domain). However,
with this series, it behaves like this:
# virsh list --all
Id Name State
----------------------------------------------------
- dummy shut off
# virsh domstate --reason dummy
shut off (invalid XML)
# virsh start dummy
error: Failed to start domain dummy
error: XML error: domain 'dummy' was not loaded due to an XML error
(unsupported configuration: Unknown architecture x86_256), please
redefine it
# VISUAL='sed -i s/x86_256/x86_64/' virsh edit dummy
Domain dummy XML configuration edited.
# virsh domstate --reason dummy
shut off (unknown)
# virsh start dummy
Domain dummy started
This is a logical next step for us to clean and separate parsing and
starting, getting rid of some old code without sacrifying compatibility
and maybe generating parser code in the future.
Why is this an RFC?
- I can certainly easily imagine some people who might not like this
- It doesn't work for all drivers (yet)
- It does handle status XMLs, but only slightly. All the handling is
done in a commit message that says something along the lines of
"beware, we should still be careful, but not as much as before".
- The error type used for the message is one that is already used for
something else and we might want a new type of error for exactly
this one error message, although it might be enough for some to
have the possibility of checking this by querying the domain state
and checking the reason.
- Just so you know I came up with something new for which there's no
BZ (or at least yet) =)
Martin Kletzander (8):
conf, virsh: Add new domain shutoff reason
qemu: Few whitespace cleanups
conf: Extract name-parsing into its own function
conf: Extract UUID parsing into its own function
conf: Optionally keep domains with invalid XML
qemu: Don't lookup invalid domains unless specified otherwise
qemu: Prepare basic APIs to handle invalid defs
qemu: Load domains with invalid XML on start
include/libvirt/libvirt-domain.h | 2 +
src/bhyve/bhyve_driver.c | 2 +
src/conf/domain_conf.c | 180 +++++++++++++++++++++++++++++++++------
src/conf/domain_conf.h | 5 ++
src/libxl/libxl_driver.c | 3 +
src/lxc/lxc_driver.c | 3 +
src/qemu/qemu_driver.c | 64 +++++++++++---
src/uml/uml_driver.c | 2 +
tools/virsh-domain-monitor.c | 3 +-
9 files changed, 223 insertions(+), 41 deletions(-)
--
2.5.3
9 years, 1 month
[libvirt] [PATCH 0/2] improve the error in 2 function
by Luyao Huang
*** BLURB HERE ***
Luyao Huang (2):
util: split the virNumaGetHugePageInfoPath into separate function
util: Produce friendlier error message to user
src/util/virnuma.c | 54 ++++++++++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 24 deletions(-)
--
1.8.3.1
9 years, 1 month
[libvirt] [libvirt-test-API] [PATCH] fix some typo
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
repos/domain/fsinfo.py | 2 +-
repos/domain/install_linux_check.py | 2 +-
repos/domain/install_linux_net.py | 2 +-
repos/interface/define.py | 2 +-
repos/interface/undefine.py | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/repos/domain/fsinfo.py b/repos/domain/fsinfo.py
index e6d1bf0..d4614f5 100644
--- a/repos/domain/fsinfo.py
+++ b/repos/domain/fsinfo.py
@@ -81,7 +81,7 @@ def fsinfo(params):
return 1
fsinfo = vm.fsInfo()
- logger.info("get geust filesystem information")
+ logger.info("get guest filesystem information")
mac = get_guest_mac(vm)
if not mac:
diff --git a/repos/domain/install_linux_check.py b/repos/domain/install_linux_check.py
index ab1e7db..bb3cc2a 100644
--- a/repos/domain/install_linux_check.py
+++ b/repos/domain/install_linux_check.py
@@ -99,7 +99,7 @@ def install_linux_check(params):
Test_Result = 1
return Test_Result
- # Check whether vcpu equals the value set in geust config xml
+ # Check whether vcpu equals the value set in guest config xml
logger.info("check point3: check cpu number in guest equals to \
the value set in domain config xml")
vcpunum_expect = int(utils.get_num_vcpus(domain_name))
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index 4367d97..7173294 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -239,7 +239,7 @@ def install_linux_net(params):
logger.info("booting guest vm off harddisk failed")
return 1
else:
- logger.info("geust is booting up")
+ logger.info("guest is booting up")
else:
interval = 0
while(interval < 3600):
diff --git a/repos/interface/define.py b/repos/interface/define.py
index 18ba71b..e0dbcf4 100644
--- a/repos/interface/define.py
+++ b/repos/interface/define.py
@@ -42,7 +42,7 @@ def define(params):
try:
conn.interfaceDefineXML(xmlstr, 0)
if check_define_interface(ifacename):
- logger.info("define a interface form xml is successful")
+ logger.info("define a interface from xml is successful")
else:
logger.error("fail to check define interface")
return 1
diff --git a/repos/interface/undefine.py b/repos/interface/undefine.py
index f9b2d74..8b250de 100644
--- a/repos/interface/undefine.py
+++ b/repos/interface/undefine.py
@@ -39,14 +39,14 @@ def undefine(params):
try:
ifaceobj.undefine()
if check_undefine_interface(ifacename):
- logger.info("undefine a interface form xml is successful")
+ logger.info("undefine a interface is successful")
else:
logger.error("fail to check undefine interface")
return 1
except libvirtError, e:
logger.error("API error message: %s, error code is %s" \
% (e.message, e.get_error_code()))
- logger.error("fail to undefine a interface from xml")
+ logger.error("fail to undefine a interface")
return 1
return 0
--
1.8.3.1
9 years, 2 months
[libvirt] [libvirt-test-API] [PATCH] fix two error in script pin_iothread.py and connection_getAllDomainStats.py
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
repos/domain/pin_iothread.py | 2 +-
repos/virconn/connection_getAllDomainStats.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/repos/domain/pin_iothread.py b/repos/domain/pin_iothread.py
index 28ee2c4..d2d812f 100644
--- a/repos/domain/pin_iothread.py
+++ b/repos/domain/pin_iothread.py
@@ -116,7 +116,7 @@ def pin_iothread(params):
if not find_iothreadid_fromxml(vm, 1, 1):
logger.info("add iothread %d to running guest" % 1)
- vm.addIOThread(i, libvirt.VIR_DOMAIN_AFFECT_LIVE)
+ vm.addIOThread(1, libvirt.VIR_DOMAIN_AFFECT_LIVE)
vm.pinIOThread(1, tu_cpu, libvirt.VIR_DOMAIN_AFFECT_LIVE)
cpuset = find_iothreadpin_fromxml(vm, 1, 1)
diff --git a/repos/virconn/connection_getAllDomainStats.py b/repos/virconn/connection_getAllDomainStats.py
index d95004f..3362444 100644
--- a/repos/virconn/connection_getAllDomainStats.py
+++ b/repos/virconn/connection_getAllDomainStats.py
@@ -164,7 +164,7 @@ def check_each_vcpu(logger,dom_name,dom_active,dom_eles):
if not vcpu_cur:
for i in range(0,vcpu_max):
vcpu_pre = "vcpu."+ str(i) + "."
- logger.debug("Checking %sstate: %d" \
+ logger.debug("Checking %sstate: %s" \
%(vcpu_pre, dom_eles.get(vcpu_pre + "state")))
if not compare_value(logger,vcpu_stat, \
dom_eles.get(vcpu_pre + "state")):
@@ -172,7 +172,7 @@ def check_each_vcpu(logger,dom_name,dom_active,dom_eles):
elif int(vcpu_cur.nodeValue) <= vcpu_max:
for i in range(0,int(vcpu_cur.nodeValue)):
vcpu_pre = "vcpu."+ str(i) + "."
- logger.debug("Checking %sstate: %d" \
+ logger.debug("Checking %sstate: %s" \
%(vcpu_pre, dom_eles.get(vcpu_pre + "state")))
if not compare_value(logger,vcpu_stat, \
dom_eles.get(vcpu_pre + "state")):
--
1.8.3.1
9 years, 2 months
[libvirt] [libvirt-test-API] [PATCH] Add two cases for API interfaceAddresses and make small changes to global.cfg
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
cases/linux_domain.conf | 12 +++++++
global.cfg | 8 +++--
repos/domain/get_guest_network_info.py | 66 ++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 2 deletions(-)
create mode 100644 repos/domain/get_guest_network_info.py
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index 8440c61..5b216f9 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -66,6 +66,18 @@ domain:set_guest_time
flags
sync
+domain:get_guest_network_info
+ guestname
+ $defaultname
+ flags
+ lease
+
+domain:get_guest_network_info
+ guestname
+ $defaultname
+ flags
+ agent
+
virconn:connection_getAllDomainStats
stats
state|cpu|balloon|vcpu|interface|block
diff --git a/global.cfg b/global.cfg
index 56677a5..1b72119 100644
--- a/global.cfg
+++ b/global.cfg
@@ -44,6 +44,8 @@ rhel6u1_i386 = http://
rhel6u1_x86_64 = http://
rhel6u2_i386 = http://
rhel6u2_x86_64 = http://
+rhel7u1_x86_64 = http://
+rhel7u2_x86_64 = http://
fedora12_i386 = http://
fedora12_x86_64 = http://
win2008_i386 = http://
@@ -70,6 +72,8 @@ rhel6_i386_http_ks = http://
rhel6_x86_64_http_ks = http://
rhel6u2_i386_http_ks = http://
rhel6u2_x86_64_http_ks = kickstart.cfg
+rhel7u1_x86_64_http_ks = http://
+rhel7u2_x86_64_http_ks = http://
fedora12_i386_http_ks = http://
fedora12_x86_64_http_ks = http://
@@ -97,7 +101,7 @@ sourcepath = /media/share
# also exercise DNS resolution
#
[other]
-wget_url = http://
+wget_url = http://libvirt.org/index.html
#
# The variables section is a set of variables used by the
@@ -127,7 +131,7 @@ defaulthv = kvm
defaultname = libvirt_test_api
# default os version to use for installing a new guest
# the value of it is the first part of 'rhel6u2_x86_64' in [guest] section above
-defaultos = rhel6u2
+defaultos = rhel7u2
# default architecture to use for installing a new guest
defaultarch = x86_64
# default the number of vcpu to use for defining or installing a guest
diff --git a/repos/domain/get_guest_network_info.py b/repos/domain/get_guest_network_info.py
new file mode 100644
index 0000000..35bba3b
--- /dev/null
+++ b/repos/domain/get_guest_network_info.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+import libvirt
+from libvirt import libvirtError
+from src import sharedmod
+
+required_params = ('guestname', 'flags',)
+optional_params = {}
+
+def check_guest_status(domobj):
+ """check guest current status
+ """
+ state = domobj.info()[0]
+ if state == libvirt.VIR_DOMAIN_SHUTOFF or \
+ state == libvirt.VIR_DOMAIN_SHUTDOWN:
+ return False
+ else:
+ return True
+
+def get_guest_network_info(params):
+ """get guest network interface info
+ """
+
+ logger = params['logger']
+ guestname = params['guestname']
+ flags = params['flags']
+
+ conn = sharedmod.libvirtobj['conn']
+
+ domobj = conn.lookupByName(guestname)
+
+ flags = params['flags']
+ logger.info("The flags are %s" % flags)
+ flags_string = flags.split("|")
+ flags = 0
+
+ for flag in flags_string:
+ if flag == 'lease':
+ flags |= libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE
+ elif flag == 'agent':
+ flags |= libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT
+ else:
+ logger.error("unknow flags")
+ return 1
+
+ logger.info("the given flags is %d" % flags)
+
+ # Check domain status
+ if check_guest_status(domobj):
+ logger.info("Guest is running")
+ else:
+ logger.error("Guest is shut off status")
+ return 1
+
+ try:
+ info = domobj.interfaceAddresses(flags)
+ logger.info("get guest interface info")
+
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s" \
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
+
+
--
1.8.3.1
9 years, 2 months
[libvirt] [PATCH v2 0/4] Be tolerant to relabel errors for session mode
by Michal Privoznik
This is a reworked version of my previous patch:
https://www.redhat.com/archives/libvir-list/2015-July/msg00576.html
Michal Privoznik (4):
virSecuritySELinuxSetSecurityAllLabel: drop useless virFileIsSharedFSType
security_selinux: Replace SELinuxSCSICallbackData with proper struct
virSecurityManager: Track if running as privileged
security_selinux: Take @privileged into account
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 3 +-
src/qemu/qemu_driver.c | 7 +-
src/security/security_manager.c | 29 ++++++--
src/security/security_manager.h | 5 +-
src/security/security_selinux.c | 147 ++++++++++++++++++++++++---------------
tests/qemuhotplugtest.c | 2 +-
tests/seclabeltest.c | 2 +-
tests/securityselinuxlabeltest.c | 2 +-
tests/securityselinuxtest.c | 2 +-
10 files changed, 127 insertions(+), 74 deletions(-)
--
2.4.6
9 years, 2 months