Index: /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp	(revision 38037)
+++ /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp	(revision 38038)
@@ -34,4 +34,5 @@
 typedef struct
 {
+    Utf8Str                 strBaseName;
     ComPtr<IMedium>         pMedium;
     ULONG                   uWeight;
@@ -367,4 +368,9 @@
                 mtc.fAttachLinked = fAttachLinked;
 
+                /* If the current state without any snapshots is cloned, we
+                 * don't need any diff images in the new clone. Add the last
+                 * medium to the list of medias to create only (the clone
+                 * operation of IMedium will create a merged copy
+                 * automatically). */
                 if (d->mode == CloneMode_MachineState)
                 {
@@ -377,6 +383,18 @@
                     if (FAILED(rc)) throw rc;
 
+                    ComPtr<IMedium> pBaseMedium;
+                    rc = pSrcMedium->COMGETTER(Base)(pBaseMedium.asOutParam());
+                    if (FAILED(rc)) throw rc;
+
+                    MEDIUMTASK mt;
+
+                    Bstr bstrBaseName;
+                    rc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam());
+                    if (FAILED(rc)) throw rc;
+
+                    /* Save the base name. */
+                    mt.strBaseName = bstrBaseName;
+
                     /* Save the current medium, for later cloning. */
-                    MEDIUMTASK mt;
                     mt.pMedium = pSrcMedium;
                     if (fAttachLinked)
@@ -679,4 +697,9 @@
                         if (!fKeepDiskNames)
                         {
+                            Utf8Str strSrcTest = bstrSrcName;
+                            /* Check if we have to use another name. */
+                            if (!mt.strBaseName.isEmpty())
+                                strSrcTest = mt.strBaseName;
+                            strSrcTest.stripExt();
                             /* If the old disk name was in {uuid} format we also
                              * want the new name in this format, but with the
@@ -685,5 +708,4 @@
                              * For all other disks we rename them with this
                              * template: "new name-disk1.vdi". */
-                            Utf8Str strSrcTest = Utf8Str(bstrSrcName).stripExt();
                             if (strSrcTest == strOldVMName)
                                 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathExt(Utf8Str(bstrSrcName).c_str()));
@@ -707,8 +729,7 @@
                         if (FAILED(rc)) throw rc;
                         if (   !bstrSrcPath.isEmpty()
-                            &&  RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str()))
+                            &&  RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str())
+                            && !(fKeepDiskNames || mt.strBaseName.isEmpty()))
                             strFile = Utf8StrFmt("%s%c%s", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str());
-                        else
-                            strFile = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str());
 
                         /* Start creating the clone. */
