salt-formulas / salt-formula-maas

Salt Formula Ubuntu MaaS
Other
6 stars 16 forks source link

disk_partition_present state in maasng.py can't handle partiton that is part of RAID #28

Open epcim opened 6 years ago

epcim commented 6 years ago
----------
          ID: maas_machine_kvm01_sdd
    Function: maasng.disk_partition_present
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1735, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1653, in wrapper
                  return f(*args, **kwargs)
                File "/var/cache/salt/minion/extmods/states/maasng.py", line 176, in disk_partition_present
                  ret["changes"] = __salt__['maasng.delete_partition_by_id'](hostname, disk, partition["id"])
                File "/var/cache/salt/minion/extmods/modules/maasng.py", line 433, in delete_partition_by_id
                  maas.delete(u"api/2.0/nodes/{0}/blockdevices/{1}/partition/{2}".format(system_id, device_id, partition_id)).read()
                File "/var/cache/salt/minion/extmods/modules/maas_client.py", line 245, in delete
                  url, method="DELETE", headers=headers, data=body)
                File "/var/cache/salt/minion/extmods/modules/maas_client.py", line 113, in dispatch_query
                  res = urllib2.urlopen(req)
                File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
                  return opener.open(url, data, timeout)
                File "/usr/lib/python2.7/urllib2.py", line 435, in open
                  response = meth(req, response)
                File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
                  'http', request, response, code, msg, hdrs)
                File "/usr/lib/python2.7/urllib2.py", line 473, in error
                  return self._call_chain(*args)
                File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
                  result = func(*args)
                File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
                  raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
              HTTPError: HTTP Error 400: BAD REQUEST
     Started: 18:31:15.036354
    Duration: 10147.6 ms
     Changes:   
    Warnings: 'name' is an invalid keyword argument for
              'maasng.disk_partition_present'. If you were trying to pass
              additional data to be used in a template context, please populate
              'context' with 'key: value' pairs. Your approach will work until
              Salt Oxygen is out. Please update your state files.
----------

Actually fails, because of:

Cannot delete partition because its part of a RAID

May 16 18:31:25 cfg01 sh[31024]: 2018-05-16 18:31:25 maasserver: [error] ################################ Exception: ['Cannot delete partition because its part of a RAID.'] ################################
May 16 18:31:25 cfg01 sh[31024]: 2018-05-16 18:31:25 maasserver: [error] Traceback (most recent call last):
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 132, in get_response
May 16 18:31:25 cfg01 sh[31024]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 185, in view_atomic_with_post_commit_savepoint
May 16 18:31:25 cfg01 sh[31024]:     return view_atomic(*args, **kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3.5/contextlib.py", line 30, in inner
May 16 18:31:25 cfg01 sh[31024]:     return func(*args, **kwds)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/maasserver/api/support.py", line 59, in __call__
May 16 18:31:25 cfg01 sh[31024]:     response = upcall(request, *args, **kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/django/views/decorators/vary.py", line 21, in inner_func
May 16 18:31:25 cfg01 sh[31024]:     response = func(*args, **kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/piston3/resource.py", line 190, in __call__
May 16 18:31:25 cfg01 sh[31024]:     result = self.error_handler(e, request, meth, em_format)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/piston3/resource.py", line 188, in __call__
May 16 18:31:25 cfg01 sh[31024]:     result = meth(request, *args, **kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/maasserver/api/support.py", line 298, in dispatch
May 16 18:31:25 cfg01 sh[31024]:     return function(self, request, *args, **kwargs)
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/maasserver/api/partitions.py", line 196, in delete
May 16 18:31:25 cfg01 sh[31024]:     partition.delete()
May 16 18:31:25 cfg01 sh[31024]:   File "/usr/lib/python3/dist-packages/maasserver/models/partition.py", line 299, in delete
May 16 18:31:25 cfg01 sh[31024]:     "a %s." % filesystem_group.get_nice_name())
May 16 18:31:25 cfg01 sh[31024]: django.core.exceptions.ValidationError: ['Cannot delete partition because its part of a RAID.']
May 16 18:31:25 cfg01 sh[31024]: 2018-05-16 18:31:25 regiond: [info] 127.0.0.1 DELETE /MAAS/api/2.0/nodes/4qacnk/blockdevices/24/partition/22 HTTP/1.1 --> 400 BAD_REQUEST (referrer: -; agent: Python-urllib/2.7)
May 16 18:31:29 cfg01 sh[31024]: 2018-05-16 18:31:29 regiond: [info] 127.0.0.1 GET /MAAS/rpc/ HTTP/1.0 --> 200 OK (referrer: -; agent: provisioningserver.rpc.clusterservice.ClusterClientService)