Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling DHCP on tagged vlan causes primary rack selection error #259

Open
artscout opened this issue Apr 12, 2021 · 1 comment
Open

Enabling DHCP on tagged vlan causes primary rack selection error #259

artscout opened this issue Apr 12, 2021 · 1 comment
Labels

Comments

@artscout
Copy link

artscout commented Apr 12, 2021

  We're using this code for adding vlan and subnet to maas (it's already enabled on maas machine interfaces)
    prefix = "192.168.130.0/24"
    ip_network = ipaddress.ip_network(prefix, strict = False)
    vlan = "2001"
    maas_vlan = fabric.vlans.create(vlan)
    maas_subnet = self.client.subnets.create(prefix, maas_vlan, gateway_ip = str(ip_network[-2]))
    half = ip_network.num_addresses / 2                                                       
    range_start = str(ip_network[int(half)])                                                  
    range_end = str(ip_network[-6])                                                           
    new_range = self.client.ip_ranges.create(range_start, range_end, type=IPRangeType.DYNAMIC)
    range_vlan = maas_subnet.vlan                                                             
    rack = self.client.rack_controllers.list()[0]
    range_vlan.primary_rack = rack
    range_vlan.dhcp_on = True
    range_vlan.save()

Execution of this code returns this:

  File "/var/app/maasclient.py", line 549, in update_network
    range_vlan.save()
  File "/usr/local/lib/pyenv/versions/3.9.1/lib/python3.9/site-packages/maas/client/utils/maas_async.py", line 43, in wrapper
    result = eventloop.run_until_complete(result)
  File "/usr/local/lib/pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/pyenv/versions/3.9.1/lib/python3.9/site-packages/maas/client/viscera/vlans.py", line 118, in save
    data = await self._handler.update(**update_data)
  File "/usr/local/lib/pyenv/versions/3.9.1/lib/python3.9/site-packages/maas/client/bones/__init__.py", line 307, in __call__
    response = await self.bind(**params).call(**data)
  File "/usr/local/lib/pyenv/versions/3.9.1/lib/python3.9/site-packages/maas/client/bones/__init__.py", line 478, in dispatch
    raise CallError(request, response, content, self)
maas.client.bones.CallError: PUT http://localhost:5240/MAAS/api/2.0/fabrics/1/vlans/1105/ -> HTTP 400 Bad Request ({"primary_rack": ["Select a valid choice. yfkq88 …)

yfkq88 is valid rack controller ID BTW, it's the only rack controller in whole setup.

Any ideas?

Copy link

github-actions bot commented Feb 2, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant