[libvirt] Bug: vnc + websocket = websocket autoport not working right at live migration
by Piotr Rybicki
Hello.
Problem description:
When i start qemu via libvirt with vnc websocket defined, it is not
possible to live migrate to host where other qemu process is running
with the same display id.
migration error is:
error: internal error: early end of file from monitor: possible problem:
[1] => 2015-06-23T11:54:25.590506Z qemu-system-x86_64: -vnc 0.0.0.0:1,websocket=5700,password: Failed to start VNC server on `(null)': Failed to bind socket: Address already in use
(please note vnc display id=1 and websocket=5700 - where it should be 5701)
in libvirt's xml i have:
(...)
<graphics type='vnc' port='-1' autoport='yes' websocket='-1'
listen='0.0.0.0' passwd='xxx'>
<listen type='address' address='0.0.0.0'/>
</graphics>
(...)
for first and only qemu process on host, this creates qemu commandline:
(...) -vnc 0.0.0.0:0,websocket=5700,password (...)
for second qemu process on the same host:
(...) -vnc 0.0.0.0:1,websocket=5701,password (...)
There is no problem with migration, when there is no websocket
configuration.
Solution:
I believe, to solve this problem, libvirt has to omit websocket port
definition in commandline string ('websocket=5700' => 'websocket') when
autoport is defined in domain xml definition.
from man qemu:
-vnc display[,option[,option[,...]]]
(...)
websocket
Opens an additional TCP listening port dedicated to VNC
Websocket connections. By definition the Websocket port is
5700+display. If host is specified connections will only
be allowed from this host. As an alternative the Websocket port
could be specified by using "websocket"=port. TLS
encryption for the Websocket connection is supported if the required
certificates are specified with the VNC option x509.
So if I understand it right, not specifying websocket port means
5700+display id, and display id is given via commandline and increments
just fine.
Can anyone confirm this? Or perhaps there is some misconfiguration in my
xml domain definition?
Best regards
Piotr Rybicki
9 years, 5 months
[libvirt] [PATCH] qemu_hotplug: try harder to eject media
by Pavel Hrdina
Some guests lock the tray and QEMU eject command will simply fail to
eject the media. But the guest OS can handle this attempt to eject the
media and can unlock the tray and open it. In this case, we should try
again to actually eject the media.
If the first attempt fails we will wait for tray to open and try again
to eject the media, but if the second attempt fails, returns with error.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1147471
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0628964..0cebaad 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -201,13 +201,17 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
}
if (ret < 0)
- goto error;
+ VIR_DEBUG("tray is probably locked, wait for the guest to unlock "
+ "the tray and open it");
virObjectRef(vm);
/* we don't want to report errors from media tray_open polling */
while (retries) {
- if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)
+ if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) {
+ ret = 0;
+ virResetLastError();
break;
+ }
retries--;
virObjectUnlock(vm);
@@ -218,10 +222,29 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
virObjectUnref(vm);
if (retries <= 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Unable to eject media"));
- ret = -1;
+ /* Report a new error only if the first attempt don't fail and we don't
+ * receive VIR_DOMAIN_DISK_TRAY_OPEN event, otherwise report the error
+ * from first attempt. */
+ if (ret == 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Unable to eject media"));
+ ret = -1;
+ }
goto error;
+ } else {
+ /* QEMU will send eject request to guest, but if the tray is locked,
+ * always returns with error. However the guest can handle the eject
+ * request, unlock the tray and open it. In case this happens, we
+ * should try to eject the media once more. */
+ qemuDomainObjEnterMonitor(driver, vm);
+ ret = qemuMonitorEjectMedia(priv->mon, driveAlias, force);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0) {
+ ret = -1;
+ goto cleanup;
+ }
+
+ if (ret < 0)
+ goto error;
}
if (!virStorageSourceIsEmpty(newsrc)) {
--
2.4.4
9 years, 5 months
[libvirt] [sandbox PATCH 00/10] Patches for Libvirt-sandbox
by Eren Yagdiran
Hello,
These patches provide disk support for libvirt-sandbox.
Implemented '--disk' parameter will be useful when integrating Docker image support for libvirt-sandbox.
--Main diffs compared to previous patches.
Since many hypervisors, including kvm, will not even honour requested
names for disk devices we link each device under /dev/disk/by-tag
e.g /dev/disk/by-tag/foobar -> /dev/sda
We populate disks.cfg with tag to device mapping when we build the sandbox.
After that, in each init-process {Common,Qemu}, we basically read the configuration
and populate the right symlinks under /dev/disk/by-tag
The common functions for modifying directories are moved under Init-util. {Common,Qemu} inits are using them.
Cédric Bosdonnat (2):
Add gvir_sandbox_config_has_disks function
qemu: use devtmpfs rather than tmpfs to auto-populate /dev
Eren Yagdiran (8):
Add an utility function for guessing filetype from file extension
Add configuration object for disk support
Add disk parameter to virt-sandbox
Add disk support to the container builder
Add disk support to machine builder
Init-util : Common directory functions for init-common and init-qemu
Common-init: Building symlink from disks.cfg
Common-builder: /dev/disk/by-tag/thetag to /dev/vdN
bin/virt-sandbox.c | 37 +++
libvirt-sandbox/Makefile.am | 7 +-
.../libvirt-sandbox-builder-container.c | 37 ++-
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 44 ++-
libvirt-sandbox/libvirt-sandbox-builder.c | 73 ++++-
libvirt-sandbox/libvirt-sandbox-config-disk.c | 274 +++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config-disk.h | 82 ++++++
libvirt-sandbox/libvirt-sandbox-config.c | 300 +++++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config.h | 11 +
libvirt-sandbox/libvirt-sandbox-init-common.c | 51 +++-
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 151 ++---------
libvirt-sandbox/libvirt-sandbox-init-util.c | 58 ++++
libvirt-sandbox/libvirt-sandbox-init-util.h | 41 +++
libvirt-sandbox/libvirt-sandbox-util.c | 72 +++++
libvirt-sandbox/libvirt-sandbox-util.h | 5 +
libvirt-sandbox/libvirt-sandbox.h | 1 +
libvirt-sandbox/libvirt-sandbox.sym | 5 +
libvirt-sandbox/tests/test-config.c | 11 +
po/POTFILES.in | 1 +
19 files changed, 1112 insertions(+), 149 deletions(-)
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-util.c
--
2.1.0
9 years, 5 months
[libvirt] [PATCH 0/2] Handle isa-fdc removal from new q35 machine types
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1227880
Ján Tomko (2):
Separate isa-fdc options generation
Explicitly format the isa-fdc controller for newer q35 machines
src/qemu/qemu_command.c | 50 ++++++++++++++++------
src/qemu/qemu_domain.c | 22 ++++++++++
src/qemu/qemu_domain.h | 1 +
.../qemuxml2argv-boot-floppy-q35.args | 12 ++++++
.../qemuxml2argv-boot-floppy-q35.xml | 40 +++++++++++++++++
.../qemuxml2argv-bootindex-floppy-q35.args | 11 +++++
.../qemuxml2argv-bootindex-floppy-q35.xml | 40 +++++++++++++++++
tests/qemuxml2argvtest.c | 9 ++++
8 files changed, 172 insertions(+), 13 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-floppy-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-floppy-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bootindex-floppy-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bootindex-floppy-q35.xml
--
2.3.6
9 years, 5 months
[libvirt] [PATCH 0/5] vz: Reformat
by Michal Privoznik
There shouldn't be any functional change. Only some formatting nits fixed.
Michal Privoznik (5):
vz_driver: Reformat
vz_network: Reformat
vz_sdk: Reformat
vz_storage: Reformat
vz_utils: Reformat
src/vz/vz_driver.c | 86 ++++++++++-----------
src/vz/vz_network.c | 26 +++----
src/vz/vz_sdk.c | 209 ++++++++++++++++++++++++++--------------------------
src/vz/vz_storage.c | 58 +++++++--------
src/vz/vz_utils.h | 20 ++---
5 files changed, 199 insertions(+), 200 deletions(-)
--
2.3.6
9 years, 5 months
[libvirt] [sandbox PATCH 00/10] Patches for Libvirt-sandbox
by Eren Yagdiran
Hello,
These patches provide disk support for libvirt-sandbox.
Implemented '--disk' parameter will be useful when integrating Docker image support for libvirt-sandbox.
--Main diffs compared to previous patches.
Since many hypervisors, including kvm, will not even honour requested
names for disk devices we link each device under /dev/disk/by-tag
e.g /dev/disk/by-tag/foobar -> /dev/sda
We populate disks.cfg with tag to device mapping when we build the sandbox.
After that, in each init-process {Common,Qemu}, we basically read the configuration
and populate the right symlinks under /dev/disk/by-tag
The common functions for modifying directories are moved under Init-util. {Common,Qemu} inits are using them.
Cédric Bosdonnat (2):
Add gvir_sandbox_config_has_disks function
qemu: use devtmpfs rather than tmpfs to auto-populate /dev
Eren Yagdiran (8):
Add an utility function for guessing filetype from file extension
Add configuration object for disk support
Add disk parameter to virt-sandbox
Add disk support to the container builder
Add disk support to machine builder
Init-util : Common directory functions for init-common and init-qemu
Common-init: Building symlink from disks.cfg
Common-builder: /dev/disk/by-tag/thetag to /dev/vdN
bin/virt-sandbox.c | 37 +++
libvirt-sandbox/Makefile.am | 7 +-
.../libvirt-sandbox-builder-container.c | 37 ++-
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 44 ++-
libvirt-sandbox/libvirt-sandbox-builder.c | 73 ++++-
libvirt-sandbox/libvirt-sandbox-config-disk.c | 274 +++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config-disk.h | 82 ++++++
libvirt-sandbox/libvirt-sandbox-config.c | 300 +++++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config.h | 11 +
libvirt-sandbox/libvirt-sandbox-init-common.c | 51 +++-
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 151 ++---------
libvirt-sandbox/libvirt-sandbox-init-util.c | 58 ++++
libvirt-sandbox/libvirt-sandbox-init-util.h | 41 +++
libvirt-sandbox/libvirt-sandbox-util.c | 72 +++++
libvirt-sandbox/libvirt-sandbox-util.h | 5 +
libvirt-sandbox/libvirt-sandbox.h | 1 +
libvirt-sandbox/libvirt-sandbox.sym | 5 +
libvirt-sandbox/tests/test-config.c | 11 +
po/POTFILES.in | 1 +
19 files changed, 1112 insertions(+), 149 deletions(-)
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-util.c
--
2.1.0
9 years, 5 months
[libvirt] [PATCH v2 0/2] Storage fixes for libvirt.
by Prerna Saxena
From: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
Date: Mon, 22 Jun 2015 06:12:24 -0500
This is the second version of storage fixes.
V1 :
http://www.redhat.com/archives/libvir-list/2015-May/msg00050.html
Summary:
------------
Prerna Saxena (2):
Storage: Introduce shadow vol for refresh while the main vol builds.
Storage : Fix cloning of raw, sparse volumes
src/storage/storage_backend.c | 10 +++++-----
src/storage/storage_driver.c | 20 +++++++++++++-------
2 files changed, 18 insertions(+), 12 deletions(-)
Changelog:
--------------
1. Dropped patch 1/2 of v1 as per jtomko's suggestion; and introduced a
new patch for shadow-volume based cloning.
2. Reworked patch 2/2 incorporating review comments.
--
Regards,
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
9 years, 5 months
[libvirt] [PATCH] vz: Adapt to driver rename
by Michal Privoznik
In the e6d180f07fb06 commit the parallels driver was renamed to vz.
However, there was a commit merged later, which was sent to the list
before the rename. The other commit is 6de12b026b73. Fix all the
missing renames.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build breaker rule.
src/vz/vz_sdk.c | 23 ++++++++++++++++-------
src/vz/vz_sdk.h | 4 ++--
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 1a3aa87..388ea19 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2885,14 +2885,20 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom,
return ret;
}
-static void prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
+static int
+prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
{
+ int ret = -1;
PRL_RESULT pret;
PRL_HANDLE vnet = PRL_INVALID_HANDLE;
PRL_HANDLE job = PRL_INVALID_HANDLE;
- if (net->type != VIR_DOMAIN_NET_TYPE_BRIDGE)
- return;
+ if (net->type != VIR_DOMAIN_NET_TYPE_BRIDGE) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("unplugging network device of type %s is not supported"),
+ virDomainNetTypeToString(net->type));
+ return ret;
+ }
pret = PrlVirtNet_Create(&vnet);
prlsdkCheckRetGoto(pret, cleanup);
@@ -2904,16 +2910,19 @@ static void prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
if (PRL_FAILED(pret = waitJob(job)))
goto cleanup;
+ ret = 0;
+
cleanup:
PrlHandle_Free(vnet);
+ return ret;
}
int prlsdkAttachNet(virDomainObjPtr dom,
- parallelsConnPtr privconn,
+ vzConnPtr privconn,
virDomainNetDefPtr net)
{
int ret = -1;
- parallelsDomObjPtr privdom = dom->privateData;
+ vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job = PRL_INVALID_HANDLE;
if (!IS_CT(dom->def)) {
@@ -2998,11 +3007,11 @@ static int prlsdkDelNetAdapter(PRL_HANDLE sdkdom, int idx)
}
int prlsdkDetachNet(virDomainObjPtr dom,
- parallelsConnPtr privconn,
+ vzConnPtr privconn,
virDomainNetDefPtr net)
{
int ret = -1, idx = -1;
- parallelsDomObjPtr privdom = dom->privateData;
+ vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job = PRL_INVALID_HANDLE;
if (!IS_CT(dom->def)) {
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index cde8904..80ff69a 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -67,6 +67,6 @@ prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
int
prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
int
-prlsdkAttachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net);
+prlsdkAttachNet(virDomainObjPtr dom, vzConnPtr privconn, virDomainNetDefPtr net);
int
-prlsdkDetachNet(virDomainObjPtr dom, parallelsConnPtr privconn, virDomainNetDefPtr net);
+prlsdkDetachNet(virDomainObjPtr dom, vzConnPtr privconn, virDomainNetDefPtr net);
--
2.3.6
9 years, 5 months
[libvirt] [PATCH v2 00/15] test driver refactors
by Peter Krempa
Version 2 has a few more fixes as suggested by Michal.
Peter Krempa (15):
test: Rename testConn to testDriver
test: Drop useless forward declaration
test: turn 'defaultConn' into a pointer
test: Extract code to free testDriver into testDriverFree
test: Extract common parts of test driver data allocation
test: Drop unused attribute @path from testDriver struct
test: Annotate few fields of testDriver structure
test: Use atomic access to @nextDomID in struct virTestDriver
test: Refactor test driver event sending
test: Finalize removal of locking from driver->eventState
test: Drop locked access to testDriver->domains
test: Refactor test driver domain object retrieval
test: Refactor testDomainSetVcpusFlags
test: Refactor vcpu pinning and vcpu info retrieval
test: Refactor testNodeGetCPUMap
src/test/test_driver.c | 1305 +++++++++++++++---------------------------------
1 file changed, 401 insertions(+), 904 deletions(-)
--
2.4.1
9 years, 5 months
[libvirt] driver level connection close event
by Nikolay Shirokovskiy
Notify of connection close event from parallels driver (possibly) wrapped in
the remote driver.
Discussion.
In 1 and 2 patch we forced to some decisions because we don't have a weak
reference mechanics.
1 patch.
-----------
virConnectCloseCallback is introduced because we can not reference the
connection object itself when setting a network layer callback because of how
connection close works.
A connection close procedure is next:
1. client closes connection
2. a this point nobody else referencing a connection and it is disposed
3. connection dispose unreferencing network connection
4. network connection disposes
Thus if we referece a connection in network close callback we never get step 2.
virConnectCloseCallback broke this cycle but at cost that clients MUST
unregister explicitly before closing connection. This is not good as this
unregistration is not really neaded. Client is not telling that it does not
want to receive events anymore but rather forced to obey some
implementation-driven rules.
2 patch.
-----------
We impose requirements on driver implementations which is fragile. Moreover we
again need to make explicit unregistrations. Implementation of domain events
illustrates this point. remoteDispatchConnectDomainEventRegister does not
reference NetClient and makes unregistration before NetClient is disposed but
drivers do not meet the formulated requirements. Object event system release
lock before delivering event for re-entrance purposes.
Shortly we have 2 undesired consequences here.
1. Mandatory unregistration.
2. Imposing multi-threading requirements.
Introduction of weak pointers could free us from these artifacts. Next weak
reference workflow illustrates this.
1. Take weak reference on object of interest before passing to party. This
doesn't break disposing mechanics as weak eference does not prevent from
disposing object. Object is disposed but memory is not freed yet if there are
weak references.
2. When callback is called we are safe to check if pointer dangling as we make
a weak reference before.
3. Release weak reference and this trigger memory freeing if there are no more
weak references.
daemon/libvirtd.h | 1 +
daemon/remote.c | 87 ++++++++++++++++++++++++++++++++
src/datatypes.c | 112 +++++++++++++++++++++++++++++++----------
src/datatypes.h | 21 ++++++--
src/driver-hypervisor.h | 12 +++++
src/libvirt-host.c | 79 ++++++++++--------------------
src/remote/remote_driver.c | 108 +++++++++++++++++++++++++++++++---------
src/remote/remote_protocol.x | 24 +++++++++-
src/remote_protocol-structs | 6 ++
src/vz/vz_driver.c | 26 ++++++++++
src/vz/vz_sdk.c | 32 +++++++++++-
src/vz/vz_utils.h | 3 +
12 files changed, 396 insertions(+), 115 deletions(-)
9 years, 5 months