diff --git a/TQL b/TQL index 7b0f14e510da313c4ea6f6e49d73ead679ab70f2..89cd7781d75db6c64a8d9b797aaa64df8ef6ff5e 100644 --- a/TQL +++ b/TQL @@ -1,72 +1,68 @@ ================== -Tag Query Language +Tag Query Languag ================== == by examples == -# list accounts -sluttrin> list a - -# list hypervisor -sluttrin> list hv - -# list vm -sluttrin> list vm - -# list vm of hypervisor toto -sluttrin> list hv=toto&vm - -# list vm chiche of hypervisor toto -sluttrin> list hv=toto&vm=chiche - -#list vm with 2 cpu -sluttrin> list vm&cpu=2 - -#list vm with 2 cpu and mem > 10g -sluttrin> list vm&cpu=2&mem>10g - -#list hypervistor with 2cpu and vm with 2cpu -sluttrin> list hv&cpu=2&vm&cpu=2 - -#list hypervistor at least 2cpu and show tags pop and alloc -sluttrin> list hv&cpu>=2$pop$alloc - -#list first 10 vm -sluttrin> list vm^10 - -#list last 10 vm -sluttrin> list vm^:10 - -#list vm -sluttrin> list vm^5:10 - -#list vm sorted by vm -sluttrin> list vm%vm - -#list vm sorted by vm and cpu -sluttrin> list vm%vm%cpu +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 == Basics == -- TQL build a list of objects from left to right -- Every tag can add or remove objects -- Separators create link between tag -- Operators apply only on one tag - -== separators of tags == -& and between tags -$ show a tag -^ limit output -% limit output - -== operators on tags == +- 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 +- Selecting, sorting and choosing separators are followed by tags +- 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 limit +$ tag choosing +% tag sorting + +== tags operators == = strict equality -!= not strict equlity -: globing matching -!:not globing matching +: globing matching (no case) ~ regex matching -!~ not regex matching > superior strict >= superior < inferior <= inferior strict +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 == number facility == 10k = 1000 @@ -77,30 +73,32 @@ $ show a tag 1gi = 1024 ^ 3 == well known tags == +id: object unique identifier (eg: kvmlab-1.test5) a: account name (eg: bobby) -role: account role (eg: hypersivor/host/cli/vm) -id: a[.vm] (eg: hkvm-itx1-3.slfw-b) -con: connection uptime or offline (eg: 3600/offline) -ip: ip of peer -hv: hypervisor name (eg: kvm-chausette) -vm: virtual machine name (eg: access) +r: account role (host/hv/vm/cli/web/spv) h: hostname (eg: access) -hvtype: hypervistor type (xen/kvm) +con: connection uptime in seconds or offline (eg: 3600) +ip: ipv4 of connection +hv: hypervisor name (eg: kvmlab-1) +htype: hypervisor type (xen/kvm) libvirtver: Libvirt version -status: Vm status (eg: running/paused/stopped) -pop: Point of Presence +status: VM status (running/paused/stopped) cpu: cpu count -mem: memory size +rcpu: reserved cpu count +mem: memory total size memused: memory used memfree: memory free -arch: (x86/x64) -uname: uname of host +arch: hardware architecture (x86/x64) +uname: output of uname command uptime: uptime of hostname load: load average -hvm: hardware virtualisation enabled alloc: host is allowed to be selected to a migration +hvm: hardware virtualisation enabled nvm: vm count on an hypervisor -version: account version +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 sto: storage pool names (eg: vg fg) stovg_type: vg storage pool type (eg: lvm) stovg_size: vg storage pool size (eg: 1042)