243
248
'architecture': instance.architecture})
245
250
def _check_agent_version():
246
version = self.get_agent_version(instance)
251
if instance.os_type == 'windows':
252
# Windows will generally perform a setup process on first boot
253
# that can take a couple of minutes and then reboot. So we
254
# need to be more patient than normal as well as watch for
256
version = self.get_agent_version(instance,
257
timeout=FLAGS.windows_version_timeout)
259
version = self.get_agent_version(instance)
248
261
LOG.info(_('No agent version returned by instance'))
498
511
task = self._session.call_xenapi('Async.VM.clean_reboot', vm_ref)
499
512
self._session.wait_for_task(task, instance.id)
501
def get_agent_version(self, instance):
514
def get_agent_version(self, instance, timeout=None):
502
515
"""Get the version of the agent running on the VM instance."""
504
# Send the encrypted password
505
transaction_id = str(uuid.uuid4())
506
args = {'id': transaction_id}
507
resp = self._make_agent_call('version', instance, '', args)
509
# No response from the agent
511
resp_dict = json.loads(resp)
512
return resp_dict['message']
518
# Send the encrypted password
519
transaction_id = str(uuid.uuid4())
520
args = {'id': transaction_id}
521
resp = self._make_agent_call('version', instance, '', args)
523
# No response from the agent
525
resp_dict = json.loads(resp)
526
return resp_dict['message']
529
vm_ref = self._get_vm_opaque_ref(instance)
530
vm_rec = self._session.get_xenapi().VM.get_record(vm_ref)
532
domid = vm_rec['domid']
534
expiration = time.time() + timeout
535
while time.time() < expiration:
540
vm_rec = self._session.get_xenapi().VM.get_record(vm_ref)
541
if vm_rec['domid'] != domid:
542
LOG.info(_('domid changed from %(olddomid)s to '
545
'newdomid': vm_rec['domid']})
546
domid = vm_rec['domid']
514
550
def agent_update(self, instance, url, md5sum):
515
551
"""Update agent on the VM instance."""