Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1484993 Details for
Bug 1630687
[RFE] provide affinity rules to the SPM role
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
workaround
no_spm.py (text/x-python), 1.57 KB, created by
Germano Veit Michel
on 2018-09-20 02:34:47 UTC
(
hide
)
Description:
workaround
Filename:
MIME Type:
Creator:
Germano Veit Michel
Created:
2018-09-20 02:34:47 UTC
Size:
1.57 KB
patch
obsolete
>#!/usr/bin/env python ># -*- coding: utf-8 -*- > >import sys >import argparse > >import ovirtsdk4 as sdk >import ovirtsdk4.types as types > >def vms_get_tagged_with(tag_names): > for vm in vms_service.list(): > if (vm_has_tags(vms_service.vm_service(vm.id), tag_names)): > yield vm.id > >def vm_has_tags(vm_service, tag_names): > vm_tags = [ tag.name for tag in vm_service.tags_service().list() ] > if (any(x in vm_tags for x in tag_names)): > return True > return False > >def get_spms(): > hosts_service = system_service.hosts_service() > for host in hosts_service.list(): > if host.spm.status == types.SpmStatus.SPM: > yield host.id > ># Command Line Arguments >parser = argparse.ArgumentParser(description='Keep VMs out of SPM.') >parser.add_argument('tags', nargs='+', type=str, > help='Tag name(s)') > >args = parser.parse_args() > ># Create the connection to the server: >connection = sdk.Connection( > url='https://rhvm.rhvlab/ovirt-engine/api', > username='admin@internal', > password='redhat', > ca_file='/etc/pki/ovirt-engine/ca.pem', >) > ># Request services >system_service = connection.system_service() >vms_service = system_service.vms_service() > ># Find SPM hosts >spms = get_spms() >if not spms: > print "Could not find SPM" > sys.exit(1) > ># Migrate all tagged VMs out of the SPM >for vm_id in vms_get_tagged_with(args.tags): > vm_service = vms_service.vm_service(vm_id) > vm = vm_service.get() > if vm.host.id in spms: > print("VM %s is on the SPM, firing migration" % vm.name) > vm_service.migrate() > >connection.close()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1630687
:
1484987
| 1484993