
------=_Part_12676489_1802186867.1369663357141 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ----- Original Message -----
From: "Edgar" <shweng@163.com> To: engine-devel@ovirt.org Sent: Monday, May 27, 2013 4:35:42 PM Subject: [Engine-devel] How to get the number of all running VMs
Hi All, I need to get the number of All running VMs of the oVirt-engine. My thought is first get all hosts with "up" status and then traverse each host and count the VM with state "Running" .
Does this method feasible,and is there any easier way to count the running VMs of oVirt-engine?
Best Regards
you can use the webadmin, but not sure there is an easy way to see total count if there are more than one pages of results, just enter in the search: Vms: status != down and status != imagelocked and status != suspended you can use get the same with rest api: http://localhost:8700/api/vms?search=%22status%20!=%20down%20and%20status%20... and parse the result or by using the db: select count(*) from vm_dynamic where status not in (0,15,13);
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
state </span><span style=3D"line-height: 1.7; " data-mce-style=3D"lin= e-height: 1.7;">"Running" </span><span style=3D"line-height: 1.7; " da= ta-mce-style=3D"line-height: 1.7;">.</span><div style=3D"color: rgb(0, 0, 0= ); font-family: arial; font-size: 14px; line-height: 1.7; " data-mce-style= =3D"color: #000000; font-family: arial; font-size: 14px; line-height: 1.7;"= <span style=3D"line-height: 1.7; " data-mce-style=3D"line-height: 1.7;"><b= r></span></div><div><span style=3D"color: rgb(0, 0, 0); font-family: arial;= font-size: 14px; line-height: 1.7; " data-mce-style=3D"color: #000000; fon= t-family: arial; font-size: 14px; line-height: 1.7;"> Does this metho= d </span>feasible,and is there any easier way to count the running VMs= of oVirt-engine?</div><div><br></div><div> Best Regards</div></div></=
------=_Part_12676489_1802186867.1369663357141 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><body><div style=3D"font-family: times new roman, new york, times, se= rif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id= =3D"zwchr"><blockquote style=3D"border-left:2px solid #1010FF;margin-left:5= px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-de= coration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-= mce-style=3D"border-left: 2px solid #1010FF; margin-left: 5px; padding-left= : 5px; color: #000; font-weight: normal; font-style: normal; text-decoratio= n: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From= : </b>"Edgar" <shweng@163.com><br><b>To: </b>engine-devel@ovirt.org<b= r><b>Sent: </b>Monday, May 27, 2013 4:35:42 PM<br><b>Subject: </b>[Engine-d= evel] How to get the number of all running VMs<br><div><br></div><div= style=3D"line-height:1.7;color:#000000;font-size:14px;font-family:arial" d= ata-mce-style=3D"line-height: 1.7; color: #000000; font-size: 14px; font-fa= mily: arial;"><div style=3D"line-height:1.7;color:#000000;font-size:14px;fo= nt-family:arial" data-mce-style=3D"line-height: 1.7; color: #000000; font-s= ize: 14px; font-family: arial;"><div style=3D"line-height:1.7;color:#000000= ;font-size:14px;font-family:arial" data-mce-style=3D"line-height: 1.7; colo= r: #000000; font-size: 14px; font-family: arial;"><span style=3D"line-heigh= t: 1.7;" data-mce-style=3D"line-height: 1.7;">Hi All,</span><div style=3D"c= olor: rgb(0, 0, 0); font-family: arial; font-size: 14px; line-height: 1.7; = " data-mce-style=3D"color: #000000; font-family: arial; font-size: 14px; li= ne-height: 1.7;"> I need to get the number of All running VMs of the o= Virt-engine.</div><div style=3D"color: rgb(0, 0, 0); font-family: arial; fo= nt-size: 14px; line-height: 1.7; " data-mce-style=3D"color: #000000; font-f= amily: arial; font-size: 14px; line-height: 1.7;"> My thought is = first get all hosts with "up" status and then <span style=3D"line-heig= ht: 1.7; " data-mce-style=3D"line-height: 1.7;">traverse each host and coun= t the </span></div><div style=3D"color: rgb(0, 0, 0); font-family: ari= al; font-size: 14px; line-height: 1.7; " data-mce-style=3D"color: #000000; = font-family: arial; font-size: 14px; line-height: 1.7;"><span style=3D"line= -height: 1.7; " data-mce-style=3D"line-height: 1.7;"> VM with </s= pan><span style=3D"line-height: 1.7; " data-mce-style=3D"line-height: 1.7;"= div></div></div></blockquote><div>you can use the webadmin, but not sure th= ere is an easy way to see total count if there are more than one pages of r= esults,<br></div><div>just enter in the search:<br></div><div>Vms: status != =3D down and status !=3D imagelocked and status !=3D suspended</div><div><b= r></div><div>you can use get the same with rest api:<br></div><div><a href= =3D"http://localhost:8700/api/vms?search=3D%22status%20!=3D%20down%20and%20= status%20!=3D%20imagelocked%20and%20status%20!=3D%20suspended%22">http://lo= calhost:8700/api/vms?search=3D%22status%20!=3D%20down%20and%20status%20!=3D= %20imagelocked%20and%20status%20!=3D%20suspended%22</a></div><div>and parse= the result<br></div><div><br></div><div><br></div><div>or by using the db:= <br></div><div>select count(*) from vm_dynamic where status not in (0,15,13= );</div><blockquote style=3D"border-left:2px solid #1010FF;margin-left:5px;= padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decor= ation:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce= -style=3D"border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5= px; color: #000; font-weight: normal; font-style: normal; text-decoration: = none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div style= =3D"line-height:1.7;color:#000000;font-size:14px;font-family:arial" data-mc= e-style=3D"line-height: 1.7; color: #000000; font-size: 14px; font-family: = arial;"><div style=3D"line-height:1.7;color:#000000;font-size:14px;font-fam= ily:arial" data-mce-style=3D"line-height: 1.7; color: #000000; font-size: 1= 4px; font-family: arial;"><div style=3D"line-height:1.7;color:#000000;font-= size:14px;font-family:arial" data-mce-style=3D"line-height: 1.7; color: #00= 0000; font-size: 14px; font-family: arial;"><div style=3D"color: rgb(0, 0, = 0); font-family: arial; font-size: 14px; line-height: 1.7; " data-mce-style= =3D"color: #000000; font-family: arial; font-size: 14px; line-height: 1.7;"=
<div style=3D"color: rgb(0, 0, 0); font-family: arial; font-size: 14px; li= ne-height: 1.7; " data-mce-style=3D"color: #000000; font-family: arial; fon= t-size: 14px; line-height: 1.7;"><span style=3D"line-height: 1.7; " data-mc= e-style=3D"line-height: 1.7;"> </span></div><div style=3D"color:= rgb(0, 0, 0); font-family: arial; font-size: 14px; line-height: 1.7; " dat= a-mce-style=3D"color: #000000; font-family: arial; font-size: 14px; line-he= ight: 1.7;"><br></div></div></div></div><br><div><br></div><span title=3D"n= eteasefooter"><br>_______________________________________________<br>Engine= -devel mailing list<br>Engine-devel@ovirt.org<br>http://lists.ovirt.org/mai= lman/listinfo/engine-devel<br></span></div></blockquote><div><br></div></di= v></body></html> ------=_Part_12676489_1802186867.1369663357141--