Deleting the default zone?

There was a request to delete the the default zone and how it can’t be done currently because there are schedules for that zone.

While discussing this, the desired use case was not clear to me. Do users really want to delete the default zone? Perhaps what is really wanted is to be able to mark a different zone as the “default” zone and remove the original “default” zone.

Based on this link though, we’d need to move everything out of the default zone such as servers, ems’s, hosts, etc. and there’s many places we default to using the zone’s name “default” such as queries against the miq_queue table.

The “default” zone is seeded here during server startup if it doesn’t exist.

A suggestion was maybe we should only create/seed the default zone if there are NO Zone records in the database.


cc/ @jcarter @chessbyte

I think the end user is wanting to create zones based on names that represent their functionality or meaning ex. UI, VMDB, Rhev, Vmware etc.

If a end user could mark say the vmdb zone as their default zone and then remove the out of the box default zone that would satisfy their need or even simpler would be able to just edit the description of the default zone but maintain the name.

@jcarter I think the latter option, expose changing the description (Default Zone) of the “default” zone is far easier. There are many places that expect a zones table with row having name “default”. We do not care about the description in code though so I’d imagine it’s just a matter of exposing a way to change the description in the UI.

cc/ @dclarizio, I don’t believe anything actually looks for the phrase “Default Zone” anywhere as git grep didn’t reveal them. Thoughts?

The one caveat is that once you have appliances deployed, management systems detected, infrastructure components found, vm/instances located, etc. it is not an easy task to remove a zone as they have many components below them. Therefore, the big gotcha would be that if you want change which zone is default, you’d have to use the existing name: “default” row in the zones table and change it’s description. You cannot swap zones easily as you’d have to manually move all things below the zone into the right zone which I don’t be believe we make very easy.

@jcarter Would your latter option of editing the description of the default zone satisfy your requirements?

Default is only really there because we need at least one zone in the db. Once they add one of their own, I think technically we can allow it to be removed. However we do have the Zone.default_zone method which should be removed or renamed.

@fryguy Yeah, removing it has other issues mentioned above that while not impossible, are complicated enough to warrant asking what the real use case is and if a less intrusive solution would solve it.

@jcarter By the way, to determine if being able to edit the description of the zone would fulfill the use cases you are looking at, I suggest you edit the zones table directly to specify the description to what you want. You should then be able to navigate the UI and see if that does what you want.

@jrafanie I made the change in the table and everything looks correct. I would say this is all that needs to be done and at this time do see the need to change anything else.

@jcarter Your PR reminded me to look at this, I will comment on the PR. Thx, Dan