VirtualBox

Changeset 30289 in vbox


Ignore:
Timestamp:
Jun 17, 2010 4:38:37 PM (14 years ago)
Author:
vboxsync
Message:

improved r62816: only show a warning now, not an error; enable the host cache if we detect an ext4 partition

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r30209 r30289  
    475475    , mVMPoweredOff(false)
    476476    , mVMIsAlreadyPoweringOff(false)
     477    , mfSnapshotFolderWarningShown(false)
    477478    , mVMMDev(NULL)
    478479    , mAudioSniffer(NULL)
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r30287 r30289  
    24022402    ComPtr<IMedium> pMedium;
    24032403    hrc = pMediumAtt->COMGETTER(Medium)(pMedium.asOutParam());                          H();
    2404     BOOL fPassthrough;
    2405     hrc = pMediumAtt->COMGETTER(Passthrough)(&fPassthrough);                            H();
    2406     rc = configMedium(pLunL0,
    2407                       !!fPassthrough,
    2408                       lType,
    2409                       fUseHostIOCache,
    2410                       fSetupMerge,
    2411                       uMergeSource,
    2412                       uMergeTarget,
    2413                       pMedium,
    2414                       aMachineState,
    2415                       phrc);                                                            RC_CHECK();
    24162404
    24172405    if (lType == DeviceType_HardDisk)
     
    24482436                    const char *pszUnit;
    24492437                    uint64_t u64Print = formatDiskSize(u64Size, &pszUnit);
    2450                     return VMSetError(pVM, VERR_FILE_TOO_BIG, RT_SRC_POS,
    2451                                       N_("The medium '%ls' has a logical size of %RU64%s "
    2452                                          "but the file system the medium is located on seems "
    2453                                          "to be FAT(32) which cannot handle files bigger than 4GB"),
    2454                                       strFile.raw(), u64Print, pszUnit);
     2438                    setVMRuntimeErrorCallbackF(pVM, this, 0,
     2439                            "FatPartitionDetected",
     2440                            N_("The medium '%ls' has a logical size of %RU64%s "
     2441                               "but the file system the medium is located on seems "
     2442                               "to be FAT(32) which cannot handle files bigger than 4GB.\n"
     2443                               "We strongly recommend to put all your virtual disk images and "
     2444                               "the snapshot folder onto an NTFS partition"),
     2445                           strFile.raw(), u64Print, pszUnit);
    24552446                }
    24562447#else /* !RT_OS_WINDOWS */
     
    24772468                            uint64_t u64PrintSiz = formatDiskSize(u64Size, &pszUnitSiz);
    24782469                            uint64_t u64PrintMax = formatDiskSize(maxSize, &pszUnitMax);
    2479                             return VMSetError(pVM, VERR_FILE_TOO_BIG, RT_SRC_POS,
    2480                                               N_("The medium '%ls' has a logical size of %RU64%s "
    2481                                                  "but the file system the medium is located on can "
    2482                                                  "only handle files up to %RU64%s in theory"),
    2483                                               strFile.raw(), u64PrintSiz, pszUnitSiz, u64PrintMax, pszUnitMax);
     2470                            setVMRuntimeErrorCallbackF(pVM, this, 0,
     2471                                    "FatPartitionDetected", /* <= not exact but ... */
     2472                                    N_("The medium '%ls' has a logical size of %RU64%s "
     2473                                       "but the file system the medium is located on can "
     2474                                       "only handle files up to %RU64%s in theory.\n"
     2475                                       "We strongly recommend to put all your virtual disk "
     2476                                       "images and the snapshot folder onto a proper "
     2477                                       "file system (e.g. ext3)"),
     2478                                    strFile.raw(), u64PrintSiz, pszUnitSiz, u64PrintMax, pszUnitMax);
    24842479                        }
    24852480                    }
    24862481                }
    24872482#endif /* !RT_OS_WINDOWS */
    2488             }
    2489             /*
    2490              * Snapshot folder:
    2491              * Here we test only for a FAT partition as we had to create a dummy file otherwise
    2492              */
    2493             if (   typeSnap == RTFS_FS_TYPE_FAT
    2494                 && u64Size >= _4G)
    2495             {
    2496                 const char *pszUnit;
    2497                 uint64_t u64Print = formatDiskSize(u64Size, &pszUnit);
    2498                 return VMSetError(pVM, VERR_FILE_TOO_BIG, RT_SRC_POS,
    2499                                   N_("The snapshot folder of this VM '%ls' seems to be located on "
    2500                                      "a FAT(32) file system. The logical size of the medium '%ls' "
    2501                                      "(%RU64%s) is bigger than the maximum file size this file "
    2502                                      "system can handle (4GB)"),
    2503                                   strSnap.raw(), strFile.raw(), u64Print, pszUnit);
    2504             }
     2483
     2484                /*
     2485                 * Snapshot folder:
     2486                 * Here we test only for a FAT partition as we had to create a dummy file otherwise
     2487                 */
     2488                if (   typeSnap == RTFS_FS_TYPE_FAT
     2489                    && u64Size >= _4G
     2490                    && !mfSnapshotFolderWarningShown)
     2491                {
     2492                    const char *pszUnit;
     2493                    uint64_t u64Print = formatDiskSize(u64Size, &pszUnit);
     2494                    setVMRuntimeErrorCallbackF(pVM, this, 0,
     2495                            "FatPartitionDetected",
     2496#ifdef RT_OS_WINDOWS
     2497                            N_("The snapshot folder of this VM '%ls' seems to be located on "
     2498                               "a FAT(32) file system. The logical size of the medium '%ls' "
     2499                               "(%RU64%s) is bigger than the maximum file size this file "
     2500                               "system can handle (4GB).\n"
     2501                               "We strongly recommend to put all your virtual disk images and "
     2502                               "the snapshot folder onto an NTFS partition"),
     2503#else
     2504                            N_("The snapshot folder of this VM '%ls' seems to be located on "
     2505                               "a FAT(32) file system. The logical size of the medium '%ls' "
     2506                               "(%RU64%s) is bigger than the maximum file size this file "
     2507                               "system can handle (4GB).\n"
     2508                               "We strongly recommend to put all your virtual disk images and "
     2509                               "the snapshot folder onto a proper file system (e.g. ext3)"),
     2510#endif
     2511                            strSnap.raw(), strFile.raw(), u64Print, pszUnit);
     2512                    /* Show this particular warning only once */
     2513                    mfSnapshotFolderWarningShown = true;
     2514                }
     2515
    25052516#ifdef RT_OS_LINUX
    2506             /*
    2507              * Ext4 bug: Check if the host I/O cache is disabled and the disk image is located
    2508              *           on an ext4 partition. Later we have to check the Linux kernel version!
    2509              */
    2510             if (   (uCaps & MediumFormatCapabilities_Asynchronous)
    2511                 && !fUseHostIOCache
    2512                 && (   typeFile == RTFS_FS_TYPE_EXT4
    2513                     || typeSnap == RTFS_FS_TYPE_EXT4))
    2514             {
    2515                 return VMSetError(pVM, VERR_GENERAL_FAILURE /*XXX*/, RT_SRC_POS,
    2516                                   N_("The host I/O cache for at least one controller is disabled "
    2517                                      "but the medium '%ls' or the snapshot folder for this VM "
    2518                                      "is located on an ext4 partition. There is a known Linux "
    2519                                      "kernel bug "
    2520                                      "which can lead to the corruption of the virtual disk image "
    2521                                      "under these conditions.\n"
    2522                                      "Either enable the host I/O cache or put the disk image and "
    2523                                      "the snapshot folder onto a different file system"),
    2524                                   strFile.raw());
    2525             }
     2517                /*
     2518                 * Ext4 bug: Check if the host I/O cache is disabled and the disk image is located
     2519                 *           on an ext4 partition. Later we have to check the Linux kernel version!
     2520                 */
     2521                if (   (uCaps & MediumFormatCapabilities_Asynchronous)
     2522                    && !fUseHostIOCache
     2523                    && (   typeFile == RTFS_FS_TYPE_EXT4
     2524                        || typeSnap == RTFS_FS_TYPE_EXT4))
     2525                {
     2526                    setVMRuntimeErrorCallbackF(pVM, this, 0,
     2527                            "Ext4PartitionDetected",
     2528                            N_("The host I/O cache for at least one controller is disabled "
     2529                               "but the medium '%ls' or the snapshot folder for this VM "
     2530                               "is located on an ext4 partition. There is a known Linux "
     2531                               "kernel bug which can lead to the corruption of the virtual "
     2532                               "disk image under these conditions.\n"
     2533                               "Either enable the host I/O cache permanently in the VM "
     2534                               "settings or put the disk image and the snapshot folder "
     2535                               "onto a different file system.\n"
     2536                               "The host I/O cache will now be enabled for this medium"),
     2537                            strFile.raw());
     2538                    fUseHostIOCache = true;
     2539                }
    25262540#endif
    2527         }
    2528     }
     2541            }
     2542        }
     2543    }
     2544
     2545    BOOL fPassthrough;
     2546    hrc = pMediumAtt->COMGETTER(Passthrough)(&fPassthrough);                            H();
     2547    rc = configMedium(pLunL0,
     2548                      !!fPassthrough,
     2549                      lType,
     2550                      fUseHostIOCache,
     2551                      fSetupMerge,
     2552                      uMergeSource,
     2553                      uMergeTarget,
     2554                      pMedium,
     2555                      aMachineState,
     2556                      phrc);                                                            RC_CHECK();
    25292557
    25302558    if (fAttachDetach)
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r30207 r30289  
    630630    /** true when vmstateChangeCallback shouldn't initiate a power down.  */
    631631    bool mVMIsAlreadyPoweringOff : 1;
     632    /** true if we already showed the snapshot folder warning. */
     633    bool mfSnapshotFolderWarningShown : 1;
    632634
    633635    /** The current network attachment type in the VM.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette