[libvirt] [PATCH v2 0/6] qemu capabilities cleanup and preparation for virFileCache
by Pavel Hrdina
Pavel Hrdina (6):
util/virhash: add name parameter to virHashSearch
qemu: move libvirt ctime and version into _virQEMUCaps struct
qemu: move virQEMUCapsIsValid before its usage and make it static
qemu: move libvirt ctime and version check into virQEMUCapsIsValid
qemu: don't pass qemuctime into virQEMUCapsIsValid
qemu: separate virQEMUCapsInitCached out of
virQEMUCapsNewForBinaryInternal
src/conf/virdomainobjlist.c | 2 +-
src/conf/virnetworkobj.c | 4 +-
src/conf/virsecretobj.c | 2 +-
src/qemu/qemu_capabilities.c | 282 ++++++++++++++++++++-----------------------
src/qemu/qemu_capabilities.h | 5 -
src/qemu/qemu_capspriv.h | 9 +-
src/util/virhash.c | 11 +-
src/util/virhash.h | 2 +-
src/xen/xm_internal.c | 5 +-
tests/qemucapabilitiestest.c | 4 +-
tests/qemucapsprobe.c | 2 +-
tests/testutilsqemu.c | 5 +-
tests/virhashtest.c | 2 +-
13 files changed, 151 insertions(+), 184 deletions(-)
--
2.13.3
7 years, 8 months
[libvirt] [PATCH 0/2] Fix a couple of resource leaks
by John Ferlan
Resource a couple Coverity found resource leaks
John Ferlan (2):
daemon: Don't conditionally free @origErr in daemonStreamEvent
tests: Free @fakerootdir in error path
daemon/stream.c | 2 +-
tests/qemumemlocktest.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
--
2.9.4
7 years, 8 months
[libvirt] [PATCH] nodedev: fix an improper comment
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Actually we use virConnectNodeDeviceEventGenericCallback.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
include/libvirt/libvirt-nodedev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h
index cd3f237..25e8724 100644
--- a/include/libvirt/libvirt-nodedev.h
+++ b/include/libvirt/libvirt-nodedev.h
@@ -142,7 +142,7 @@ int virNodeDeviceDestroy (virNodeDevicePtr dev);
*/
typedef enum {
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE = 0, /* virConnectNodeDeviceEventLifecycleCallback */
- VIR_NODE_DEVICE_EVENT_ID_UPDATE = 1, /* virConnectNodeDeviceEventUpdateCallback */
+ VIR_NODE_DEVICE_EVENT_ID_UPDATE = 1, /* virConnectNodeDeviceEventGenericCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_NODE_DEVICE_EVENT_ID_LAST
--
2.7.4
7 years, 8 months
[libvirt] [PATCH] fix 1 << -1 at JOB_MASK macro
by xinhua.Cao
From: caoxinhua <caoxinhua(a)huawei.com>
when we start a vm, we call JOB_MASK(QEMU_JOB_NONE), then 1 << -1 will be execute. we fix it as return 0
---
src/libxl/libxl_domain.h | 2 +-
src/qemu/qemu_domain.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 3a3890b..dc40139 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -30,7 +30,7 @@
# include "libxl_conf.h"
# include "virchrdev.h"
-# define JOB_MASK(job) (1 << (job - 1))
+# define JOB_MASK(job) (job == 0 ? 0 : 1 << (job - 1))
# define DEFAULT_JOB_MASK \
(JOB_MASK(LIBXL_JOB_DESTROY) | \
JOB_MASK(LIBXL_JOB_ABORT))
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 365b23c..6750215 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -51,7 +51,7 @@
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
# endif
-# define JOB_MASK(job) (1 << (job - 1))
+# define JOB_MASK(job) (job == 0 ? 0 : 1 << (job - 1))
# define QEMU_JOB_DEFAULT_MASK \
(JOB_MASK(QEMU_JOB_QUERY) | \
JOB_MASK(QEMU_JOB_DESTROY) | \
--
2.8.3
7 years, 8 months
[libvirt] [PATCH v3 00/16] qemu: migration: show disks stats for nbd migration
by Nikolay Shirokovskiy
diff from v2:
============
1. Fix style issues.
2. Rework patch for fetching job info
(save logic to use temporary variable when drop vm lock)
3. Update disk stats when block jobs are canceled.
4. Adress a few more corner cases.
This patch series add disks stats to domain job info(stats) as
well as to migration completed event in case nbd scheme is used.
There is little nuisance with qcow2 disks (which is the main scenario
I guess) tied to the way qemu reports stats for this type of disks.
For example if we have 64G disk filled only to 1G then stats
start from 63G and will grow up to 64G on completion. The same way disk stats
will be reported by this patch.
I guess the better way to express the situation is to say we have 64G 'total',
and have 'processed' field grow from 0G to 1G, like in case of memory
stats. [1] is the example of completed memory stats of empty guest
domain, which show difference between processed and total.
There can be a workaround like getting initial blockjob offset position
as a zero but is is rather ugly and racy and like uses undocumented
behaviour.
[1] memory migration stats example
Memory processed: 3.307 MiB
Memory remaining: 0.000 B
Memory total: 1.032 GiB
The above is applied to qemu 2.6 at least.
Patches that were explicitly ACKed in previous review
(up to style issues) marked with A.
Nikolay Shirokovskiy (16):
qemu: drop code for VIR_DOMAIN_JOB_BOUNDED and timeRemaining
A qemu: introduce qemu domain job status
A qemu: introduce QEMU_DOMAIN_JOB_STATUS_POSTCOPY
A qemu: drop QEMU_MIGRATION_COMPLETED_UPDATE_STATS
A qemu: drop excessive zero-out in qemuMigrationFetchJobStatus
qemu: refactor fetching migration stats
A qemu: simplify getting completed job stats
qemu: fail querying destination migration statistics always
qemu: start all async job with job status active
qemu: introduce migrating job status
qemu: always get job condition on getting job stats
qemu: migrate: show disks stats on job info requests
qemu: support getting disks stats during stopping block jobs
qemu: migation: resolve race on getting job info and stopping block jobs
qemu: migrate: copy disks stats to completed job
qemu: migration: don't expose incomplete job as complete
src/qemu/qemu_blockjob.c | 1 +
src/qemu/qemu_domain.c | 38 +++++--
src/qemu/qemu_domain.h | 16 ++-
src/qemu/qemu_driver.c | 95 ++++++++--------
src/qemu/qemu_migration.c | 236 ++++++++++++++++++++++++++-------------
src/qemu/qemu_migration.h | 15 ++-
src/qemu/qemu_migration_cookie.c | 7 +-
src/qemu/qemu_monitor.c | 5 +-
src/qemu/qemu_monitor.h | 4 +-
src/qemu/qemu_monitor_json.c | 4 +-
src/qemu/qemu_process.c | 10 +-
tests/qemumonitorjsontest.c | 1 +
12 files changed, 273 insertions(+), 159 deletions(-)
--
1.8.3.1
7 years, 8 months
[libvirt] [PATCH go-xml] Add support for DNS in network
by Thomas Hipp
Add support for DNS in network, and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
network.go | 39 ++++++++++++++++++++++++++++++++++
network_test.go | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 99 insertions(+), 5 deletions(-)
diff --git a/network.go b/network.go
index cc850a1..e0baa96 100644
--- a/network.go
+++ b/network.go
@@ -84,6 +84,44 @@ type NetworkRoute struct {
Gateway string `xml:"gateway,attr,omitempty"`
}
+type NetworkDNSForwarder struct {
+ Domain string `xml:"domain,attr,omitempty"`
+ Addr string `xml:"addr,attr,omitempty"`
+}
+
+type NetworkDNSTXT struct {
+ Name string `xml:"name,attr"`
+ Value string `xml:"value,attr"`
+}
+
+type NetworkDNSHostHostname struct {
+ Hostname string `xml:",chardata"`
+}
+
+type NetworkDNSHost struct {
+ IP string `xml:"ip,attr"`
+ Hostnames []NetworkDNSHostHostname `xml:"hostname"`
+}
+
+type NetworkDNSSRV struct {
+ Service string `xml:"service,attr"`
+ Protocol string `xml:"protocol,attr"`
+ Target string `xml:"target,attr,omitempty"`
+ Port uint `xml:"port,attr,omitempty"`
+ Priority uint `xml:"priority,attr,omitempty"`
+ Weight uint `xml:"weight,attr,omitempty"`
+ Domain string `xml:"domain,attr,omitempty"`
+}
+
+type NetworkDNS struct {
+ Enable string `xml:"enable,attr,omitempty"`
+ ForwardPlainNames string `xml:"forwardPlainNames,attr,omitempty"`
+ Forwarders []NetworkDNSForwarder `xml:"forwarder"`
+ TXTs []NetworkDNSTXT `xml:"txt"`
+ Host *NetworkDNSHost `xml:"host"`
+ SRVs []NetworkDNSSRV `xml:"srv"`
+}
+
type Network struct {
XMLName xml.Name `xml:"network"`
IPv6 string `xml:"ipv6,attr,omitempty"`
@@ -96,6 +134,7 @@ type Network struct {
Domain *NetworkDomain `xml:"domain"`
IPs []NetworkIP `xml:"ip"`
Routes []NetworkRoute `xml:"route"`
+ DNS *NetworkDNS `xml:"dns"`
}
func (s *Network) Unmarshal(doc string) error {
diff --git a/network_test.go b/network_test.go
index 5269398..2eb81ab 100644
--- a/network_test.go
+++ b/network_test.go
@@ -89,9 +89,9 @@ var networkTestData = []struct {
},
},
NetworkIP{
- Family: "ipv6",
- Address:"2001:db8:ca2:2::1",
- Prefix: "64",
+ Family: "ipv6",
+ Address: "2001:db8:ca2:2::1",
+ Prefix: "64",
DHCP: &NetworkDHCP{
Hosts: []NetworkDHCPHost{
NetworkDHCPHost{
@@ -99,13 +99,57 @@ var networkTestData = []struct {
Name: "paul",
},
NetworkDHCPHost{
- ID: "0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66",
- IP: "2001:db8:ca2:2:3::2",
+ ID: "0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66",
+ IP: "2001:db8:ca2:2:3::2",
},
},
},
},
},
+ DNS: &NetworkDNS{
+ Enable: "yes",
+ ForwardPlainNames: "no",
+ Forwarders: []NetworkDNSForwarder{
+ NetworkDNSForwarder{
+ Addr: "8.8.8.8",
+ },
+ NetworkDNSForwarder{
+ Domain: "example.com",
+ Addr: "8.8.4.4",
+ },
+ NetworkDNSForwarder{
+ Domain: "www.example.com",
+ },
+ },
+ TXTs: []NetworkDNSTXT{
+ NetworkDNSTXT{
+ Name: "example",
+ Value: "example value",
+ },
+ },
+ Host: &NetworkDNSHost{
+ IP: "192.168.122.2",
+ Hostnames: []NetworkDNSHostHostname{
+ NetworkDNSHostHostname{
+ Hostname: "myhost",
+ },
+ NetworkDNSHostHostname{
+ Hostname: "myhostalias",
+ },
+ },
+ },
+ SRVs: []NetworkDNSSRV{
+ NetworkDNSSRV{
+ Service: "name",
+ Protocol: "tcp",
+ Domain: "test-domain-name",
+ Target: ".",
+ Port: 1024,
+ Priority: 10,
+ Weight: 10,
+ },
+ },
+ },
},
Expected: []string{
`<network>`,
@@ -124,6 +168,17 @@ var networkTestData = []struct {
` <host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66" ip="2001:db8:ca2:2:3::2"></host>`,
` </dhcp>`,
` </ip>`,
+ ` <dns enable="yes" forwardPlainNames="no">`,
+ ` <forwarder addr="8.8.8.8"></forwarder>`,
+ ` <forwarder domain="example.com" addr="8.8.4.4"></forwarder>`,
+ ` <forwarder domain="www.example.com"></forwarder>`,
+ ` <txt name="example" value="example value"></txt>`,
+ ` <host ip="192.168.122.2">`,
+ ` <hostname>myhost</hostname>`,
+ ` <hostname>myhostalias</hostname>`,
+ ` </host>`,
+ ` <srv service="name" protocol="tcp" target="." port="1024" priority="10" weight="10" domain="test-domain-name"></srv>`,
+ ` </dns>`,
`</network>`,
},
},
--
2.13.2
7 years, 8 months
[libvirt] [PATCH go-xml] Add support for NAT in network forward
by Thomas Hipp
Add support for NAT in network forward, and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
network.go | 20 ++++++++++++++++++--
network_test.go | 31 +++++++++++++++++++++++++------
2 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/network.go b/network.go
index cc850a1..3635ad2 100644
--- a/network.go
+++ b/network.go
@@ -41,9 +41,25 @@ type NetworkDomain struct {
LocalOnly string `xml:"localOnly,attr,omitempty"`
}
+type NetworkForwardNATAddress struct {
+ Start string `xml:"start,attr"`
+ End string `xml:"end,attr"`
+}
+
+type NetworkForwardNATPort struct {
+ Start uint `xml:"start,attr"`
+ End uint `xml:"end,attr"`
+}
+
+type NetworkForwardNAT struct {
+ Addresses []NetworkForwardNATAddress `xml:"address"`
+ Ports []NetworkForwardNATPort `xml:"port"`
+}
+
type NetworkForward struct {
- Mode string `xml:"mode,attr,omitempty"`
- Dev string `xml:"dev,attr,omitempty"`
+ Mode string `xml:"mode,attr,omitempty"`
+ Dev string `xml:"dev,attr,omitempty"`
+ NAT *NetworkForwardNAT `xml:"nat"`
}
type NetworkMAC struct {
diff --git a/network_test.go b/network_test.go
index 5269398..65f4d53 100644
--- a/network_test.go
+++ b/network_test.go
@@ -67,6 +67,20 @@ var networkTestData = []struct {
},
Forward: &NetworkForward{
Mode: "nat",
+ NAT: &NetworkForwardNAT{
+ Addresses: []NetworkForwardNATAddress{
+ NetworkForwardNATAddress{
+ Start: "1.2.3.4",
+ End: "1.2.3.10",
+ },
+ },
+ Ports: []NetworkForwardNATPort{
+ NetworkForwardNATPort{
+ Start: 500,
+ End: 1000,
+ },
+ },
+ },
},
IPs: []NetworkIP{
NetworkIP{
@@ -89,9 +103,9 @@ var networkTestData = []struct {
},
},
NetworkIP{
- Family: "ipv6",
- Address:"2001:db8:ca2:2::1",
- Prefix: "64",
+ Family: "ipv6",
+ Address: "2001:db8:ca2:2::1",
+ Prefix: "64",
DHCP: &NetworkDHCP{
Hosts: []NetworkDHCPHost{
NetworkDHCPHost{
@@ -99,8 +113,8 @@ var networkTestData = []struct {
Name: "paul",
},
NetworkDHCPHost{
- ID: "0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66",
- IP: "2001:db8:ca2:2:3::2",
+ ID: "0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66",
+ IP: "2001:db8:ca2:2:3::2",
},
},
},
@@ -111,7 +125,12 @@ var networkTestData = []struct {
`<network>`,
` <name>test</name>`,
` <bridge name="virbr0"></bridge>`,
- ` <forward mode="nat"></forward>`,
+ ` <forward mode="nat">`,
+ ` <nat>`,
+ ` <address start="1.2.3.4" end="1.2.3.10"></address>`,
+ ` <port start="500" end="1000"></port>`,
+ ` </nat>`,
+ ` </forward>`,
` <ip address="192.168.122.1" netmask="255.255.255.0">`,
` <dhcp>`,
` <range start="192.168.122.2" end="192.168.122.254"></range>`,
--
2.13.2
7 years, 8 months
[libvirt] [PATCH RESEND] qemu: shared disks with cache=directsync should be safe for migration
by Peng Hao
From: Hao Peng <peng.hao2(a)zte.com.cn>
At present shared disks can be migrated with either readonly or cache=none. But
cache=directsync should be safe for migration, because both cache=directsync and cache=none
don't use the host page cache, and cache=direct write through qemu block layer cache.
Signed-off-by: Peng Hao <peng.hao2(a)zte.com.cn>
Reviewed-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
src/qemu/qemu_migration.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c23fffe..9d509dd 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1160,11 +1160,12 @@ qemuMigrationIsSafe(virDomainDefPtr def,
const char *src = virDomainDiskGetSource(disk);
/* Our code elsewhere guarantees shared disks are either readonly (in
- * which case cache mode doesn't matter) or used with cache=none */
+ * which case cache mode doesn't matter) or used with cache=none or used with cache=directsync */
if (virStorageSourceIsEmpty(disk->src) ||
disk->src->readonly ||
disk->src->shared ||
- disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE)
+ disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE ||
+ disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC)
continue;
/* disks which are migrated by qemu are safe too */
@@ -1188,7 +1189,7 @@ qemuMigrationIsSafe(virDomainDefPtr def,
virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
_("Migration may lead to data corruption if disks"
- " use cache != none"));
+ " use cache != none or cache != directsync"));
return false;
}
--
1.8.3.1
7 years, 8 months
[libvirt] [PATCH] security: Don't overwrite error of GetProcessLabel
by Cole Robinson
Security impls of this function already raise errors, don't
overwrite them.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/lxc/lxc_driver.c | 6 ++----
src/qemu/qemu_driver.c | 7 +------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 652e9cba0..088d3d20f 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1348,11 +1348,9 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
}
if (virSecurityManagerGetProcessLabel(driver->securityManager,
- vm->def, priv->initpid, seclabel) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to get security label"));
+ vm->def, priv->initpid,
+ seclabel) < 0)
goto cleanup;
- }
}
ret = 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8d261b725..62d5b8dfe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6111,11 +6111,8 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secl
*/
if (virDomainObjIsActive(vm)) {
if (qemuSecurityGetProcessLabel(driver->securityManager,
- vm->def, vm->pid, seclabel) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to get security label"));
+ vm->def, vm->pid, seclabel) < 0)
goto cleanup;
- }
}
ret = 0;
@@ -6173,8 +6170,6 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
for (i = 0; i < len; i++) {
if (qemuSecurityGetProcessLabel(mgrs[i], vm->def, vm->pid,
&(*seclabels)[i]) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to get security label"));
VIR_FREE(mgrs);
VIR_FREE(*seclabels);
goto cleanup;
--
2.13.3
7 years, 8 months
[libvirt] [PATCH 0/2] util: uri: use unsigned numbers for port
by Peter Krempa
Peter Krempa (2):
qemu: command: Remove qemuNetworkDriveGetPort
util: uri: Convert port number to unsigned integer
src/qemu/qemu_command.c | 22 +++++-----------------
src/util/viruri.h | 2 +-
2 files changed, 6 insertions(+), 18 deletions(-)
--
2.13.2
7 years, 8 months