xen-orchestra icon indicating copy to clipboard operation
xen-orchestra copied to clipboard

Editing tags on multiple objects

Open julien-f opened this issue 7 years ago • 4 comments

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…

julien-f avatar May 06 '18 14:05 julien-f

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.

theS1LV3R avatar Apr 08 '24 12:04 theS1LV3R

@pdonias I don't remember, do we have a planned component to do this in XO Lite or XO 6?

olivierlambert avatar Apr 08 '24 12:04 olivierlambert

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.

pdonias avatar Apr 08 '24 14:04 pdonias

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.

theS1LV3R avatar Apr 08 '24 14:04 theS1LV3R