Jump to content
Welcome to our new Citrix community!
  • 0

"xe vm-list", possible to filter by TAG?


Gavin Metcalfe

Question

We have added custom tags to some of our servers in XenCenter and I am wondering if it is possible to filter vm-list by these tags.

Basically what I want to do is for my backup script to only backup machines with a certain tag, so some of my VMs have been given a tag called "Backup". I've looked through the output from "xm vm-list params=all" but can't see anything obvious that would let me do this.

Is it possible to do what I am trying to do?

Gav

Link to comment

4 answers to this question

Recommended Posts

  • 0

I recently had exactly the same requirement, and on the face of it this seemed like a simple task.

The only place I could find the VM tag was part of the map set of the last-boot-record* parameter from the *vm-param-get command, called *tags*. This information can only be derived using the VM uuid, so while it can be scripted, it it not as straightforward as it should be!!

I have raised this question internally to see if there is a more simple answer, I will post back if I get a better solution.

Link to comment
  • 0

I have been told that this is not easily possible via the CLI, so your only recourse right now is to try and manipulate the last-boot-record map data.

You could add additional text to the name-description field for each VM, and search for this text on a per VM basis, but to be honest it's probably just as easy to use the above.

Link to comment
  • 0
On 5/25/2020 at 11:58 PM, Jacob Degeling said:

So that means you can do:


xe vm-suspend tags:contains="tag" --multiple
xe vm-resume tags:contains="tag" --multiple

Which is cool.


Yes! Very cool.

Now we're missing  the inverse "tags:not-contains".
It would help with consistency, instead of having to tag all VMs with either "tag1" and "not_tag1". I fear forgetting to tag some VMs.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...