Skip to content
TQL 5.22 KiB
Newer Older
Seblu's avatar
Seblu committed
==================
Seblu's avatar
Seblu committed
Tag Query Languag
Seblu's avatar
Seblu committed
==================
== by examples ==
Seblu's avatar
Seblu committed
seblu> list id                  #list all ids, same as list
seblu> list a                   #list all accounts
seblu> list h:fw*               #list all hostname starting by fw
seblu> list r=hv                #list all hypervisor
seblu> list r=vm                #list all vm
seblu> list hv=toto             #list vm of hypervisor toto
seblu> list hv=toto&h=chiche    #list vm chiche of hypervisor toto
seblu> list r=vm&cpu=2          #list vm with 2 cpu
seblu> list r=vm&cpu=2&mem>10g  #list vm with 2 cpu and mem > 10g
seblu> list r=hv&cpu=2&mem>10g  #list hypervisor with no vm
seblu> list cpu>=2$pop$alloc    #list object with at least 2cpu and show tags pop and alloc
seblu> list r=vm^10             #list first 10 vm
seblu> list r=vm^:10            #list last 10 vm
seblu> list r=vm^5:10           #list vm
seblu> list r=vm%vm             #list vm sorted by vm
seblu> list r=vm%vm%cpu         #list vm sorted by vm and cpu
seblu> list r=vm&-cpu           #list vm without tag cpu
seblu> list a-con               #list disconnected account
Seblu's avatar
Seblu committed

== Basics ==
Seblu's avatar
Seblu committed
- TQL build a list of objects in one query
- An object is a list of tags
- TQL can select and sort object by tags
- TQL can choose tags in object
- TQL can limit number of objects to select
- TQL is a list statement mixed by separators
- TQL build his object list from left to right (left parenthesis)
- Each statement update the builded list regarding his separators
Seblu's avatar
Seblu committed
- Selecting, sorting and showing separators are followed by tags
Seblu's avatar
Seblu committed
- Limiting separators are followed by limiting conditions
- TQL always return id tag
- By default separators is &
- By default object list is sorted id

== Tags ==
- Every tag is composed by a tagname and a tagvalue
- Tagname are case insensitive, tagvalue is case sensitive
- You can use globin on tagname
- tagname starting by - means all tag except this one
- Operators machtes on tagvalues

== statement separators ==
& selection intersection
| selection union
/ selection complement
Seblu's avatar
Seblu committed
^ selection limit
Seblu's avatar
Seblu committed
$ tag showing
Seblu's avatar
Seblu committed
% tag sorting

== tags operators ==
Seblu's avatar
Seblu committed
= strict equality
Seblu's avatar
Seblu committed
: globing matching (no case)
Seblu's avatar
Seblu committed
~ regex matching
> superior strict
>= superior
< inferior
<= inferior strict
Seblu's avatar
Seblu committed
Each previous operators can be negated by adding ! before it.

== limiting conditions ==
n limit to n first objects
:n limit to last n objects
n:m limit from n to m objects
Seblu's avatar
Seblu committed

== number facility ==
10k = 1000
10ki = 1024
1m = 1000 ^ 2
1mi = 1024 ^ 2
1g = 1000 ^ 3
1gi = 1024 ^ 3

Seblu's avatar
Seblu committed
== reserverd tags ==
Reserved tags are tags with a special meaning and cannot be set or remove
directly by clients

Seblu's avatar
Seblu committed
id: object unique identifier (eg: kvmlab-1.test5)
Seblu's avatar
Seblu committed
a: account name (eg: bobby)
Seblu's avatar
Seblu committed
r: account role (host/hv/vm/cli/web/spv)
Seblu's avatar
Seblu committed
closed: account close status
con: connection uptime in seconds (eg: 3600)
lastcon: last connection date (timestamp)
lastdcon: last disconnection date (timestamp)
Seblu's avatar
Seblu committed
ip: ipv4 of connection
hv: hypervisor id (eg: kvmlab-1)
Seblu's avatar
Seblu committed

