changing vm's product serial

This is a multi-part message in MIME format. --------------000101010705050708030005 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi all, We've been using templates for months before we realized that "ocs=20 report" used Serial Number given into "demidecode -t system" to identify=20 a VM as unique. This Serial Number is located into=20 /sys/devices/virtual/dmi/id/product_serial, and we'd really want each vm=20 to have its own Serial Number instead of the template's one. We tried to generate a new id with uuidgen, but it can't be written into=20 the product_serial file. Is there a simple way to do such a thing? Thank you. --=20 Nathana=C3=ABl Blanchet Supervision r=C3=A9seau P=C3=B4le Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 =09 T=C3=A9l. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr --------------000101010705050708030005 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf= -8"> </head> <body bgcolor=3D"#FFFFFF" text=3D"#000000"> Hi all,<br> <br> We've been using templates for months before we realized that "ocs report" used Serial Number given into "demidecode -t system" to identify a VM as unique.<br> This Serial Number is located into <i class=3D"moz-txt-slash"><span class=3D"moz-txt-tag">/</span>sys/devices/virtual/dmi/id<span class=3D"moz-txt-tag">/product_serial,=C2=A0 </span></i><span class=3D"moz-txt-slash"><span class=3D"moz-txt-tag">and we'd really want each vm to have its own Serial Number instead of the template's one.<br> We tried to generate a new id with uuidgen, but it can't be written into the product_serial file.<br> Is there a simple way to do such a thing?<br> Thank you.<br> </span></span> <pre class=3D"moz-signature" cols=3D"72">--=20 Nathana=C3=ABl Blanchet Supervision r=C3=A9seau P=C3=B4le Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 =09 T=C3=A9l. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:blanchet@abes.fr">bl= anchet@abes.fr</a> </pre> </body> </html> --------------000101010705050708030005--

On 03/08/2016 04:57 PM, Nathanaël Blanchet wrote:
Hi all,
We've been using templates for months before we realized that "ocs report" used Serial Number given into "demidecode -t system" to identify a VM as unique. This Serial Number is located into /sys/devices/virtual/dmi/id/product_serial, and we'd really want each vm to have its own Serial Number instead of the template's one. We tried to generate a new id with uuidgen, but it can't be written into the product_serial file. Is there a simple way to do such a thing? Thank you.
You can change the serial number of the VM via the GUI: Vms -> Edit -> System -> Provide custom serial number There you can specify that the VM should have as serial number the id of the host, the id of the VM, or a custom serial number. You can do the same with the API. For example, to set a custom serial number for a specific VM using the Python SDK you can do something like this: ---8<--- #!/usr/bin/python from ovirtsdk.api import API from ovirtsdk.xml import params # Connect to the server: api = API( url="https://engine.example.com/ovirt-engine/api", username="admin@internal", password="...", ca_file="/etc/pki/ovirt-engine/ca.pem", debug=False, ) # Find the VM: vm = api.vms.get(name="myvm") # Set a custom serial number: vm.set_serial_number( params.SerialNumber( policy="custom", value="yourserial", ) ) vm.update() # Disconnect: api.disconnect() --->8--- -- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.

thank you, it's ok for the python script! another simple way I found is with ovirt-shell: ovirt-shell -E "update vm name --serial_number-value $(uuidgen)" anyway we need not to simply reboot, but stop and start the vm so as to this change take effect Le 09/03/2016 12:35, Juan Hernández a écrit :
On 03/08/2016 04:57 PM, Nathanaël Blanchet wrote:
Hi all,
We've been using templates for months before we realized that "ocs report" used Serial Number given into "demidecode -t system" to identify a VM as unique. This Serial Number is located into /sys/devices/virtual/dmi/id/product_serial, and we'd really want each vm to have its own Serial Number instead of the template's one. We tried to generate a new id with uuidgen, but it can't be written into the product_serial file. Is there a simple way to do such a thing? Thank you.
You can change the serial number of the VM via the GUI:
Vms -> Edit -> System -> Provide custom serial number
There you can specify that the VM should have as serial number the id of the host, the id of the VM, or a custom serial number.
You can do the same with the API. For example, to set a custom serial number for a specific VM using the Python SDK you can do something like this:
---8<--- #!/usr/bin/python
from ovirtsdk.api import API from ovirtsdk.xml import params
# Connect to the server: api = API( url="https://engine.example.com/ovirt-engine/api", username="admin@internal", password="...", ca_file="/etc/pki/ovirt-engine/ca.pem", debug=False, )
# Find the VM: vm = api.vms.get(name="myvm")
# Set a custom serial number: vm.set_serial_number( params.SerialNumber( policy="custom", value="yourserial", ) ) vm.update()
# Disconnect: api.disconnect() --->8---
-- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
participants (2)
-
Juan Hernández
-
Nathanaël Blanchet