
This is a multi-part message in MIME format. --------------050206020405050204030201 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit There was a discussion on this list a year or so ago about this. I believe one of the developers responded that oVirt has no facility to start VMs on a boot, and explained why.... I use the following 2 scripts to start VMs automatically when my AIO host reboots for whatever reason. The Python script was grabbed from somewhere on the net, I don't remember where anymore. I run the first script out of cron every 15 minutes. #!/bin/bash VMSTART="vm1 vm2 vm...." for vm in ${VMSTART} do echo "Do I need to start ${vm}" /root/bin/vm_up ${vm} if [ $? -eq 1 ]; then TEXT="VM ${vm} needed starting" echo "${TEXT}" echo "${TEXT}" | mailx -s "${TEXT}" root@domain.com fi done #!/usr/bin/python import sys, string from time import sleep from ovirtsdk.api import API from ovirtsdk.xml import params VERSION = params.Version(major='3', minor='0') URL = 'https://host.domain/api' USERNAME = 'admin@internal' PASSWORD = 'passwd' CA_FILE = '/etc/pki/ovirt-engine/ca.pem' VM_NAME = sys.argv[1] api = API(url=URL, username=USERNAME, password=PASSWORD, ca_file=CA_FILE) try: if api.vms.get(VM_NAME).status.state != 'up': print 'Starting VM' api.vms.get(VM_NAME).start() print 'Waiting for VM to reach UP status' while api.vms.get(VM_NAME).status.state != 'up': sleep(1) sys,exit(1) else: print 'VM already up' sys.exit(0) except Exception as e: print 'Failed to Start VM:\n%s' % str(e) On 12/22/2014 10:53 PM, Brent Hartzell wrote:
Can this be done? We hit a road block with gluster and will be using local storage while testing gluster. Only problem, if a host reboots, the vm's on that host do not. Is there a way to have ovirt/libvirt start all vm's residing on the local storage?
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
--------------050206020405050204030201 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">There was a discussion on this list a year or so ago about this. I believe one of the developers responded that oVirt has no facility to start VMs on a boot, and explained why....<br> <br> I use the following 2 scripts to start VMs automatically when my AIO host reboots for whatever reason. The Python script was grabbed from somewhere on the net, I don't remember where anymore.<br> I run the first script out of cron every 15 minutes.<br> <br> #!/bin/bash<br> <br> VMSTART="vm1 vm2 vm...."<br> <br> for vm in ${VMSTART}<br> do<br> echo "Do I need to start ${vm}"<br> /root/bin/vm_up ${vm}<br> if [ $? -eq 1 ]; then<br> TEXT="VM ${vm} needed starting"<br> echo "${TEXT}"<br> echo "${TEXT}" | mailx -s "${TEXT}" <a class="moz-txt-link-abbreviated" href="mailto:root@domain.com">root@domain.com</a><br> fi<br> done<br> <br> #!/usr/bin/python<br> <br> import sys, string<br> from time import sleep<br> <br> from ovirtsdk.api import API<br> from ovirtsdk.xml import params<br> <br> VERSION = params.Version(major='3', minor='0')<br> <br> URL = '<a class="moz-txt-link-freetext" href="https://host.domain/api">https://host.domain/api</a>'<br> USERNAME = 'admin@internal'<br> PASSWORD = 'passwd'<br> CA_FILE = '/etc/pki/ovirt-engine/ca.pem'<br> <br> VM_NAME = sys.argv[1]<br> <br> api = API(url=URL, username=USERNAME, password=PASSWORD, ca_file=CA_FILE)<br> <br> <br> try:<br> if api.vms.get(VM_NAME).status.state != 'up':<br> print 'Starting VM'<br> api.vms.get(VM_NAME).start()<br> print 'Waiting for VM to reach UP status'<br> while api.vms.get(VM_NAME).status.state != 'up':<br> sleep(1)<br> sys,exit(1)<br> else:<br> print 'VM already up'<br> sys.exit(0)<br> except Exception as e:<br> print 'Failed to Start VM:\n%s' % str(e)<br> <br> <br> <br> On 12/22/2014 10:53 PM, Brent Hartzell wrote:<br> </div> <blockquote cite="mid:BLU406-EAS33C525FD5ADA0BE92E01188D570@phx.gbl" type="cite"> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> <div> <div style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">Can this be done? We hit a road block with gluster and will be using local storage while testing gluster. Only problem, if a host reboots, the vm's on that host do not. Is there a way to have ovirt/libvirt start all vm's residing on the local storage?</div> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ Users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a> <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a> </pre> </blockquote> <br> </body> </html> --------------050206020405050204030201--