[libvirt] [PATCHv2 08/27] esx: reject unknown flags
Matthias Bolte
matthias.bolte at googlemail.com
Wed Jul 13 12:15:51 UTC 2011
2011/7/8 Eric Blake <eblake at redhat.com>:
> Silently ignored flags get in the way of new features that
> use those flags.
>
> * src/esx/esx_device_monitor.c (esxDeviceOpen): Reject unknown
> flags.
> * src/esx/esx_driver.c (esxOpen, esxDomainReboot)
> (esxDomainXMLFromNative, esxDomainXMLToNative)
> (esxDomainMigratePrepare, esxDomainMigratePerform)
> (esxDomainMigrateFinish): Likewise.
> * src/esx/esx_interface_driver.c (esxInterfaceOpen): Likewise.
> * src/esx/esx_network_driver.c (esxNetworkOpen): Likewise.
> * src/esx/esx_nwfilter_driver.c (esxNWFilterOpen): Likewise.
> * src/esx/esx_secret_driver.c (esxSecretOpen): Likewise.
> * src/esx/esx_storage_driver.c (esxStorageOpen): Likewise.
> ---
> src/esx/esx_device_monitor.c | 4 +++-
> src/esx/esx_driver.c | 28 +++++++++++++++++++++-------
> src/esx/esx_interface_driver.c | 4 +++-
> src/esx/esx_network_driver.c | 4 +++-
> src/esx/esx_nwfilter_driver.c | 4 +++-
> src/esx/esx_secret_driver.c | 4 +++-
> src/esx/esx_storage_driver.c | 4 +++-
> 7 files changed, 39 insertions(+), 13 deletions(-)
> @@ -3829,12 +3837,14 @@ esxDomainMigratePrepare(virConnectPtr dconn,
> int *cookielen ATTRIBUTE_UNUSED,
> const char *uri_in ATTRIBUTE_UNUSED,
> char **uri_out,
> - unsigned long flags ATTRIBUTE_UNUSED,
> + unsigned long flags,
> const char *dname ATTRIBUTE_UNUSED,
> unsigned long resource ATTRIBUTE_UNUSED)
> {
> esxPrivate *priv = dconn->privateData;
>
> + virCheckFlags(0, -1);
> +
> if (uri_in == NULL) {
> if (virAsprintf(uri_out, "vpxmigr://%s/%s/%s",
> priv->vCenter->ipAddress,
> @@ -3855,7 +3865,7 @@ esxDomainMigratePerform(virDomainPtr domain,
> const char *cookie ATTRIBUTE_UNUSED,
> int cookielen ATTRIBUTE_UNUSED,
> const char *uri,
> - unsigned long flags ATTRIBUTE_UNUSED,
> + unsigned long flags,
> const char *dname,
> unsigned long bandwidth ATTRIBUTE_UNUSED)
> {
> @@ -3873,6 +3883,8 @@ esxDomainMigratePerform(virDomainPtr domain,
> esxVI_TaskInfoState taskInfoState;
> char *taskInfoErrorMessage = NULL;
>
> + virCheckFlags(0, -1);
> +
> if (priv->vCenter == NULL) {
> ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
> _("Migration not possible without a vCenter"));
> @@ -4001,8 +4013,10 @@ esxDomainMigrateFinish(virConnectPtr dconn, const char *dname,
> const char *cookie ATTRIBUTE_UNUSED,
> int cookielen ATTRIBUTE_UNUSED,
> const char *uri ATTRIBUTE_UNUSED,
> - unsigned long flags ATTRIBUTE_UNUSED)
> + unsigned long flags)
> {
> + virCheckFlags(0, NULL);
> +
> return esxDomainLookupByName(dconn, dname);
> }
Actually this is wrong. This was implemented before libvirt knew about
VIR_MIGRATE_PERSIST_DEST
VIR_MIGRATE_UNDEFINE_SOURCE
But an ESX migration has exactly the semantic implied by those two
flags. So actually those two flags have to be passed always. I should
have fixed that ages ago. Also if the domain is running ESX does a
live migration always, so VIR_MIGRATE_LIVE has to passed too. ESX
supports migration of inactive domains. It seems that migration in
libvirt is only meant for active domains, but this isn't documented
well.
--
Matthias Bolte
http://photron.blogspot.com
More information about the libvir-list
mailing list