== well known tags ==
h: hostname (eg: access)
Seblu's avatar
Seblu committed
htype: hypervisor type (xen/kvm)
Seblu's avatar
Seblu committed
libvirtver: Libvirt version
Seblu's avatar
Seblu committed
status: VM status (running/paused/stopped)
Seblu's avatar
Seblu committed
cpu: cpu count
Antoine Millet's avatar
Antoine Millet committed
cpualloc: allocated cpu count
cpuremaining: remaining CPU available for allocation
cpuallocratio: ratio between allocated CPU and total CPU
Seblu's avatar
Seblu committed
mem: memory total size
Seblu's avatar
Seblu committed
memused: memory used
memfree: memory free
Antoine Millet's avatar
Antoine Millet committed
memremaining: remaining memory available for allocation
memallocratio: ratio between allocated memory and total memory
Seblu's avatar
Seblu committed
arch: hardware architecture (x86/x64)
uname: output of uname command
Seblu's avatar
Seblu committed
uptime: uptime of hostname
load: load average
Seblu's avatar
Seblu committed
os: operating system (linux/windows)
Seblu's avatar
Seblu committed
alloc: host is allowed to be selected to a migration
Seblu's avatar
Seblu committed
hvm: hardware virtualisation enabled
Seblu's avatar
Seblu committed
nvm: vm count on an hypervisor
Seblu's avatar
Seblu committed
vmstarted: started vm count on an hypervisor
vmstopped: stopped vm count on an hypervisor
vmpaused: paused vm count on an hypervisor
version: account reported version
Seblu's avatar
Seblu committed
sto: storage pool names (eg: vg fg)
stovg_type: vg storage pool type (eg: lvm)
stovg_size: vg storage pool size (eg: 1042)
stovg_used: vg storage pool used space (eg: 1)
stovg_free: vg storage pool free space (eg: 1041)
stovg_path: vg storage pool path (eg: /dev/vg/)
stovg_vol: vg storage pool volume list (eg: sex titi toto)
Antoine Millet's avatar
Antoine Millet committed
stovg_ratio: ratio between allocated storage size and total storage size
Seblu's avatar
Seblu committed
disk: disk index list (eg: 1 2 3 4)
disk1_path: disk 1 path (eg: /dev/vg/sex)
disk1_size: disk 1 size (eg: 1024)
disk1_pool: storage pool back reference (eg: vg) [vmonly]
Seblu's avatar
Seblu committed
disk1_vol: storage pool volume back reference (eg: titi) [vmonly]
Seblu's avatar
Seblu committed
vncport: vnc local port (eg: 5001)
hvver: hypervisor version (eg: 0.14)
hserial: host serial number (eg: Dell service tag)
hvendor: host vendor (eg: Dell Computer Corporation)
hmodel: host model (eg: PowerEdge 2850)
hbios: host bios version and/or date (eg: A05 (01/09/2006))
cputhread: total number of cpu thread
cpufreq: cpu core frequency
cpuuse: global cpu usage (percentage)
platform: python platform info
chaserial: blade chassis serial number (dell tag)
chaasset: blade chassis asset tag (dell tag)
Antoine Millet's avatar
Antoine Millet committed
chaslot: position in blade chassis (slot number)
Seblu's avatar
Seblu committed

== grammar ==
Seblu's avatar
Seblu committed
input: [ prop ] EOL
Seblu's avatar
Seblu committed
prop: "(" prop ")" | stat
Seblu's avatar
Seblu committed
stat: [ prop ] sep prop | [ prop ] mod word | clause
clause: word [ op word ]
sep: "&" | "|" | "/"
Seblu's avatar
Seblu committed
mod: "^" | "%" | "$"
op: "=" | "!=" |  ":" | "!:" | "~" | "!~" | ">" | ">=" | "<" | "<="