[libvirt] [PATCH v2 07/10] qemu: remove virConnectPtr from some more startup code paths
John Ferlan
jferlan at redhat.com
Fri Feb 16 03:10:34 UTC 2018
On 02/15/2018 11:50 AM, Daniel P. Berrangé wrote:
> There's a few places in startup code paths which pass around a
> virConnectPtr which is no longer required. Specifically, the
> qemuProcessStart() method now only requires a non-NULL connection if
> autodestroy is requested.
>
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
> src/qemu/qemu_driver.c | 35 +++++++----------------------------
> src/qemu/qemu_process.c | 26 ++++++++------------------
> src/qemu/qemu_process.h | 2 +-
> 3 files changed, 16 insertions(+), 47 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0a72102779..b7d94f1e3e 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
[...]
> @@ -297,18 +291,9 @@ static void
> qemuAutostartDomains(virQEMUDriverPtr driver)
> {
> virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
Doesn't seem we need @cfg here either.
> - /* XXX: Figure out a better way todo this. The domain
> - * startup code needs a connection handle in order
> - * to lookup the bridge associated with a virtual
> - * network
> - */
> - virConnectPtr conn = virConnectOpen(cfg->uri);
> - /* Ignoring NULL conn which is mostly harmless here */
> - struct qemuAutostartData data = { driver, conn };
>
[...]
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 703d62d3e9..77c93bedab 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2749,7 +2749,6 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
>
>
> struct qemuProcessHookData {
> - virConnectPtr conn;
> virDomainObjPtr vm;
> virQEMUDriverPtr driver;
> virQEMUDriverConfigPtr cfg;
> @@ -5937,7 +5936,12 @@ qemuProcessLaunch(virConnectPtr conn,
>
> cfg = virQEMUDriverGetConfig(driver);
>
> - hookData.conn = conn;
> + if ((flags & VIR_QEMU_PROCESS_START_AUTODESTROY) && !conn) {
> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> + _("Domain autodestroy requirs a connection handle"));
requires
> + return -1;
> + }
> +
> hookData.vm = vm;
> hookData.driver = driver;
> /* We don't increase cfg's reference counter here. */
[...]
Reviewed-by: John Ferlan <jferlan at redhat.com>
John
FYI: It's late - I'm going to stop here and pick this up in the morning
again. I've scanned the next couple, but not gone over them in detail yet.
More information about the libvir-list
mailing list