[libvirt] [PATCH] docs: Properly mark acl.html dependencies
by Michal Privoznik
The acl.html file includes aclperms.htmlinc which is generated.
However, there's a typo in the Makefile which makes make fail to see
the dependencies correctly.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index b7b49cb..b807a0b 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -163,7 +163,7 @@ EXTRA_DIST= \
sitemap.html.in aclperms.htmlinc \
todo.pl hvsupport.pl todo.cfg-example
-acl.html:: $(srcdir)/aclperms.htmlinc
+acl.html: $(srcdir)/aclperms.htmlinc
$(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
$(srcdir)/genaclperms.pl Makefile.am
--
2.3.6
9 years, 5 months
[libvirt] [PATCHv1.5 1/2] cpu:x86: fix specified features will disappear after migrate/restore
by Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1207095
We allow set the feature with the host-passthrough cpu,
but won't save them in the migration xml, the features we
specified will disappear after migrate/restore. This is because
we skip the virCPUDefUpdateFeature if cpu mode is host-passthrough.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
v1.5: just update the description.
src/cpu/cpu_x86.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 2a14705..26601b6 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2087,8 +2087,7 @@ x86UpdateCustom(virCPUDefPtr guest,
static int
x86UpdateHostModel(virCPUDefPtr guest,
- const virCPUDef *host,
- bool passthrough)
+ const virCPUDef *host)
{
virCPUDefPtr oldguest = NULL;
const struct x86_map *map;
@@ -2124,7 +2123,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
}
}
}
- for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
+ for (i = 0; i < oldguest->nfeatures; i++) {
if (virCPUDefUpdateFeature(guest,
oldguest->features[i].name,
oldguest->features[i].policy) < 0)
@@ -2149,11 +2148,11 @@ x86Update(virCPUDefPtr guest,
case VIR_CPU_MODE_HOST_MODEL:
guest->match = VIR_CPU_MATCH_EXACT;
- return x86UpdateHostModel(guest, host, false);
+ return x86UpdateHostModel(guest, host);
case VIR_CPU_MODE_HOST_PASSTHROUGH:
guest->match = VIR_CPU_MATCH_MINIMUM;
- return x86UpdateHostModel(guest, host, true);
+ return x86UpdateHostModel(guest, host);
case VIR_CPU_MODE_LAST:
break;
--
1.8.3.1
9 years, 5 months
[libvirt] [PATCHv3] qemu: add a check for slot and base when build dimm address
by Luyao Huang
When hot-plug a memory device, we don't check if there
is a memory device have the same address with the memory device
we want hot-pluged. Qemu forbid use/hot-plug 2 memory device
with same slot or the same base(qemu side this elemnt named addr).
Introduce a address check when build memory device qemu command line.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
v3:
rename qemuBuildMemoryDeviceAddr to qemuCheckMemoryDimmConflict and
remove the refactor.
src/qemu/qemu_command.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0a6d92f..d3f0a23 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4952,6 +4952,40 @@ qemuBuildMemoryDimmBackendStr(virDomainMemoryDefPtr mem,
}
+static bool
+qemuCheckMemoryDimmConflict(virDomainDefPtr def,
+ virDomainMemoryDefPtr mem)
+{
+ size_t i;
+
+ for (i = 0; i < def->nmems; i++) {
+ virDomainMemoryDefPtr tmp = def->mems[i];
+
+ if (tmp == mem ||
+ tmp->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM)
+ continue;
+
+ if (mem->info.addr.dimm.slot == tmp->info.addr.dimm.slot) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("memory device slot '%u' is already being"
+ " used by another memory device"),
+ mem->info.addr.dimm.slot);
+ return true;
+ }
+
+ if (mem->info.addr.dimm.base != 0 && tmp->info.addr.dimm.base != 0 &&
+ mem->info.addr.dimm.base == tmp->info.addr.dimm.base) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("memory device base '0x%llx' is already being"
+ " used by another memory device"),
+ mem->info.addr.dimm.base);
+ return true;
+ }
+ }
+
+ return false;
+}
+
char *
qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
virDomainDefPtr def,
@@ -4993,6 +5027,9 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
mem->targetNode, mem->info.alias, mem->info.alias);
if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+ if (qemuCheckMemoryDimmConflict(def, mem))
+ return NULL;
+
virBufferAsprintf(&buf, ",slot=%d", mem->info.addr.dimm.slot);
virBufferAsprintf(&buf, ",addr=%llu", mem->info.addr.dimm.base);
}
--
1.8.3.1
9 years, 5 months
[libvirt] [PATCH 0/5 v2] Corrections to SCSI logical unit handling
by Eric Farman
While working with the hostdev tag and SCSI LUNs, a problem was
discovered with the XML schema (see commit message in patch 4).
This spawned some further corrections to the handling of the
logical unit field throughout libvirt.
This series was split from a single patch, from this feedback:
http://www.redhat.com/archives/libvir-list/2015-June/msg00489.html
Eric Farman (5):
Print SCSI logical unit as a positive integer
Print SCSI logical unit as unsigned integer
Convert SCSI logical unit from int to long long
docs: Fix XML schema handling of LUN address in hostdev tag
docs: Correct typos in scsi hostdev and address elements
docs/formatdomain.html.in | 10 +++++++---
docs/schemas/domaincommon.rng | 14 ++++++++++++--
src/conf/domain_audit.c | 2 +-
src/conf/domain_conf.c | 4 ++--
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_command.h | 2 +-
src/qemu/qemu_hotplug.c | 4 ++--
src/util/virhostdev.c | 6 +++---
src/util/virscsi.c | 16 ++++++++--------
src/util/virscsi.h | 8 ++++----
tests/testutilsqemu.c | 2 +-
tools/virsh-domain.c | 6 +++---
12 files changed, 45 insertions(+), 31 deletions(-)
--
1.9.1
9 years, 5 months
[libvirt] [PATCH 0/3] JSON parsing simplification
by Eric Blake
Add and use a new virJSONValueObjectGetObject() and friends,
exposing and fixing a bug in our JSON parser along the way.
Eric Blake (3):
json: fully parse input string
json: make it easier to type-check when getting from object
qemu: simplify json parsing
src/libvirt_private.syms | 3 +
src/qemu/qemu_monitor_json.c | 164 ++++++++++++++++---------------------------
src/util/virjson.c | 80 +++++++++++----------
src/util/virjson.h | 8 ++-
tests/jsontest.c | 129 ++++++++++++++++++++++++++++++++++
5 files changed, 242 insertions(+), 142 deletions(-)
--
2.4.3
9 years, 5 months
[libvirt] [PATCH v2] parallels: implementation of attach/detach network devices
by Mikhail Feoktistov
Changes from v1
Remove "cleanup" label and "goto" operator from prlsdkAttachNet() and prlsdkDetachNet()
Replace it with "return" operator.
Rename netMac variable to expectedMac in prlsdkGetNetIndex()
Move prlsdkGetNetIndex() call after PrlVm_BeginEdit call in prlsdkDetachNet() function.
Patch comment:
In this patch we add VIR_DOMAIN_DEVICE_NET handlers implementation
for domainAttachDevice and domainDetachDevice callbacks.
As soon as we don't support this operation for hypervisor type domains,
we implement this functionality for containers only.
In detach procedure we find network device by MAC address.
Because PrlVmDevNet_GetMacAddress() returns MAC as a UTF-8 encoded
null-terminated string, we use memcmp() to compare it.
Also we remove corresponding virtual network by prlsdkDelNetAdapter call.
---
src/vz/vz_driver.c | 16 +++++++
src/vz/vz_sdk.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/vz/vz_sdk.h | 4 ++
3 files changed, 143 insertions(+), 0 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index cef3c77..d9ddd4f 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1117,6 +1117,14 @@ static int vzDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
goto cleanup;
}
break;
+ case VIR_DOMAIN_DEVICE_NET:
+ ret = prlsdkAttachNet(privdom, privconn, dev->data.net);
+ if (ret) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("network attach failed"));
+ goto cleanup;
+ }
+ break;
default:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("device type '%s' cannot be attached"),
@@ -1186,6 +1194,14 @@ static int vzDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
goto cleanup;
}
break;
+ case VIR_DOMAIN_DEVICE_NET:
+ ret = prlsdkDetachNet(privdom, privconn, dev->data.net);
+ if (ret) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("network detach failed"));
+ goto cleanup;
+ }
+ break;
default:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("device type '%s' cannot be detached"),
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 090a3ad..6e6d8c9 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2914,6 +2914,129 @@ static void prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
PrlHandle_Free(vnet);
}
+int prlsdkAttachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net)
+{
+ int ret = -1;
+ parallelsDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+ if (!IS_CT(dom->def)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("network device cannot be attached"));
+ return ret;
+ }
+
+ job = PrlVm_BeginEdit(privdom->sdkdom);
+ if (PRL_FAILED(waitJob(job)))
+ return ret;
+
+ ret = prlsdkAddNet(privdom->sdkdom, privconn, net, IS_CT(dom->def));
+ if (ret == 0) {
+ job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
+ if (PRL_FAILED(waitJob(job))) {
+ return -1;
+ }
+ }
+
+ return ret;
+}
+
+static int
+prlsdkGetNetIndex(PRL_HANDLE sdkdom, virDomainNetDefPtr net)
+{
+ int idx = -1;
+ PRL_RESULT pret;
+ PRL_UINT32 adaptersCount;
+ PRL_UINT32 i;
+ PRL_HANDLE adapter = PRL_INVALID_HANDLE;
+ PRL_UINT32 len;
+ char adapterMac[PRL_MAC_STRING_BUFNAME];
+ char expectedMac[PRL_MAC_STRING_BUFNAME];
+
+ prlsdkFormatMac(&net->mac, expectedMac);
+ pret = PrlVmCfg_GetNetAdaptersCount(sdkdom, &adaptersCount);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ for (i = 0; i < adaptersCount; ++i) {
+
+ pret = PrlVmCfg_GetNetAdapter(sdkdom, i, &adapter);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ len = sizeof(adapterMac);
+ memset(adapterMac, 0, sizeof(adapterMac));
+ pret = PrlVmDevNet_GetMacAddress(adapter, adapterMac, &len);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ if (memcmp(adapterMac, expectedMac, PRL_MAC_STRING_BUFNAME)) {
+
+ PrlHandle_Free(adapter);
+ adapter = PRL_INVALID_HANDLE;
+ continue;
+ }
+
+ idx = i;
+ break;
+ }
+
+ cleanup:
+ PrlHandle_Free(adapter);
+ return idx;
+}
+
+static int prlsdkDelNetAdapter(PRL_HANDLE sdkdom, int idx)
+{
+ int ret = -1;
+ PRL_RESULT pret;
+ PRL_HANDLE sdknet = PRL_INVALID_HANDLE;
+
+ pret = PrlVmCfg_GetNetAdapter(sdkdom, idx, &sdknet);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ pret = PrlVmDev_Remove(sdknet);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ ret = 0;
+
+ cleanup:
+ PrlHandle_Free(sdknet);
+ return ret;
+}
+
+int prlsdkDetachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net)
+{
+ int ret = -1, idx = -1;
+ parallelsDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+ if (!IS_CT(dom->def)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("network device cannot be detached"));
+ return ret;
+ }
+
+ job = PrlVm_BeginEdit(privdom->sdkdom);
+ if (PRL_FAILED(waitJob(job)))
+ return ret;
+
+ idx = prlsdkGetNetIndex(privdom->sdkdom, net);
+ if (idx < 0)
+ return ret;
+
+ ret = prlsdkDelNet(privconn, net);
+ if (ret != 0)
+ return ret;
+
+ ret = prlsdkDelNetAdapter(privdom->sdkdom, idx);
+ if (ret == 0) {
+ job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
+ if (PRL_FAILED(waitJob(job))) {
+ return -1;
+ }
+ }
+
+ return ret;
+}
+
static int prlsdkDelDisk(PRL_HANDLE sdkdom, int idx)
{
int ret = -1;
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index dd4fecf..cde8904 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -66,3 +66,7 @@ int
prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
int
prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
+int
+prlsdkAttachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net);
+int
+prlsdkDetachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net);
--
1.7.1
9 years, 5 months
[libvirt] Add hook for network update event
by kay
Hey guys,
This is duplicate from Bugzilla
(https://bugzilla.redhat.com/show_bug.cgi?id=1181539), but I would
like to ask you if my patch looks good.
"virsh net-update" starts iptables rules reload for NAT network
system. This event doesn't start network hooks, so all previous custom
iptables rules become unavailable.
How reproducible:
Add "/etc/libvirt/hooks/network" with:
-------------------------------------------
#!/bin/bash
echo "`date` $0 $@" >> /var/log/libvirt.log
-------------------------------------------
Restart libvirt and run virsh net-update command:
virsh net-update default modify ip-dhcp-host --live --config "<host
mac='52:54:00:97:eb:95' name='test' ip='192.168.122.253'/>"
Actual results:
/var/log/libvirt.log log file doesn't contain events from virsh
net-update command.
Expected results:
/var/log/libvirt.log log file should contain event.
Additional info:
This bug brakes iptables hooks hack for FORWARD chain with NAT network.
Patch file is attached. It was tested with libvirt 1.2.15
9 years, 5 months
[libvirt] [PATCH] vz: Fix error messages in libvirt log caused by unhadled events
by Mikhail Feoktistov
We need to handle events with PIE_DISPATCHER type.
Do not write error messages to log in case of unhandled event types.
---
src/parallels/parallels_sdk.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 34605ea..d208c19 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -1685,8 +1685,7 @@ prlsdkHandleVmEvent(parallelsConnPtr privconn, PRL_HANDLE prlEvent)
return prlsdkHandleVmRemovedEvent(privconn, uuid);
break;
default:
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Can't handle event of type %d"), prlEventType);
+ VIR_DEBUG("Skipping event type %d", prlEventType);
return PRL_ERR_FAILURE;
}
@@ -1721,6 +1720,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
switch (prlIssuerType) {
case PIE_VIRTUAL_MACHINE:
+ case PIE_DISPATCHER:
pret = prlsdkHandleVmEvent(privconn, prlEvent);
break;
default:
--
1.7.1
9 years, 5 months
[libvirt] [PATCH] virt-aa-helper: Fix permissions for vhost-user socket files
by Michal Dubiel
QEMU working in vhost-user mode communicates with the other end (i.e.
some virtual router application) via unix domain sockets. This requires
that permissions for the socket files are correctly written into
/etc/apparmor.d/libvirt/libvirt-UUID.files.
Signed-off-by: Michal Dubiel <md(a)semihalf.com>
---
src/security/virt-aa-helper.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 35423b5..a097aa6 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -592,19 +592,9 @@ valid_path(const char *path, const bool readonly)
if (!virFileExists(path)) {
vah_warning(_("path does not exist, skipping file type checks"));
- } else {
- if (stat(path, &sb) == -1)
+ } else if (stat(path, &sb) == -1)
return -1;
- switch (sb.st_mode & S_IFMT) {
- case S_IFSOCK:
- return 1;
- break;
- default:
- break;
- }
- }
-
opaths = sizeof(override)/sizeof(*(override));
npaths = sizeof(restricted)/sizeof(*(restricted));
@@ -1101,6 +1091,18 @@ get_files(vahControl * ctl)
}
}
+ for (i = 0; i < ctl->def->nnets; i++) {
+ if (ctl->def->nets[i] &&
+ ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
+ ctl->def->nets[i]->data.vhostuser) {
+ virDomainChrSourceDefPtr vhu = ctl->def->nets[i]->data.vhostuser;
+
+ if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",
+ vhu->type) != 0)
+ goto cleanup;
+ }
+ }
+
if (ctl->def->virtType == VIR_DOMAIN_VIRT_KVM) {
for (i = 0; i < ctl->def->nnets; i++) {
virDomainNetDefPtr net = ctl->def->nets[i];
--
1.9.1
9 years, 5 months