[libvirt] [PATCH] qemu: Sort the numa params only when it requires to affect the live config

As the next boot doesn't have to worry about the previous numa params setting (there is no). --- src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 955744a..bc7de9f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7204,32 +7204,34 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; } - /* Get current swap hard limit */ - rc = virCgroupGetMemSwapHardLimit(group, &val); - if (rc != 0) { - virReportSystemError(-rc, "%s", - _("unable to get swap hard limit")); - goto cleanup; - } + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + /* Get current swap hard limit */ + rc = virCgroupGetMemSwapHardLimit(group, &val); + if (rc != 0) { + virReportSystemError(-rc, "%s", + _("unable to get swap hard limit")); + goto cleanup; + } - /* Swap hard_limit and swap_hard_limit to ensure the setting - * could succeed if both of them are provided. - */ - if (swap_hard_limit && hard_limit) { - virTypedParameter param; - - if (swap_hard_limit->value.ul > val) { - if (hard_limit_index < swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } - } else { - if (hard_limit_index > swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } + /* Swap hard_limit and swap_hard_limit to ensure the setting + * could succeed if both of them are provided. + */ + if (swap_hard_limit && hard_limit) { + virTypedParameter param; + + if (swap_hard_limit->value.ul > val) { + if (hard_limit_index < swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } else { + if (hard_limit_index > swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } } } -- 1.7.7.3

What about renaming to "qemu: Sort the numa params only when it affects the live config" instead ? On Thu, Aug 30, 2012 at 12:37:58AM +0800, Osier Yang wrote:
As the next boot doesn't have to worry about the previous numa params setting (there is no).
"there is no" ??? i assume you mean it not carried over reboots of the guest, right ?
--- src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 955744a..bc7de9f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7204,32 +7204,34 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; }
- /* Get current swap hard limit */ - rc = virCgroupGetMemSwapHardLimit(group, &val); - if (rc != 0) { - virReportSystemError(-rc, "%s", - _("unable to get swap hard limit")); - goto cleanup; - } + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + /* Get current swap hard limit */ + rc = virCgroupGetMemSwapHardLimit(group, &val); + if (rc != 0) { + virReportSystemError(-rc, "%s", + _("unable to get swap hard limit")); + goto cleanup; + }
- /* Swap hard_limit and swap_hard_limit to ensure the setting - * could succeed if both of them are provided. - */ - if (swap_hard_limit && hard_limit) { - virTypedParameter param; - - if (swap_hard_limit->value.ul > val) { - if (hard_limit_index < swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } - } else { - if (hard_limit_index > swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } + /* Swap hard_limit and swap_hard_limit to ensure the setting + * could succeed if both of them are provided. + */ + if (swap_hard_limit && hard_limit) { + virTypedParameter param; + + if (swap_hard_limit->value.ul > val) { + if (hard_limit_index < swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } else { + if (hard_limit_index > swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } } }
Okay, I think I understand the patch, ACK, please push now for 0.10.1 :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 2012年08月30日 11:22, Daniel Veillard wrote:
What about renaming to "qemu: Sort the numa params only when it affects the live config" instead ?
Better. :-)
On Thu, Aug 30, 2012 at 12:37:58AM +0800, Osier Yang wrote:
As the next boot doesn't have to worry about the previous numa params setting (there is no).
"there is no" ??? i assume you mean it not carried over reboots of the guest, right ?
--- src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 955744a..bc7de9f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7204,32 +7204,34 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; }
- /* Get current swap hard limit */ - rc = virCgroupGetMemSwapHardLimit(group,&val); - if (rc != 0) { - virReportSystemError(-rc, "%s", - _("unable to get swap hard limit")); - goto cleanup; - } + if (flags& VIR_DOMAIN_AFFECT_LIVE) { + /* Get current swap hard limit */ + rc = virCgroupGetMemSwapHardLimit(group,&val); + if (rc != 0) { + virReportSystemError(-rc, "%s", + _("unable to get swap hard limit")); + goto cleanup; + }
- /* Swap hard_limit and swap_hard_limit to ensure the setting - * could succeed if both of them are provided. - */ - if (swap_hard_limit&& hard_limit) { - virTypedParameter param; - - if (swap_hard_limit->value.ul> val) { - if (hard_limit_index< swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } - } else { - if (hard_limit_index> swap_hard_limit_index) { - param = params[hard_limit_index]; - params[hard_limit_index] = params[swap_hard_limit_index]; - params[swap_hard_limit_index] = param; - } + /* Swap hard_limit and swap_hard_limit to ensure the setting + * could succeed if both of them are provided. + */ + if (swap_hard_limit&& hard_limit) { + virTypedParameter param; + + if (swap_hard_limit->value.ul> val) { + if (hard_limit_index< swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } else { + if (hard_limit_index> swap_hard_limit_index) { + param = params[hard_limit_index]; + params[hard_limit_index] = params[swap_hard_limit_index]; + params[swap_hard_limit_index] = param; + } + } } }
Okay, I think I understand the patch, ACK, please push now for 0.10.1 :-)
Daniel
Pushed with the subject changed. Thanks! Regards, Osier

On 2012年08月30日 11:22, Daniel Veillard wrote:
What about renaming to "qemu: Sort the numa params only when it affects the live config" instead ?
On Thu, Aug 30, 2012 at 12:37:58AM +0800, Osier Yang wrote:
As the next boot doesn't have to worry about the previous numa params setting (there is no).
"there is no" ??? i assume you mean it not carried over reboots of the guest, right ?
Missed this, and yes, :-) Osier
participants (2)
-
Daniel Veillard
-
Osier Yang