[libvirt] [PATCH 1/2] VMware: Simplify array walk for driver type

Rather than walking the possible driver backends by handle, use a helper function. Additionally I've done a bit of refactoring in the code over the past few commits so add myself to the copyright line. --- src/vmware/vmware_driver.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 25adb15..79954e0 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2011-2012 Red Hat, Inc. * Copyright 2010, diateam (www.diateam.net) + * Copyright (C) 2013. Doug Goldstein <cardoe@cardoe.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -156,13 +157,8 @@ vmwareConnectOpen(virConnectPtr conn, goto cleanup; } - driver->type = -1; - for (i = 0; i < VMWARE_DRIVER_LAST; i++) { - if (STREQ(tmp, vmwareDriverTypeToString(i))) { - driver->type = i; - break; - } - } + /* Match the non-'vmware' part of the scheme as the driver backend */ + driver->type = vmwareDriverTypeFromString(tmp); if (driver->type == -1) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to find valid " -- 1.8.1.5

Do VMware version detection earlier as future patches will need the version information to populate capabilities correctly. --- src/vmware/vmware_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 79954e0..0e7a37f 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -166,6 +166,9 @@ vmwareConnectOpen(virConnectPtr conn, goto cleanup; } + if (vmwareExtractVersion(driver) < 0) + goto cleanup; + if (!(driver->domains = virDomainObjListNew())) goto cleanup; @@ -178,9 +181,6 @@ vmwareConnectOpen(virConnectPtr conn, if (vmwareLoadDomains(driver) < 0) goto cleanup; - if (vmwareExtractVersion(driver) < 0) - goto cleanup; - conn->privateData = driver; return VIR_DRV_OPEN_SUCCESS; -- 1.8.1.5

On 10/10/2013 08:44 PM, Doug Goldstein wrote:
Do VMware version detection earlier as future patches will need the version information to populate capabilities correctly. --- src/vmware/vmware_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
ACK to both Jan
participants (2)
-
Doug Goldstein
-
Ján Tomko