maas returning error 500 when querying raid by name not id
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
Undecided
|
Unassigned |
Bug Description
MAAS version: 2.3.3
Issue:
Querying node raid by name does not work in MAAS. The command should return either 404 (there is no id md0, it's a name) or return the data in the same way as when querying by database id.
According to MAAS CLI help:
ubuntu@infra1:~$ maas root raid read -h
usage: maas root raid read [--help] [-d] [-k] system_id id [data [data ...]]
Read RAID device on a machine.
Positional arguments:
system_id
id
Returns 404 if the machine or RAID is not found.
Common command-line options:
--help, -h
Show this help message and exit.
-d, --debug
Display more information about API responses.
-k, --insecure
Disable SSL certificate check
This command works correctly when querying the MAAS for raid using the database ID of the raid (321 in the example below):
ubuntu@infra1:~$ maas root raid read bypknn 321
Success.
Machine-readable output follows:
{
"size": 1996488704,
"system_id": "bypknn",
"devices": [
{
"size": 1996488704,
"uuid": "7f1eacad-
"id": 1850,
"type": "partition",
"path": "/dev/disk/
}
},
{
"size": 1996488704,
"uuid": "b31b808c-
"id": 1851,
"type": "partition",
"path": "/dev/disk/
}
}
],
"virtual_
"size": 1996488704,
"tags": [],
"path": "/dev/disk/
"used_for": "ext4 formatted filesystem mounted at /boot",
"serial": null,
"id_path": null,
"name": "md0",
"uuid": "7688584d-
"id": 3539,
"type": "virtual",
"uuid": "d1fa733a-
},
"model": null
},
"spare_
"id": 321,
"uuid": "10ceec5b-
"name": "md0",
"human_size": "2.0 GB",
"resource_uri": "/MAAS/
"level": "raid-1"
}
The command fails with 500 (system internal error) when querying using the raid name (md0 in this example):
ubuntu@infra1:~$ maas root raid read bypknn md0 -d
500 INTERNAL SERVER ERROR
Transfer-
X-Frame-
get() returned more than one RAID -- it returned 41!
The exception thrown:
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: 2018-06-12 16:43:40 maasserver: [error] #######
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: 2018-06-12 16:43:40 maasserver: [error] Traceback (most recent call last):
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: response = wrapped_
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: return view_atomic(*args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: return func(*args, **kwds)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: response = upcall(request, *args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: response = func(*args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: result = self.error_
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: result = meth(request, *args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: return function(self, request, *args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: system_id, id, request.user, NODE_PERMISSION
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: filesystem_group = get_object_
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: return queryset.get(*args, **kwargs)
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: File "/usr/lib/
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: (self.model.
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: maasserver.
Jun 12 16:43:40 ic-skbrat2-infra1 sh[3708]: 2018-06-12 16:43:40 regiond: [info] 100.80.0.1 GET /MAAS/api/
Note 41 is a cound of md0 devices on all nodes in MAAS. Looks like the querying by name is only partially implemented or there is some filtering issue.
MAAS version:
ubuntu@
Desired=
| Status=
|/ Err?=(none)
||/ Name Version Architecture Description
+++-===
un maas <none> <none> (no description available)
ii maas-cli 2.3.3-6498-
un maas-cluster-
ii maas-common 2.3.3-6498-
ii maas-dhcp 2.3.3-6498-
ii maas-dns 2.3.3-6498-
ii maas-proxy 2.3.3-6498-
ii maas-rack-
ii maas-region-api 2.3.3-6498-
ii maas-region-
un maas-region-
un python-django-maas <none> <none> (no description available)
un python-maas-client <none> <none> (no description available)
un python-
ii python3-django-maas 2.3.3-6498-
ii python3-maas-client 2.3.3-6498-
ii python3-
Changed in maas: | |
status: | New → Invalid |
I think using raid name is the way. 0ubuntu1~ 16.04.1" , "capabilities": ["networks- management" , "static- ipaddresses" , "ipv6-deploymen t-ubuntu" , "devices- management" , "storage- deployment- ubuntu" , "network- deployment- ubuntu" , "bridging- interface- ubuntu" , "bridging- automatic- ubuntu" , "authenticate- api"]}
This is the case for 2.2.0 maas version as well:
$ maas maas version read
Success.
Machine-readable output follows:
{"version": "2.2.0", "subversion": "bzr6054-
$ maas maas raid read gaey8h md0
get() returned more than one RAID -- it returned 49!
$ maas maas raid read gaey8h 7 api/2.0/ nodes/gaey8h/ raid/7/ ", device" : {
"block_ size": 512,
"filesystem" : {
"label" : "",
"mount_ point": "/",
"fstype" : "ext4",
Success.
Machine-readable output follows:
{
"id": 7,
"resource_uri": "/MAAS/
"human_size": "51.2 GB",
"system_id": "gaey8h",
"size": 51170508800,
"virtual_
"id": 15,
...