<div dir="ltr"><div>Hi,<br><br>VM rebuild means...Rebuild the VM with the same existing configuration...just erase the Vdisk and install again (like Fresh install).
<br>We want to rebuild the VM with the same existing OS template...also it will be good if user can select other OS template also for the rebuild purpose...
<br>With CD_ISO it require the manual installation...we don't want the manual installation...we looking for a way to rebuild the VM with OS templates....
<br>Is there any API method to achieve this ??<br><br></div>Regarding the statitics report, is there any API method to fetch the monthly and weekly usages report ?, we are planning to create a usage chart by using these values.<br>
</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><span>-- <br></span>Regards
<br>Shanil
</div></div>
<br><br><div class="gmail_quote">On Fri, Aug 22, 2014 at 9:46 AM, OvirtAndKvm <span dir="ltr"><<a href="mailto:oVirt@goproject.info" target="_blank">oVirt@goproject.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Do you mean like; attach a new OS install ISO CD to the VM, change the VM's boot order to CD first, reboot the VM and boot up on the CD and install the new OS, selecting to reformat over the old installed OS ?<br>
<br>or am I miss understanding your question ?<div><div class="h5"><br><br><br>At Friday, 22-08-2014 on 13:58 Shanil S wrote:<br><blockquote style="border:0;border-left:2px solid #22437f;padding:0px;margin:0px;padding-left:5px;margin-left:5px">
<div dir="ltr"><div><div>Hi Juan,<br><br></div>Thanks for your replies..<br><br></div>Regarding the rebuild VM, Is that any method to reinstall the os on the VM without remove it or create a new one? <br><br></div><div class="gmail_extra">
<br clear="all"><div><div dir="ltr"><span>-- <br></span>Regards
<br>Shanil
</div></div>
<br><br><div class="gmail_quote">On Thu, Aug 21, 2014 at 4:55 PM, Juan Hernandez <span dir="ltr"><<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 08/20/2014 12:42 PM, Shanil S wrote:<br>
> Hi,<br>
><br>
><br>
> I would like to create the following functions using the ovirt api<br>
><br>
> 1. Rebuild VM<br>
<br>
</div>What do you exactly mean by "rebuild vm"?<br>
<div><br>
> 2. Restore the screenthots of one vm to another vm<br>
<br>
</div>What you can do is create a new VM from an existing snapshot, something<br>
like this:<br>
<br>
#!/bin/sh -ex<br>
<br>
url="<a href="https://ovirt.example.com/ovirt-engine/api" target="_blank">https://ovirt.example.com/ovirt-engine/api</a>"<br>
user="admin@internal"<br>
password="******"<br>
<br>
curl \<br>
--verbose \<br>
--insecure \<br>
--request POST \<br>
--header "Accept: application/xml" \<br>
--header "Content-Type: application/xml" \<br>
--user "${user}:${password}" \<br>
--data "<br>
<vm><br>
<name>myclone</name><br>
<cluster id='00000001-0001-0001-0001-000000000171'/><br>
<snapshots><br>
<snapshot id='f09a98fd-2c7e-40eb-a9ae-6b7f86412bb0'/><br>
</snapshots><br>
</vm><br>
" \<br>
"${url}/vms"<br>
<br>
You need to modify that script with your URL, user name, password,<br>
cluster and snapshot id.<br>
<div><br>
> 3. Display cpu,network etc usages<br>
><br>
<br>
</div>The statistics are available in the "statistics" sub-resource. For<br>
example, if you want to get the statistics of a host you can do the<br>
following:<br>
<br>
#!/bin/sh -ex<br>
<br>
url="<a href="https://ovirt.example.com/ovirt-engine/api" target="_blank">https://ovirt.example.com/ovirt-engine/api</a>"<br>
user="admin@internal"<br>
password="******"<br>
<br>
curl \<br>
--verbose \<br>
--insecure \<br>
--request GET \<br>
--header "Accept: application/xml" \<br>
--user "${user}:${password}" \<br>
"${url}/hosts/40cc4c33-2560-4516-b028-1d59638139c3/statistics"<br>
<br>
There you will find different statistics, like "memory.total",<br>
"memory.used", etc. Take a look. Once you know what statistic you want<br>
you can get its details like this:<br>
<br>
curl \<br>
--verbose \<br>
--insecure \<br>
--request GET \<br>
--header "Accept: application/xml" \<br>
--user "${user}:${password}" \<br>
"${url}/hosts/40cc4c33-2560-4516-b028-1d59638139c3/statistics/7816602b-c05c-3db7-a4da-3769f7ad8896"<br>
<br>
This can be cumbersome to do with a shell script, so you may want to use<br>
the Python or Java SDKs, or just use directly the ovirt-shell:<br>
<br>
$ ovirt-shell --insecure<br>
URL: <a href="https://ovirt.example.com/ovirt-engine/api" target="_blank">https://ovirt.example.com/ovirt-engine/api</a><br>
Username: admin@internal<br>
Password: ******<br>
[oVirt shell (connected)]# show statistic memory.total --host-identifier<br>
myhost<br>
id : 7816602b-c05c-3db7-a4da-3769f7ad8896<br>
name : memory.total<br>
description : Total memory<br>
host-id : 40cc4c33-2560-4516-b028-1d59638139c3<br>
type : GAUGE<br>
unit : BYTES<br>
values-type : INTEGER<br>
values-value-datum: 2099249152<br>
<div><div><br>
> I couldn't find out any direct api method to do the above, Is it<br>
> possible to do these operations using api ? If anyone knows it please<br>
> help me to sort out it.<br>
><br>
><br>
><br>
> --<br>
> Regards<br>
> Shanil<br>
<br>
</div></div><span><font color="#888888">--<br>
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
</font></span></blockquote></div><br></div>
</blockquote></div></div></div>
</blockquote></div><br></div>