xen-orchestra
xen-orchestra copied to clipboard
Editing tags on multiple objects
May be extended to other properties, but I think we should focus on tags first.
We need to figure out how to present this in the UI…
Any progress or future thoughts on this? With the recent "Advanced tags" (key=value), we're planning on retagging a bunch of VMs (e.g. VMs tagged "prod" would become "env=prod"), but doing that by hand will become quite exhausting after a short while.
@pdonias I don't remember, do we have a planned component to do this in XO Lite or XO 6?
Not for tags specifically. But for XO 6, we'll try to focus on bulk edition for almost anything. Tags might be more challenging though, since it's a list of values and not a single value, so we'll discuss how it could be implemented.
Alright :)
If anyone else is looking to do this themselves before this is implemented, I found a solution using xo-cli:
xo-cli xo.getAllObjects \
| jq '[ .[] | select(.type == "VM") ]' \
| jq -r '.[] | select(.tags[] | match("^prod$")) | .uuid' \
| uniq \
| xargs -i{} bash -c 'xo-cli tag.add id={} tag="env=prod"; xo-cli tag.remove id={} tag=prod'
It may not be optimal, but it works for now at least.