> On 2 Oct 2019, at 13:29, Vrgotic, Marko <m.vrgo...@activevideo.com> wrote:
> 
> Any ideas
>  
> From: "Vrgotic, Marko" <m.vrgo...@activevideo.com>
> Date: Friday, 27 September 2019 at 17:26
> To: "users@ovirt.org" <users@ovirt.org>
> Subject: How to pass parameters between VDSM Hooks domxml in single run
>  
> Dear oVIrt,
>  
> A while ago we discussed on ways to change/update content of parameters of 
> domxml in certain action.
>  
> As I mentioned before, we have added the VDSMHook 60_nsupdate which removes 
> the DNS record entries when a VM is destroyed:
>  
> …
> domxml = hooking.read_domxml()
>         name = domxml.getElementsByTagName('name')[0]
>         name = " ".join(name.nodeValue for name in name.childNodes if 
> name.nodeType == name.TEXT_NODE)
>         nsupdate_commands = """server {server_ip}
> update delete {vm_name}.example.com a
> update delete {vm_name}. example.com aaaa
> update delete {vm_name}. example.com txt
> send
> """.format(server_ip="172.16.1.10", vm_name=name)
> …
>  
> The goal:
> However, we did not want to execute remove dns records when VM is only 
> migrated. Since its considered a “destroy” action we took following approach.
>       • In state “before_vm_migrate_source add hook which will write flag 
> “is_migration” to domxml
>       • Once VM is scheduled for migration, this hook should add the flag 
> “is_migration” to domxml
>       • Once 60_nsupdate is triggered, it will check for the flag and if 
> there, skip executing dns record action, but only remove the flag 
> “is_migration” from domxml of the VM
>  
> …
> domxml = hooking.read_domxml()
>         migration = domxml.createElement("is_migration")
>         domxml.getElementsByTagName("domain")[0].appendChild(migration)
>         logging.info("domxml_updated {}".format(domxml.toprettyxml()))
>         hooking.write_domxml(domxml)
> …
>  
> When executing first time, we observed that flag “
>  
>         <name>hookiesvm</name>
>         <uuid>fcfa66cb-b251-43a3-8e2b-f33b3024a749</uuid>
>         <metadata xmlns:ns0="http://ovirt.org/vm/tune/1.0"; 
> xmlns:ns1="http://ovirt.org/vm/1.0";>
>                 <ns0:qos/>
>                 <ovirt-vm:vm xmlns:ovirt-vm="http://ovirt.org/vm/1.0";>
>                         <ovirt-vm:clusterVersion>4.3</ovirt-vm:clusterVersion>
>                         <ovirt-vm:destroy_on_reboot 
> type="bool">False</ovirt-vm:destroy_on_reboot>
>                         <ovirt-vm:launchPaused>false</ovirt-vm:launchPaused>
>                         <ovirt-vm:memGuaranteedSize 
> type="int">1024</ovirt-vm:memGuaranteedSize>
>                         <ovirt-vm:minGuaranteedMemoryMb 
> type="int">1024</ovirt-vm:minGuaranteedMemoryMb>
> ...skipping...
>                         <address bus="0x00" domain="0x0000" function="0x0" 
> slot="0x09" type="pci"/>
>                 </rng>
>         </devices>
>         <seclabel model="selinux" relabel="yes" type="dynamic">
>                 <label>system_u:system_r:svirt_t:s0:c169,c575</label>
>                 
> <imagelabel>system_u:object_r:svirt_image_t:s0:c169,c575</imagelabel>
>         </seclabel>
>         <seclabel model="dac" relabel="yes" type="dynamic">
>                 <label>+107:+107</label>
>                 <imagelabel>+107:+107</imagelabel>
>         </seclabel>
>         <is_migration/>

you can’t just add a random tag into libvirt xml in a random place, it will be 
dropped by libvirt.
you can add it to metadata though. we use that for ovirt-specific information

> </domain>  
> is added to domxml, but was present once 60_nsupdate hook was executed.
>  
> The question: How do we make sure that, when domxml is updated, that the 
> update is visible/usable by following hook, in single run? How to pass these 
> changes between hooks?
>  
> Kindly awaiting your reply.
>  
>  
> — — —
> Met vriendelijke groet / Kind regards,
> 
> Marko Vrgotic
>  
>  
> _______________________________________________
> Users mailing list -- users@ovirt.org
> To unsubscribe send an email to users-le...@ovirt.org
> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> oVirt Code of Conduct: 
> https://www.ovirt.org/community/about/community-guidelines/
> List Archives: 
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/IC4J6CAJUQOSLU3ZJPX3ZHTUM4HUCMGU/
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/MHQ4VQ4IXO6GM5MOGQSHAX74SCP2QUJD/

Reply via email to