Permalink
Browse files

OS-1731 fix problem where vmadmd doesn't bring up VNC on provisioning…

…->running transition.
  • Loading branch information...
1 parent 0538dd8 commit 65f0e94b5207c4efad52a5d33aa971d3ae3ce12c @joshwilsdon joshwilsdon committed Nov 30, 2012
Showing with 24 additions and 6 deletions.
  1. +24 −6 src/vm/sbin/vmadmd.js
View
@@ -116,12 +116,6 @@ function spawnRemoteDisplay(vmobj)
zonepath = '/zones/' + vmobj.uuid;
}
- if (vmobj.state !== 'running' && vmobj.zone_state !== 'running') {
- log.debug('skipping ' + protocol + ' setup for non-running VM '
- + vmobj.uuid);
- return;
- }
-
// We need to work out which protocol to use since only one will work
// (effectively) at any given time. If a spice_port is set then we will use
// that, otherwise we default back to VNC.
@@ -139,6 +133,12 @@ function spawnRemoteDisplay(vmobj)
sockpath = '/root/tmp/vm.vnc';
}
+ if (vmobj.state !== 'running' && vmobj.zone_state !== 'running') {
+ log.debug('skipping ' + protocol + ' setup for non-running VM '
+ + vmobj.uuid);
+ return;
+ }
+
if (port === -1) {
log.info(protocol + ' listener disabled (port === -1) for VM '
+ vmobj.uuid);
@@ -342,6 +342,24 @@ function updateZoneStatus(ev)
// wait for /var/svc/provisioning to disappear
VM.waitForProvisioning(vmobj, function (wait_err) {
VM.log.debug(wait_err, 'waited for provisioning');
+ if (!wait_err && vmobj.brand === 'kvm') {
+ // reload the VM to see if we should setup VNC, etc.
+ VM.load(vmobj.uuid, function (load_err, obj) {
+ if (load_err) {
+ log.error(load_err, 'unable to load VM after '
+ + 'waiting for provision: ' + load_err.message);
+ return;
+ }
+ log.debug('VM state is ' + obj.state
+ + ' after provisioning');
+ if (obj.state === 'running') {
+ // clear any old timers or VNC/SPICE since this vm
+ // just came up, then spin up a new VNC.
+ clearVM(obj.uuid);
+ spawnRemoteDisplay(obj);
+ }
+ });
+ }
delete PROV_IVAL[vmobj.uuid];
});
return;

0 comments on commit 65f0e94

Please sign in to comment.