[Kimchi-devel] [PATCH 6/7] Multiple pep8 fixes

Aline Manera alinefm at linux.vnet.ibm.com
Thu Apr 17 01:46:13 UTC 2014


On 04/13/2014 05:16 AM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Fix vmstorages.py and mockmodel.py to comply with pep8.

The code looks good just a comment

vmstorages.py is not listed in PEP8_WHITELIST - maybe you can add it 
there too


>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
>   src/kimchi/mockmodel.py        | 14 ++++++++------
>   src/kimchi/model/vmstorages.py | 13 ++++++++-----
>   2 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
> index 1ffbeb8..097d3dd 100644
> --- a/src/kimchi/mockmodel.py
> +++ b/src/kimchi/mockmodel.py
> @@ -652,8 +652,8 @@ class MockModel(object):
>           dom = self._get_vm(vm_name)
>           dev = params.get('dev', None)
>           if dev and dev in self.vmstorages_get_list(vm_name):
> -            return OperationFailed("KCHVMSTOR0004E", {'dev_name': dev,
> -                                                     'vm_name': vm_name})
> +            return OperationFailed(
> +                "KCHVMSTOR0004E", {'dev_name': dev, 'vm_name': vm_name})
>           if not dev:
>               index = len(dom.storagedevices.keys()) + 1
>               params['dev'] = "hd" + string.ascii_lowercase[index]
> @@ -669,15 +669,17 @@ class MockModel(object):
>       def vmstorage_lookup(self, vm_name, dev_name):
>           dom = self._get_vm(vm_name)
>           if dev_name not in self.vmstorages_get_list(vm_name):
> -            raise NotFoundError("KCHVMSTOR0007E", {'dev_name': dev_name,
> -                                                  'vm_name': vm_name})
> +            raise NotFoundError(
> +                "KCHVMSTOR0007E",
> +                {'dev_name': dev_name, 'vm_name': vm_name})
>           return dom.storagedevices.get(dev_name).info
>
>       def vmstorage_delete(self, vm_name, dev_name):
>           dom = self._get_vm(vm_name)
>           if dev_name not in self.vmstorages_get_list(vm_name):
> -            raise NotFoundError("KCHVMSTOR0007E", {'dev_name': dev_name,
> -                                                  'vm_name': vm_name})
> +            raise NotFoundError(
> +                "KCHVMSTOR0007E",
> +                {'dev_name': dev_name, 'vm_name': vm_name})
>           dom.storagedevices.pop(dev_name)
>
>       def vmstorage_update(self, vm_name, dev_name, params):
> diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
> index 4ef8ab0..54e0229 100644
> --- a/src/kimchi/model/vmstorages.py
> +++ b/src/kimchi/model/vmstorages.py
> @@ -137,7 +137,8 @@ class VMStoragesModel(object):
>                       valid_id.remove((bus_id, unit_id))
>                       continue
>           if not valid_id:
> -            raise OperationFailed('KCHVMSTOR0014E', {'type': 'ide', 'limit': 4})
> +            raise OperationFailed('KCHVMSTOR0014E',
> +                                  {'type': 'ide', 'limit': 4})
>           else:
>               address = {'controller': controller_id,
>                          'bus': valid_id[0][0], 'unit': valid_id[0][1]}
> @@ -152,8 +153,9 @@ class VMStoragesModel(object):
>           else:
>               devices = self.get_list(vm_name)
>               if dev_name in devices:
> -                raise OperationFailed('KCHVMSTOR0004E', {'dev_name': dev_name,
> -                                                        'vm_name': vm_name})
> +                raise OperationFailed(
> +                    'KCHVMSTOR0004E',
> +                    {'dev_name': dev_name, 'vm_name': vm_name})
>
>           # Path will never be blank due to API.json verification.
>           # There is no need to cover this case here.
> @@ -208,8 +210,9 @@ class VMStorageModel(object):
>           dom = VMModel.get_vm(vm_name, self.conn)
>           disk = _get_device_xml(dom, dev_name)
>           if disk is None:
> -            raise NotFoundError("KCHVMSTOR0007E", {'dev_name': dev_name,
> -                                                  'vm_name': vm_name})
> +            raise NotFoundError(
> +                "KCHVMSTOR0007E",
> +                {'dev_name': dev_name, 'vm_name': vm_name})
>           path = ""
>           dev_bus = 'ide'
>           try:




More information about the Kimchi-devel mailing list