On Thu, Apr 28, 2016 at 09:16:46AM +0200, Pavel Hrdina wrote:
On Wed, Apr 27, 2016 at 04:32:36PM +0200, Martin Kletzander wrote:
> Similarly to what commit 714080791778 did with some internal paths,
> clear vnc socket paths that were generated by us. Having such path in
> the definition can cause trouble when restoring the domain. The path is
> generated to the per-domain directory that contains the domain ID.
> However, that ID will be different upon restoration, so qemu won't be
> able to create that socket because the directory will not be prepared.
>
> To be able to migrate to older libvirt, skip formatting the socket path
> in migratable XML if it was autogenerated.
>
> Best viewed with '-C'.
>
> Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1326270
>
> Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
> ---
The only problem with this patch is that it won't survive libvirtd restart, so
until you restart libvirtd the migratable XML is correct, but after you restart
libvirtd the vncAutogenerated is lost.
Good catch! So this should work instead (squashed in):
diff --git i/src/qemu/qemu_domain.c w/src/qemu/qemu_domain.c
index d6f704d6f91b..3b9b4fc8280a 100644
--- i/src/qemu/qemu_domain.c
+++ w/src/qemu/qemu_domain.c
@@ -1660,7 +1660,7 @@ qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr
qemuCaps)
static void
-qemuDomainCleanupInternalPaths(virDomainDefPtr def, virQEMUDriverConfigPtr cfg)
+qemuDomainRecheckInternalPaths(virDomainDefPtr def, virQEMUDriverConfigPtr cfg)
{
size_t i = 0;
@@ -1669,8 +1669,12 @@ qemuDomainCleanupInternalPaths(virDomainDefPtr def,
virQEMUDriverConfigPtr cfg)
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
graphics->data.vnc.socket &&
- STRPREFIX(graphics->data.vnc.socket, cfg->libDir))
- VIR_FREE(graphics->data.vnc.socket);
+ STRPREFIX(graphics->data.vnc.socket, cfg->libDir)) {
+ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
+ VIR_FREE(graphics->data.vnc.socket);
+ else
+ graphics->data.vnc.socketAutogenerated = true;
+ }
}
}
@@ -1724,8 +1728,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def);
- if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
- qemuDomainCleanupInternalPaths(def, cfg);
+ qemuDomainRecheckInternalPaths(def, cfg);
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
--
Martin