[Esbox-commits] r2317 - in branches/work_Ed: org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware

eswartz at garage.maemo.org eswartz at garage.maemo.org
Fri Oct 16 19:53:19 EEST 2009


Author: eswartz
Date: 2009-10-16 19:53:09 +0300 (Fri, 16 Oct 2009)
New Revision: 2317

Modified:
   branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/ILaunchableMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
Log:
-- For IMachineController#probeMachine(), make all VMs use SSH probe -- of a shorter duration -- before doing a potentially more expensive "is VM engine running" check.  (This is how it worked until recently.)  This avoids a lot of unnecessary 

-- Fix an NPE in scanning shared folders and cancelling

-- Use testparm instead of hardcoded paths to detect Samba shares.  And, combine results from both Samba config and user shares on Linux and OS X since these configurations are possible on both.


Modified: branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/ILaunchableMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/ILaunchableMachineController.java	2009-10-16 13:27:41 UTC (rev 2316)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/ILaunchableMachineController.java	2009-10-16 16:53:09 UTC (rev 2317)
@@ -13,8 +13,6 @@
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.process.IProcessLauncher;
 
 /**
  * This interface identifies a machine controller whose machine can be launched as a process
@@ -44,5 +42,4 @@
 	 * @return status of launch
 	 */
 	IStatus launchMachine(IProgressMonitor monitor);
-
 }
\ No newline at end of file

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2009-10-16 13:27:41 UTC (rev 2316)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2009-10-16 16:53:09 UTC (rev 2317)
@@ -83,6 +83,16 @@
 		return machineConfiguration.getSSHConfiguration(); 
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase#getProbeTimeout(org.maemo.mica.protocol.ssh.SSHConfiguration)
+	 */
+	@Override
+	protected int getProbeTimeout(SSHConfiguration configuration) {
+		// A virtual machine is on the same computer, so this should
+		// be a near-instant check.  Five seconds should be long enough.
+		return 5;
+	}
+	
 	/**
 	 * Tell if the virtual machine or engine is running.  This either detects
 	 * existing instances of the machine running on the host, or verifies
@@ -94,7 +104,7 @@
 	 * @return true if it is likely running, false if we either don't know
 	 * or if it is not running.  If unsure, return false.
 	 */
-	final public boolean isMachineRunning() {
+	final synchronized public boolean isMachineRunning() {
 		if (System.currentTimeMillis() >= nextVMAliveCheck) {
 			isVMRunning = doIsMachineRunning();
 			if (!isVMRunning) {

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java	2009-10-16 13:27:41 UTC (rev 2316)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java	2009-10-16 16:53:09 UTC (rev 2317)
@@ -223,14 +223,17 @@
 			scheduleProbe();
 		}
 		
-		// make sure it looks like QEMU is running
+		// check connection first
+		IStatus status = super.doProbeMachine(monitor);
+		if (status.isOK())
+			return status;
+		
+		// if that fails, make sure it looks like QEMU is running
 		if (!isMachineRunning())
 			return Activator.createErrorStatus("QEMU is not running " 
 					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
 		
-		IStatus status = super.doProbeMachine(monitor);
-		//if (launchInfo != null && !status.isOK())
-		//	launchInfo.setFailed(status);
+		status = super.doProbeMachine(monitor);
 		return status;
 	}
 }

Modified: branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java	2009-10-16 13:27:41 UTC (rev 2316)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java	2009-10-16 16:53:09 UTC (rev 2317)
@@ -207,12 +207,17 @@
 	 */
 	@Override
 	protected IStatus doProbeMachine(IProgressMonitor monitor) {
+		// check connection first
+		IStatus status = super.doProbeMachine(monitor);
+		if (status.isOK())
+			return status;
+		
 		// make sure it looks like VirtualBox is running
 		if (!isMachineRunning())
 			return Activator.createErrorStatus("VirtualBox is not running " 
 					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
 
-		return super.doProbeMachine(monitor);
+		return status;
 	}
 	
 	/**

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java	2009-10-16 13:27:41 UTC (rev 2316)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java	2009-10-16 16:53:09 UTC (rev 2317)
@@ -324,25 +324,16 @@
 	 */
 	@Override
 	protected IStatus doProbeMachine(IProgressMonitor monitor) {
-		if (HostUtils.isWindows()) {
-			// vmrun is horribly slow in Windows, so an SSH ping is usually faster
-			IStatus status = super.doProbeMachine(monitor);
-			if (status.isOK())
-				return status;
-			
-			if (!isMachineRunning())
-				return Activator.createErrorStatus("VMware is not running " 
-						+ ((IVirtualMachine) machine).getDescriptiveName(), null);
-			
+		// test connection first
+		IStatus status = super.doProbeMachine(monitor);
+		if (status.isOK())
 			return status;
-		} else {
-			if (!isMachineRunning())
-				return Activator.createErrorStatus("VMware is not running " 
-						+ ((IVirtualMachine) machine).getDescriptiveName(), null);
-			
-			IStatus status = super.doProbeMachine(monitor);
-			return status;
-
-		}
+		
+		// if that fails, verify the VM engine is running
+		if (!isMachineRunning())
+			return Activator.createErrorStatus("VMware is not running " 
+					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
+		
+		return status;
 	}
 }



More information about the Esbox-commits mailing list