python sdk create a windows machine with initial run sysprep

Hi i am trying to create virtual machines from a template but i cannot seem to find how to ad the inital run sysprep option how should i give that option ? my code <code> NEW_VM_NAME = 'W10MYMACINE' TEMPLATE_NAME = 'W10TEMP' CLUSTER_NAME= 'MYCLUSTER' try: api.vms.add(params.VM(name=NEW_VM_NAME, cluster=api.clusters.get(CLUSTER_NAME), template=api.templates.get(TEMPLATE_NAME))) print 'VM was created from Template successfully' print 'Waiting for VM to reach Down status' while api.vms.get(NEW_VM_NAME).status.state != 'down': sleep(1) except Exception as e: print 'Failed to create VM from Template:\n%s' % str(e) </code>

That option has to be passed when you start the VM, not in the creation phase: api.vms.get(NEW_VM_NAME).start(use_sysprep=true) Il 29/08/2019 12:45, Harry Conings ha scritto:
Hi i am trying to create virtual machines from a template but i cannot seem to find how to ad the inital run sysprep option how should i give that option ? my code <code> NEW_VM_NAME = 'W10MYMACINE' TEMPLATE_NAME = 'W10TEMP' CLUSTER_NAME= 'MYCLUSTER'
try: api.vms.add(params.VM(name=NEW_VM_NAME, cluster=api.clusters.get(CLUSTER_NAME), template=api.templates.get(TEMPLATE_NAME))) print 'VM was created from Template successfully' print 'Waiting for VM to reach Down status' while api.vms.get(NEW_VM_NAME).status.state != 'down': sleep(1) except Exception as e: print 'Failed to create VM from Template:\n%s' % str(e) </code> _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/CIWFZXRJTELNSM...

Hi i tryed api.vms.get(NEW_VM_NAME).start(use_sysprep='true') got this error start() got an unexpected keyword argument 'use_sysprep' thks for your reply Op do 29 aug. 2019 om 12:58 schreef Giulio Casella <giulio@di.unimi.it>:
That option has to be passed when you start the VM, not in the creation phase:
api.vms.get(NEW_VM_NAME).start(use_sysprep=true)
Il 29/08/2019 12:45, Harry Conings ha scritto:
Hi i am trying to create virtual machines from a template but i cannot seem to find how to ad the inital run sysprep option how should i give that option ? my code <code> NEW_VM_NAME = 'W10MYMACINE' TEMPLATE_NAME = 'W10TEMP' CLUSTER_NAME= 'MYCLUSTER'
try: api.vms.add(params.VM(name=NEW_VM_NAME, cluster=api.clusters.get(CLUSTER_NAME), template=api.templates.get(TEMPLATE_NAME))) print 'VM was created from Template successfully' print 'Waiting for VM to reach Down status' while api.vms.get(NEW_VM_NAME).status.state != 'down': sleep(1) except Exception as e: print 'Failed to create VM from Template:\n%s' % str(e) </code> _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/CIWFZXRJTELNSM...
-- Vriendelijke groeten, Harry Conings ICE bvba Liebroekstraat 43 3545 Halen BE0446888007 tel 32475464289

Thks all i found the solution action = params.Action(use_sysprep=True) api.vms.get(NEW_VM_NAME).start(action)
participants (2)
-
Giulio Casella
-
Harry Conings