Index: /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 44151)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 44152)
@@ -6349,4 +6349,10 @@
                 tr("The virtual machine is already running or busy (machine state: %s)"),
                 Global::stringifyMachineState(mMachineState));
+
+        /* Set up release logging as early as possible after the check if
+         * there is already a running VM which we shouldn't disturb. */
+        rc = consoleInitReleaseLog(mMachine);
+        if (FAILED(rc))
+            throw rc;
 
         /* test and clear the TeleporterEnabled property  */
@@ -6629,7 +6635,4 @@
             LogFlowThisFunc(("Machine has a current snapshot which is online, skipping immutable images reset\n"));
 
-        rc = consoleInitReleaseLog(mMachine);
-        if (FAILED(rc))
-            throw rc;
 #ifdef VBOX_WITH_EXTPACK
         mptrExtPackManager->dumpAllToReleaseLog();
@@ -9346,11 +9349,11 @@
         fBeganTakingSnapshot = true;
 
-        /*
-         * state file is non-null only when the VM is paused
-         * (i.e. creating a snapshot online)
-         */
-        bool f =     (!pTask->bstrSavedStateFile.isEmpty() &&  pTask->fTakingSnapshotOnline)
-                  || ( pTask->bstrSavedStateFile.isEmpty() && !pTask->fTakingSnapshotOnline);
-        if (!f)
+        /* Check sanity: for offline snapshots there must not be a saved state
+         * file name. All other combinations are valid (even though online
+         * snapshots without saved state file seems inconsistent - there are
+         * some exotic use cases, which need to be explicitly enabled, see the
+         * code of SessionMachine::BeginTakingSnapshot. */
+        if (   !pTask->fTakingSnapshotOnline
+            && !pTask->bstrSavedStateFile.isEmpty())
             throw setErrorStatic(E_FAIL, "Invalid state of saved state file");
 
@@ -9364,6 +9367,5 @@
         if (pTask->fTakingSnapshotOnline)
         {
-            Utf8Str strSavedStateFile(pTask->bstrSavedStateFile);
-
+            int vrc;
             SafeVMPtr ptrVM(that);
             if (!ptrVM.isOk())
@@ -9372,9 +9374,13 @@
             pTask->mProgress->SetNextOperation(Bstr(tr("Saving the machine state")).raw(),
                                                pTask->ulMemSize);       // operation weight, same as computed when setting up progress object
-            pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, ptrVM.rawUVM());
-
-            alock.release();
-            LogFlowFunc(("VMR3Save...\n"));
-            int vrc = VMR3Save(ptrVM,
+            if (!pTask->bstrSavedStateFile.isEmpty())
+            {
+                Utf8Str strSavedStateFile(pTask->bstrSavedStateFile);
+
+                pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, ptrVM.rawUVM());
+
+                alock.release();
+                LogFlowFunc(("VMR3Save...\n"));
+                vrc = VMR3Save(ptrVM,
                                strSavedStateFile.c_str(),
                                true /*fContinueAfterwards*/,
@@ -9382,11 +9388,15 @@
                                static_cast<IProgress *>(pTask->mProgress),
                                &fSuspenededBySave);
-            alock.acquire();
-            if (RT_FAILURE(vrc))
-                throw setErrorStatic(E_FAIL,
-                                     tr("Failed to save the machine state to '%s' (%Rrc)"),
-                                     strSavedStateFile.c_str(), vrc);
-
-            pTask->mProgress->setCancelCallback(NULL, NULL);
+                alock.acquire();
+                if (RT_FAILURE(vrc))
+                    throw setErrorStatic(E_FAIL,
+                                         tr("Failed to save the machine state to '%s' (%Rrc)"),
+                                         strSavedStateFile.c_str(), vrc);
+
+                pTask->mProgress->setCancelCallback(NULL, NULL);
+            }
+            else
+                LogRel(("Console: skipped saving state as part of online snapshot\n"));
+
             if (!pTask->mProgress->notifyPointOfNoReturn())
                 throw setErrorStatic(E_FAIL, tr("Canceled"));
Index: /trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/SnapshotImpl.cpp	(revision 44151)
+++ /trunk/src/VBox/Main/src-server/SnapshotImpl.cpp	(revision 44152)
@@ -1440,6 +1440,14 @@
     /* stateFilePath is null when the machine is not online nor saved */
     if (fTakingSnapshotOnline)
-        // creating a new online snapshot: then we need a fresh saved state file
-        composeSavedStateFilename(strStateFilePath);
+    {
+        Bstr value;
+        HRESULT rc = GetExtraData(Bstr("VBoxInternal2/ForceTakeSnapshotWithoutState").raw(),
+                                  value.asOutParam());
+        if (FAILED(rc) || value != "1")
+        {
+            // creating a new online snapshot: we need a fresh saved state file
+            composeSavedStateFilename(strStateFilePath);
+        }
+    }
     else if (mData->mMachineState == MachineState_Saved)
         // taking an online snapshot from machine in "saved" state: then use existing state file
