[libvirt] [PATCH 1/2 v2] node_memory: Do not fail if there is parameter unsupported
Osier Yang
jyang at redhat.com
Thu Nov 29 07:35:23 UTC 2012
On 2012年11月29日 07:49, Eric Blake wrote:
>> It makes no sense to fail the whole getting command if there is
>> parameter unsupported by the kernel. This patch fixes it by
>
> s/parameter/a parameter/
>
>> omitting the unsupported parameter for getMemoryParameters.
>>
>> And For setMemoryParameters, this checks if there is unsupported
>
> s/For/for/
> s/is/is an/
>
>> parameter up front of the setting, and just returns failure if not
>> all parameters are supported.
>>
>
>> - * filled with parameter information, which might be less but will
>> - * not exceed the input value.
>> + * Get all node memory parameters (parameter unsupported by OS will
>> be
>
> s/parameter/parameters/
>
>> #ifdef __linux__
>> static int
>> -nodeSetMemoryParameterValue(const char *field,
>> - virTypedParameterPtr param)
>> +nodeSetMemoryParameterValue(virTypedParameterPtr param)
>> {
>> char *path = NULL;
>> char *strval = NULL;
>> int ret = -1;
>> int rc = -1;
>>
>> + char *field = strchr(param->field, '_');
>> + field++;
>
> This site should be safe (we only get here if we got past earlier
> filters), but...
>
>> +static bool
>> +nodeMemoryParametersIsAllSupported(virTypedParameterPtr params,
>> + int nparams)
>> +{
>> + char *path = NULL;
>> + int i;
>> +
>> + for (i = 0; i< nparams; i++) {
>> + virTypedParameterPtr param =¶ms[i];
>> +
>> + char *field = strchr(param->field, '_');
>> + field++;
>
> Are we guaranteed that field is non-NULL,
Yeah, it's guaranteed by virTypedParameterArrayValidate, any param
that not in the set VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN,
VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS, and
VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES will be detected,
and all of these 3 params contains "_".
Thanks the reviewing, I pushed it with the typos fixed.
Regards,
Osier
More information about the libvir-list
mailing list