[libvirt] [PATCH v2 3/3] memtune: change the way how we store unlimited value

Peter Krempa pkrempa at redhat.com
Fri Mar 6 10:28:15 UTC 2015


On Thu, Mar 05, 2015 at 16:10:30 +0100, Pavel Hrdina wrote:
> There was a mess in the way how we store unlimited value for memory
> limits and how we handled values provided by user.  Internally there
> were two possible ways how to store unlimited value: as 0 value or as
> VIR_DOMAIN_MEMORY_PARAM_UNLIMITED.  Because we chose to store memory
> limits as unsigned long long, we cannot use -1 to represent unlimited.
> It's much easier for us to say that everything greater than
> VIR_DOMAIN_MEMORY_PARAM_UNLIMITED means unlimited and leave 0 as valid
> value despite that it makes no sense to set limit to 0.
> 
> Remove unnecessary function virCompareLimitUlong.  The update of test
> is to prevent the 0 to be miss-used as unlimited in future.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146539
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  docs/formatdomain.html.in                          |  4 +-
>  src/conf/domain_conf.c                             | 75 +++++++++++++++++-----
>  src/libvirt-domain.c                               |  3 +
>  src/libvirt_private.syms                           |  1 -
>  src/lxc/lxc_cgroup.c                               | 18 +++---
>  src/lxc/lxc_driver.c                               |  7 +-
>  src/lxc/lxc_fuse.c                                 | 12 ++--
>  src/lxc/lxc_native.c                               |  6 +-
>  src/openvz/openvz_conf.c                           |  4 +-
>  src/openvz/openvz_driver.c                         |  4 +-
>  src/qemu/qemu_cgroup.c                             | 24 +++----
>  src/qemu/qemu_command.c                            |  8 ++-
>  src/qemu/qemu_driver.c                             | 10 +--
>  src/qemu/qemu_hotplug.c                            |  2 +-
>  src/qemu/qemu_migration.c                          |  5 +-
>  src/util/virutil.c                                 | 23 -------
>  src/util/virutil.h                                 |  2 -
>  tests/qemuxml2argvdata/qemuxml2argv-memtune.xml    |  2 +-
>  .../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml  |  2 +-
>  19 files changed, 118 insertions(+), 94 deletions(-)
>

...

> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 20e40aa..782c13c 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2986,7 +2986,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
>                                         QEMU_MIGRATION_COOKIE_NBD)))
>          goto cleanup;
>  
> -    if (STREQ_NULLABLE(protocol, "rdma") && !vm->def->mem.hard_limit) {
> +    if (STREQ_NULLABLE(protocol, "rdma") &&
> +        virMemoryLimitIsSet(vm->def->mem.hard_limit)) {

You negated the condition above when adding the helper ...

>          virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>                         _("cannot start RDMA migration with no memory hard "
>                           "limit set"));
> @@ -4102,7 +4103,7 @@ static int doNativeMigrate(virQEMUDriverPtr driver,
>                               "with this QEMU binary"));
>              goto cleanup;
>          }
> -        if (!vm->def->mem.hard_limit) {
> +        if (virMemoryLimitIsSet(vm->def->mem.hard_limit)) {

... here too.

>              virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>                             _("cannot start RDMA migration with no memory hard "
>                               "limit set"));

ACK if you fix the two conditions above.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150306/df4a51b8/attachment-0001.sig>


More information about the libvir-list mailing list