VirtualBox

Changeset 33709 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 2, 2010 7:15:26 PM (14 years ago)
Author:
vboxsync
Message:

Main/Machine: Reject any attempt to open a VM config with the same UUID as an already existing VM, e.g. caused by an attempt to open the config of an already known VM again. Much better to let people know what's going on instead of failing with Medium object conflicts (and without a human readable error message).

File:
1 edited

Legend:

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

    r33708 r33709  
    396396                mData->pMachineConfigFile = new settings::MachineConfigFile(&mData->m_strConfigFileFull);
    397397
     398                // reject VM UUID duplicates, they can happen if someone
     399                // tries to register an already known VM config again
     400                if (aParent->findMachine(mData->pMachineConfigFile->uuid,
     401                                         true /* fPermitInaccessible */,
     402                                         false /* aDoSetError */,
     403                                         NULL) != VBOX_E_OBJECT_NOT_FOUND)
     404                {
     405                    throw setError(E_FAIL,
     406                                   tr("Trying to open a VM config '%s' which has the same UUID as an existing virtual machine"),
     407                                   mData->m_strConfigFile.c_str());
     408                }
     409
    398410                // use UUID from machine config
    399411                unconst(mData->mUuid) = mData->pMachineConfigFile->uuid;
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