[Users] python-sdk : how to modify a vm to "Run on" a "Specific" host and set "Migration Options
karthik.lubdup at gmail.com
Tue Dec 31 00:16:21 UTC 2013
Hi Michael Pasternak,
Thanks for the info.
I was able to modify the VM as :
vm_placement_params = params.VmPlacementPolicy(host =
params.VM(name=rhev_host_name), affinity = "pinned")
Thanks much !!
On Sat, Dec 28, 2013 at 11:51 PM, Michael Pasternak <mpastern at redhat.com>wrote:
> take a look at vm.start.__doc__ it should have all the answers you're
> looking for,
> as about migrate options, these two  are responsible for pinning vm to
> specific host,
> possible options for the 'affinity' can be seen at <vm_affinities> .
> [@param action.vm.placement_policy.host.id|name: string]
> [@param action.vm.placement_policy.affinity: string]
> On 12/27/2013 11:54 PM, karthik S wrote:
> > Dear Users,
> > I am karthik, based in Mountain View, CA. I have been using python
> ovirtsdk for QA Automation tests for RHEV-M for past two months. My
> knowledge on ovirtsdk is intermittent
> > at this stage.
> > I want to do the below actions that we do on rhev-M using python
> > On, RHEV-M UI
> > ============
> > 1) right click a offline VM >> Edit >> Host >> "Run On:" >> Specific >.
> choose a hostname
> > 2) right click a offline VM >> Edit >> Host >> "Migration Options:" >>
> "Do not allow migration"
> > python Code:
> > ==========
> > 1) The VM was imported from export domain to my storage_domain using the
> > def import_vm(self, source_vm_name, dest_vm_name,
> storage_domain_name, rhev_host_name=None, cluster_name="Default",
> > """
> > Import VM From a Export domain into your storage domain
> > """
> > timeoutSec=1800
> > pollInterval=2
> > exportStorageDomain =
> > actionParams = params.Action(
> > clone=1,
> > vm = params.VM (name=dest_vm_name,
> > disks =
> params.Disks(clone = 1),
> > host =
> > ))
> > start = time.time()
> > while self.api.vms.get(dest_vm_name).status.state != 'down':
> > if time.time() - start > timeoutSec:
> > raise Exception("Timed out (%s) waiting for %s to
> obtain down status" % (timeoutSec, vm_name))
> > time.sleep(pollInterval)
> > return self.api.vms.get(name=dest_vm_name)
> > Issue : Upon import, this method did not set the "Run as" to the
> specified host but "Run as" was set to "Any host in the cluster". Am I
> missing something ?
> > 2) Secondly, I tried modifying the VM "Run as" hostname with the below
> >>>> api = API (url = "xx" , username ="XX", pasword ="XX", ca_file = "ca")
> >>>> vm_obj = api.vms.list(name="test_vm_101")
> >>>> vm_obj.set_host="rhev1"
> >>>> vm_obj.update()
> > This did not help either. Seems I am missing something..
> > 3) finally how to set " "Migration Options" ?
> > Your help would appreciated and will help me to get greater
> understanding of the SDK itself.
> > Thanks,
> > Karthik
> > _______________________________________________
> > Users mailing list
> > Users at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/users
> Michael Pasternak
> RedHat, ENG-Virtualization R&D
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users