[libvirt] [PATCH] qemu: fix domxml-to-native failing when spice_tls is not enabled

The default graphics channel mode is 'any', so as to defaultMode attribute. If defaultMode and channel mode are all the default value 'any', qemuConnectDomainXMLToNative will set TLSPort. But in qemuBuildGraphicsSPICECommandLine, if spice_tls is not enabled, libvirtd will report an error to tell the user that spice TLS is disabled in qemu.conf. So qemuConnectDomainXMLToNative should check spice_tls is enabled, then decide to allocate an tlsPort number to this graphics. If user specified defaultMode is 'secure', qemuConnectDomainXMLToNative could allocate tlsPort, and then let qemuBuildGraphicsSPICECommandLine reports the spice_tls disabled error. The related bug is: https://bugzilla.redhat.com/show_bug.cgi?id=1113868 Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- src/qemu/qemu_driver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d34da6f..d1e3b2f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6013,7 +6013,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - needTLSPort = true; + if (cfg->spiceTLS) + needTLSPort = true; needPort = true; break; } -- 1.7.1

Well, I have some thought about this fix. For xml-to-native operation, user only need a qemu cmd pattern for a specified domain XML, so the qemu cmdline generated should be strained by qemu.conf. The function qemuBuildCommandLine(), called by qemuConnectDomainXMLToNative() and qemuProcessStart(), has a argument named standalone tells us if the user wants qemu cmdline. So I think an argument should be added to qemuBuildGraphicsSPICECommandLine() to inherit 'standalone'. ----- Original Message -----
The default graphics channel mode is 'any', so as to defaultMode attribute. If defaultMode and channel mode are all the default value 'any', qemuConnectDomainXMLToNative will set TLSPort. But in qemuBuildGraphicsSPICECommandLine, if spice_tls is not enabled, libvirtd will report an error to tell the user that spice TLS is disabled in qemu.conf.
So qemuConnectDomainXMLToNative should check spice_tls is enabled, then decide to allocate an tlsPort number to this graphics.
If user specified defaultMode is 'secure', qemuConnectDomainXMLToNative could allocate tlsPort, and then let qemuBuildGraphicsSPICECommandLine reports the spice_tls disabled error.
The related bug is: https://bugzilla.redhat.com/show_bug.cgi?id=1113868
Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- src/qemu/qemu_driver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d34da6f..d1e3b2f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6013,7 +6013,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, break;
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - needTLSPort = true; + if (cfg->spiceTLS) + needTLSPort = true; needPort = true; break; } -- 1.7.1

On 06/27/2014 04:37 PM, Jincheng Miao wrote:
The default graphics channel mode is 'any', so as to defaultMode attribute. If defaultMode and channel mode are all the default value 'any', qemuConnectDomainXMLToNative will set TLSPort. But in qemuBuildGraphicsSPICECommandLine, if spice_tls is not enabled, libvirtd will report an error to tell the user that spice TLS is disabled in qemu.conf.
So qemuConnectDomainXMLToNative should check spice_tls is enabled, then decide to allocate an tlsPort number to this graphics.
If user specified defaultMode is 'secure', qemuConnectDomainXMLToNative could allocate tlsPort, and then let qemuBuildGraphicsSPICECommandLine reports the spice_tls disabled error.
The related bug is: https://bugzilla.redhat.com/show_bug.cgi?id=1113868
Signed-off-by: Jincheng Miao <jmiao@redhat.com> --- src/qemu/qemu_driver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
ACK, I will push this later. Jan
participants (2)
-
Jincheng Miao
-
Ján Tomko