Unable to have two devices with same names but different domains

Bug #1881663 reported by Stéphane Graber
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Invalid
Wishlist
Unassigned

Bug Description

As part of scheduled roadmap work for this cycle, LXD is expanding our MAAS support and testing.

Part of this is adding support for LXD projects. We hit a bit of a problem when testing two instances with the same name but in different projects. LXD handles this at a DNS level by using <name>.<project>.

After fighting with gomaasapi for a bit (https://github.com/juju/gomaasapi/pull/86) we got domain handling plugged into LXD such that I can have:

 - c1 (default project) => c1.maas.mtl.stgraber.net
 - c1 (foo project) => c1.foo.maas.mtl.stgraber.net

That's when we hit a MAAS problem. It's currently impossible for two devices to have the same name even when they're not on the same domain.

In this case, we've got:

POST /MAAS/api/2.0/devices/

 => domain=maas.mtl.stgraber.net&hostname=vm01-c3&mac_addresses=00%3A16%3A3e%3Abc%3A48%3Af0&parent=4y3h86
 => 400 Bad Request, "Node with this Hostname already exists."

In this case, that is because "vm01-c3.foo.maas.mtl.stgraber.net" exists, which is in a completely different domain from "maas.mtl.stgraber.net".

For good measure I also tried using "vm01-c3" in the "foo" project (foo.maas.mtl.stgraber.net domain) while I had an existing "vm01-c3" in the "bar" project (bar.maas.mtl.stgraber.net domain) with the same result.

I can see how this may make sense at the machine level but it's rather problematic when enforced across all devices on those machines too.

Revision history for this message
Lee Trager (ltrager) wrote :

When MAAS was created the decision was made that hostnames must be unique across MAAS[1]. The reason for this is that a user can easily move a machine from one domain to another which may result in duplicates.

Leaving this open as a feature request as we may want to reevaluate this decision.

[1] https://git.launchpad.net/maas/tree/src/maasserver/models/node.py#n942

Changed in maas:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Stéphane Graber (stgraber) wrote :

As mentioned on IRC, this may be reasonable for machines, if only to keep a somewhat readable UI.

For devices it's a lot less likely to be relevant as users can't quite as easily move those between domains but given that each machine may have a large set of devices, having more flexibility for them would be good.

Revision history for this message
Björn Tillenius (bjornt) wrote :

I don't think it make much sense to have hostnames be globally unique. Sure, users may easily move nodes between domains, but we can easily enforce the constraint there, the same way we enforce it when a node is renamed.

That said, It'd probably be quite a lot of work, since I suspect a lot of the code base (and UX) assumes hostnames are unique even across domains.

Revision history for this message
Jerzy Husakowski (jhusakowski) wrote :

Internal: added PF-3150 to MAAS feature backlog

Changed in maas:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.