[libvirt] [RFC] Allowing promiscuous mode for domains network interfaces
by Jean-Baptiste Rouault
Hi all,
By default, OpenVZ and VirtualBox (> 4.0.x) filter network packets by MAC
addresses : only broadcast, multicast and packets directly targeted to VMs are
transmitted.
This behaviour prevents from using promiscuous mode inside domains.
I'd like to write some patches to disable these filters from libvirt.
Would it be ok to modify OpenVZ and VirtualBox drivers so that they disable
the filters by default ?
If this is not acceptable, what about making it configurable through domains'
XML ?
Regards,
Jean-Baptiste
--
Jean-Baptiste ROUAULT
Ingénieur R&D - diateam : Architectes de l'information
Phone : +33 (0)2 98 050 050 Fax : +33 (0)2 98 050 051
12 years, 4 months
[libvirt] [PATCH v7 0/8] Add basic driver for Parallels Virtuozzo Server
by Dmitry Guryanov
Parallels Cloud Server is a virtualization solution
that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.
More information can be found here: http://www.parallels.com/products/pcs/
Also beta version of Parallels Cloud Server can be downloaded there.
Dmitry Guryanov (8):
parallels: add driver skeleton
parallels: add functions to list domains and get info
parallels: implement functions for domain life cycle management
parallels: get info about serial ports
parallels: add support of VNC remote display
parallels: implement virDomainDefineXML operation for existing
domains
parallels: add storage driver
parallels: implement VM creation
cfg.mk | 1 +
configure.ac | 23 +
docs/drvparallels.html.in | 28 +
include/libvirt/virterror.h | 2 +-
libvirt.spec.in | 9 +-
mingw32-libvirt.spec.in | 6 +
po/POTFILES.in | 4 +
src/Makefile.am | 15 +
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 9 +
src/parallels/parallels_driver.c | 1309 +++++++++++++++++++++++++++++++++
src/parallels/parallels_driver.h | 75 ++
src/parallels/parallels_storage.c | 1456 +++++++++++++++++++++++++++++++++++++
src/parallels/parallels_utils.c | 131 ++++
src/util/virterror.c | 3 +-
17 files changed, 3072 insertions(+), 4 deletions(-)
create mode 100644 docs/drvparallels.html.in
create mode 100644 src/parallels/parallels_driver.c
create mode 100644 src/parallels/parallels_driver.h
create mode 100644 src/parallels/parallels_storage.c
create mode 100644 src/parallels/parallels_utils.c
12 years, 4 months
[libvirt] can't receive keepalive message during migration
by Hu Tao
Hi,
When testing migration, I found a problem that the server can't receive
keepalive reply from client when doing migration. The log shows that
virsh did send the keepalive reply, but server didn't reveive it.
The strange part is it's OK to migrate from host A to Host B, but always
fails to migrate from host B to host A. When disable keepalive,
migration will success.
Any ideas?
--
Thanks,
Hu Tao
12 years, 4 months
[libvirt] [PATCH] virsh: Avoid division by 0 in vshCalloc
by Peter Krempa
vshCalloc function uses xalloc_oversized macro that can't take 0 as it's
second argument. If vshCalloc is called with size 0, virsh ends with a
floating point exception.
This patch changes vshCalloc to return NULL if no memory is requested.
---
tools/virsh.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 53d1825..d3d5c6a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -460,6 +460,9 @@ _vshCalloc(vshControl *ctl, size_t nmemb, size_t size, const char *filename, int
{
char *x;
+ if (!size)
+ return NULL;
+
if (!xalloc_oversized(nmemb, size) &&
VIR_ALLOC_N(x, nmemb * size) == 0)
return x;
--
1.7.8.6
12 years, 4 months
[libvirt] [PATCH] Only enforce check for YAJL when starting a VM
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The previous check for YAJL would have many undesirable
consequences, the most important being that it caused the
capabilities XML to loose all <guest> elements. There is
no user visible feedback as to what is wrong in this respect,
merely a syslog message. The empty capabilities causes
libvirtd to then throw away all guest XML configs that are
stored.
This changes the code so that the check for YAJL is only
performed at the time we attempt to spawn a QEMU process
error: Failed to start domain vm-vnc
error: unsupported configuration: this qemu binary requires libvirt to be compiled with yajl
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 13 +++++++++----
src/qemu/qemu_capabilities.h | 4 +++-
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_driver.c | 1 +
src/qemu/qemu_process.c | 3 +++
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1e12a39..1d6ab2d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -691,7 +691,8 @@ qemuCapsInitGuest(virCapsPtr caps,
return 0;
/* Ignore binary if extracting version info fails */
- if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0) {
+ if (qemuCapsExtractVersionInfo(binary, info->arch,
+ false, NULL, &qemuCaps) < 0) {
ret = 0;
goto cleanup;
}
@@ -1472,7 +1473,9 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
return 0;
}
-int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
+int qemuCapsExtractVersionInfo(const char *qemu,
+ const char *arch,
+ bool check_yajl,
unsigned int *retversion,
virBitmapPtr *retflags)
{
@@ -1505,7 +1508,8 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
if (!(flags = qemuCapsNew()) ||
qemuCapsParseHelpStr(qemu, help, flags,
- &version, &is_kvm, &kvm_version, true) == -1)
+ &version, &is_kvm, &kvm_version,
+ check_yajl) == -1)
goto cleanup;
/* Currently only x86_64 and i686 support PCI-multibus. */
@@ -1583,7 +1587,8 @@ int qemuCapsExtractVersion(virCapsPtr caps,
return -1;
}
- if (qemuCapsExtractVersionInfo(binary, ut.machine, version, NULL) < 0) {
+ if (qemuCapsExtractVersionInfo(binary, ut.machine, false,
+ version, NULL) < 0) {
return -1;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 83c135b..c14d53a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -167,7 +167,9 @@ int qemuCapsProbeCPUModels(const char *qemu,
int qemuCapsExtractVersion(virCapsPtr caps,
unsigned int *version);
-int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
+int qemuCapsExtractVersionInfo(const char *qemu,
+ const char *arch,
+ bool check_yajl,
unsigned int *version,
virBitmapPtr *qemuCaps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 528b189..5959352 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -949,6 +949,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def)
qemuDomainPCIAddressSetPtr addrs = NULL;
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
+ false,
NULL,
&qemuCaps) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2f93404..eb2ed0e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4757,6 +4757,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
}
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
+ false,
NULL,
&qemuCaps) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c5140c3..fd4c9c9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3073,6 +3073,7 @@ qemuProcessReconnect(void *opaque)
*/
if (!priv->qemuCaps &&
qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
+ false,
NULL,
&priv->qemuCaps) < 0)
goto error;
@@ -3478,6 +3479,7 @@ int qemuProcessStart(virConnectPtr conn,
qemuCapsFree(priv->qemuCaps);
priv->qemuCaps = NULL;
if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch,
+ true,
NULL,
&priv->qemuCaps) < 0)
goto cleanup;
@@ -4237,6 +4239,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
priv->qemuCaps = NULL;
if (qemuCapsExtractVersionInfo(vm->def->emulator,
vm->def->os.arch,
+ false,
NULL,
&priv->qemuCaps) < 0)
goto cleanup;
--
1.7.10.4
12 years, 4 months
[libvirt] [PATCH] virsh: Fix ordering of arguments when calling vshCalloc.
by Peter Krempa
In vshSnapshotListCollect() vshCalloc was called with swapped nmemb and
size argument. This caused division by zero in xalloc_oversized as the
macro doesn't expect size to be zero.
---
tools/virsh.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 53d1825..25ed177 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -17200,8 +17200,8 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
if (count >= 0) {
/* When mixing --from and --tree, we also want a copy of from
* in the list, but with no parent for that one entry. */
- snaplist->snaps = vshCalloc(ctl, sizeof(*snaplist->snaps),
- count + (tree && from));
+ snaplist->snaps = vshCalloc(ctl, pcount + (tree && from),
+ sizeof(*snaplist->snaps));
snaplist->nsnaps = count;
for (i = 0; i < count; i++)
snaplist->snaps[i].snap = snaps[i];
--
1.7.8.6
12 years, 4 months
[libvirt] [PATCH] qemu: Mark domains as having managed state image only on managed save
by Peter Krempa
QEmu domains were marked as having managed save image even if they were
saved using the regular save. With this patch, domains are marked so
only when using managed save API.
---
src/qemu/qemu_driver.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2f93404..3410535 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2739,7 +2739,6 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom,
}
ret = 0;
- vm->hasManagedSave = true;
/* Shut it down */
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED, 0);
@@ -2916,8 +2915,10 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
VIR_INFO("Saving state to %s", name);
compressed = QEMUD_SAVE_FORMAT_RAW;
- ret = qemuDomainSaveInternal(driver, dom, vm, name, compressed,
- NULL, flags);
+ if ((ret = qemuDomainSaveInternal(driver, dom, vm, name, compressed,
+ NULL, flags)) == 0)
+ vm->hasManagedSave = true;
+
vm = NULL;
cleanup:
--
1.7.8.6
12 years, 4 months
[libvirt] question about save/restore domain
by Jovanka Gulicoska
Hi,
my name is Jovanka Gulicoska and I'm SoC student. I'm working on
implementing save/load of VM in Gnome-Boxes.
Something confused me about snapshots. In the documentation about life
cycle, in section about Save/Restore is said that domain saved with
virDomainSave/virDomainSaveFlags can be restored only once. But in the
documentation about Snapshot XML format there is no information about this
in VM state snapshots.
So is it better just to use virDomainSnapshotCreateXML instead of
virDomainSave/virDomainSaveFlags?
I've created bindings for this functions in libvirt-glib but I wanted to be
sure before I send them for review.
Thanks,
Jovanka (gulic)
12 years, 4 months
[libvirt] libvirt can't get capablities
by Li Zhang
Hi,
I have suffered several times on both x86 machine and power machine.
When we want to use libvirt to create on VMs, it reports "unknown OS
type hvm".
We can't get <guest> capabilities.
The log is as the following(log_level=1):
2003-01-02 01:21:39.895+0000: 12214: error : virDomainDefParseXML:8491 :
unknown OS type hvm
2003-01-02 01:21:39.896+0000: 12214: error : virDomainDefParseXML:8491 :
unknown OS type hvm
2003-01-02 01:22:00.135+0000: 12207: error :
qemuCapsComputeCmdFlags:1218 : unsupported configuration: this qemu
binary requires libvirt to be compiled with yajl
2003-01-02 01:22:13.342+0000: 12207: error :
qemuCapsComputeCmdFlags:1218 : unsupported configuration: this qemu
binary requires libvirt to be compiled with yajl
2003-01-02 01:22:13.347+0000: 12204: error : qemuCapsExtractVersion:1576
: internal error Cannot find suitable emulator for ppc64
2003-01-02 01:22:13.351+0000: 12205: error : qemuCapsExtractVersion:1576
: internal error Cannot find suitable emulator for ppc64
2003-01-02 01:22:13.355+0000: 12207: error : qemuCapsExtractVersion:1576
: internal error Cannot find suitable emulator for ppc64
2003-01-02 01:22:13.355+0000: 12208: error : qemuCapsExtractVersion:1576
: internal error Cannot find suitable emulator for ppc64
2003-01-02 01:22:13.357+0000: 12206: error : qemuCapsExtractVersion:1576
: internal error Cannot find suitable emulator for ppc64
I search online and find one similar issue from Redhat bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=509337
Is there any solution to avoid this problem?
Any idea?
--
Best Regards
Li
IBM LTC, China System&Technology Lab, Beijing
12 years, 4 months
[libvirt] [Patch v2] vmware: detect when a domain was shut down from the inside
by Jean-Baptiste Rouault
This patch adds an internal function vmwareUpdateVMStatus to
update the real state of the domain. This function is used in
various places in the driver, in particular to detect when
the domain has been shut down by the user with the "halt"
command.
---
v2:
- Replace internal function vmwareGetVMStatus by vmwareUpdateVMStatus
- Improve vmrun list output parsing
- variable initialization and coding-style fixes
src/vmware/vmware_driver.c | 95 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 8f9d922..53e28e7 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -28,6 +28,7 @@
#include "datatypes.h"
#include "virfile.h"
#include "memory.h"
+#include "util.h"
#include "uuid.h"
#include "command.h"
#include "vmx.h"
@@ -181,6 +182,64 @@ vmwareGetVersion(virConnectPtr conn, unsigned long *version)
}
static int
+vmwareUpdateVMStatus(struct vmware_driver *driver, virDomainObjPtr vm)
+{
+ virCommandPtr cmd;
+ char *outbuf = NULL;
+ char *vmxAbsolutePath = NULL;
+ char *parsedVmxPath = NULL;
+ char *str;
+ char *saveptr = NULL;
+ bool found = false;
+ int oldState = virDomainObjGetState(vm, NULL);
+ int newState;
+ int ret = -1;
+
+ cmd = virCommandNewArgList(VMRUN, "-T", vmw_types[driver->type],
+ "list", NULL);
+ virCommandSetOutputBuffer(cmd, &outbuf);
+ if (virCommandRun(cmd, NULL) < 0)
+ goto cleanup;
+
+ if (virFileResolveAllLinks(((vmwareDomainPtr) vm->privateData)->vmxPath,
+ &vmxAbsolutePath) < 0)
+ goto cleanup;
+
+ for(str = outbuf ; (parsedVmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
+ str = NULL) {
+
+ if (parsedVmxPath[0] != '/')
+ continue;
+
+ if (STREQ(parsedVmxPath, vmxAbsolutePath)) {
+ found = true;
+ /* If the vmx path is in the output, the domain is running or
+ * is paused but we have no way to detect if it is paused or not. */
+ if (oldState == VIR_DOMAIN_PAUSED)
+ newState = oldState;
+ else
+ newState = VIR_DOMAIN_RUNNING;
+ break;
+ }
+ }
+
+ if (!found) {
+ vm->def->id = -1;
+ newState = VIR_DOMAIN_SHUTOFF;
+ }
+
+ virDomainObjSetState(vm, newState, 0);
+
+ ret = 0;
+
+cleanup:
+ virCommandFree(cmd);
+ VIR_FREE(outbuf);
+ VIR_FREE(vmxAbsolutePath);
+ return ret;
+}
+
+static int
vmwareStopVM(struct vmware_driver *driver,
virDomainObjPtr vm,
virDomainShutoffReason reason)
@@ -331,6 +390,9 @@ vmwareDomainShutdownFlags(virDomainPtr dom,
goto cleanup;
}
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
+
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
vmwareError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domain is not in running state"));
@@ -485,6 +547,8 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
vmwareSetSentinal(cmd, vmw_types[driver->type]);
vmwareSetSentinal(cmd, vmxPath);
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
vmwareError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -596,6 +660,9 @@ vmwareDomainCreateWithFlags(virDomainPtr dom,
goto cleanup;
}
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
+
if (virDomainObjIsActive(vm)) {
vmwareError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is already running"));
@@ -645,6 +712,9 @@ vmwareDomainUndefineFlags(virDomainPtr dom,
goto cleanup;
}
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
+
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
@@ -874,6 +944,21 @@ vmwareDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
return xml;
}
+static void vmwareDomainObjListUpdateDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *data)
+{
+ struct vmware_driver *driver = data;
+ virDomainObjPtr vm = payload;
+ virDomainObjLock(vm);
+ vmwareUpdateVMStatus(driver, vm);
+ virDomainObjUnlock(vm);
+}
+
+static void
+vmwareDomainObjListUpdateAll(virDomainObjListPtr doms, struct vmware_driver *driver)
+{
+ virHashForEach(doms->objs, vmwareDomainObjListUpdateDomain, driver);
+}
+
static int
vmwareNumDefinedDomains(virConnectPtr conn)
{
@@ -881,6 +966,7 @@ vmwareNumDefinedDomains(virConnectPtr conn)
int n;
vmwareDriverLock(driver);
+ vmwareDomainObjListUpdateAll(&driver->domains, driver);
n = virDomainObjListNumOfDomains(&driver->domains, 0);
vmwareDriverUnlock(driver);
@@ -894,6 +980,7 @@ vmwareNumDomains(virConnectPtr conn)
int n;
vmwareDriverLock(driver);
+ vmwareDomainObjListUpdateAll(&driver->domains, driver);
n = virDomainObjListNumOfDomains(&driver->domains, 1);
vmwareDriverUnlock(driver);
@@ -908,6 +995,7 @@ vmwareListDomains(virConnectPtr conn, int *ids, int nids)
int n;
vmwareDriverLock(driver);
+ vmwareDomainObjListUpdateAll(&driver->domains, driver);
n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
vmwareDriverUnlock(driver);
@@ -922,6 +1010,7 @@ vmwareListDefinedDomains(virConnectPtr conn,
int n;
vmwareDriverLock(driver);
+ vmwareDomainObjListUpdateAll(&driver->domains, driver);
n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
vmwareDriverUnlock(driver);
return n;
@@ -944,6 +1033,9 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
goto cleanup;
}
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
+
info->state = virDomainObjGetState(vm, NULL);
info->cpuTime = 0;
info->maxMem = vm->def->mem.max_balloon;
@@ -979,6 +1071,9 @@ vmwareDomainGetState(virDomainPtr dom,
goto cleanup;
}
+ if (vmwareUpdateVMStatus(driver, vm) < 0)
+ goto cleanup;
+
*state = virDomainObjGetState(vm, reason);
ret = 0;
--
1.7.9.1
12 years, 4 months