On Wed, Jan 8, 2014 at 5:42 PM, Klaus Aehlig <[email protected]> wrote:
> On Wed, Jan 08, 2014 at 03:34:49PM +0000, Michele Tartara wrote:
>> Commit e6e4ff4cf8d0100f331f94f7a27aa1e03a5d0e7d fixed Issue 649 by switching
>> the
>> separator for usb_devices from comma to whitespace. That solved the problem
>> with
>> the command line, but RAPI was able to work with commas too, so, for
>> backwards
>> compatibility we need to keep supporting that as well.
>>
>> Also, in order to avoid changing the format of the config file, the default
>> internal representation is brought back to being comma-based, and it is
>> changed
>> at the interface level (CLI or RAPI) before being passed on.
>>
>> Signed-off-by: Michele Tartara <[email protected]>
>
>> +def FixHvParams(hvparams):
>> + # In Ganeti 2.8.4 the separator for the usb_devices hvparam was changed
>> from
>> + # comma to whitespace because commas cannot be accepted on the command
>> line
>> + # (they already act as the separator between different hvparams). Still,
>> + # RAPI should be able to accept commas for backwards compatibility.
>> + # Therefore, we convert whitespaces into commas here, and we keep the old
>
> "whitespace" or just "spaces"; the implementation does the latter (which, in
> my opinion, also makes more sense to just replace spaces, not, e.g., tabs).
Good point. Thanks, I'll fix before pushing.
>
>> + # parsing logic everywhere else.
>> + try:
>> + new_usb_devices = hvparams[constants.HV_USB_DEVICES].replace(" ", ",")
>> + hvparams[constants.HV_USB_DEVICES] = new_usb_devices
>> + except KeyError:
>> + #No usb_devices, no modification required
>> + pass
>
>
>> if hvp[constants.HV_KVM_EXTRA]:
>> diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
>> index 9b3dbaa..fdce075 100644
>> --- a/lib/rapi/rlib2.py
>> +++ b/lib/rapi/rlib2.py
>> @@ -885,6 +885,27 @@ class
>> R_2_groups_name_assign_nodes(baserlib.OpcodeResource):
>> })
>>
>>
>> +def _ConvertUsbDevices(data):
>> + """Convert in place the usb_devices string to the proper format.
>> +
>> + In Ganeti 2.8.4 the separator for the usb_devices hvparam was changed from
>> + comma to whitespace because commas cannot be accepted on the command line
>> + (they already act as the separator between different hvparams). RAPI
>> + should be able to accept commas for backwards compatibility, but we want
>> + it to also accept the new whitespace separator. Therefore, we convert
>
> dito
>
>> + whitespaces into commas here and keep the old parsing logic elsewhere.
>> +
>> + """
>
> Rest LGTM. No need to resend.
>
> --
> Klaus Aehlig
> Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores
--
Google Germany GmbH
Dienerstr. 12
80331 München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores