VirtualBox

Changeset 30956 in vbox


Ignore:
Timestamp:
Jul 21, 2010 12:59:12 PM (14 years ago)
Author:
vboxsync
Message:

Main: move VirtualBox::UnregisterMachine() to Machine::Unregister(); rename Machine::DeleteSettings() to Machine::Delete()

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r30929 r30956  
    159159    if (machine)
    160160    {
    161         Bstr uuid;
    162         machine->COMGETTER(Id)(uuid.asOutParam());
    163         machine = NULL;
    164161        SafeArray<BSTR> abstrFiles;
    165         CHECK_ERROR(a->virtualBox, UnregisterMachine(uuid,
    166                                                      false /* fDetachMedia */,
    167                                                      ComSafeArrayAsOutParam(abstrFiles),
    168                                                      machine.asOutParam()));
    169         if (SUCCEEDED(rc) && machine && fDelete)
    170             CHECK_ERROR(machine, DeleteSettings());
     162        CHECK_ERROR(machine, Unregister(false /* fDetachMedia */,
     163                                        ComSafeArrayAsOutParam(abstrFiles)));
     164        if (SUCCEEDED(rc) && fDelete)
     165            CHECK_ERROR(machine, Delete());
    171166    }
    172167    return SUCCEEDED(rc) ? 0 : 1;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp

    r30022 r30956  
    790790}
    791791
    792 void VBoxProblemReporter::cannotDeleteMachine (const CVirtualBox &vbox,
    793                                                const CMachine &machine)
     792void VBoxProblemReporter::cannotDeleteMachine(const CMachine &machine)
    794793{
    795794    /* preserve the current error info before calling the object again */
    796795    COMResult res (machine);
    797796
    798     message (mainWindowShown(), Error,
    799         tr ("Failed to remove the virtual machine <b>%1</b>.")
    800             .arg (machine.GetName()),
    801         !vbox.isOk() ? formatErrorInfo (vbox) : formatErrorInfo (res));
     797    message(mainWindowShown(),
     798            Error,
     799            tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
     800            !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
    802801}
    803802
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r28846 r30956  
    204204    void cannotStopMachine (const CConsole &console);
    205205    void cannotStopMachine (const CProgress &progress);
    206     void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
     206    void cannotDeleteMachine (const CMachine &machine);
    207207    void cannotDiscardSavedState (const CConsole &console);
    208208
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp

    r30929 r30956  
    679679        if (ok)
    680680        {
    681             QVector<QString> files;
    682             CMachine machine;
    683             vbox.UnregisterMachine(id, false /*fDetachMedia*/, files, machine);
    684             if (vbox.isOk() && item->accessible())
     681            CMachine machine = item->machine();
     682            QVector<QString> files = machine.Unregister(false /*fDetachMedia*/);
     683            if (machine.isOk() && item->accessible())
    685684            {
    686685                /* delete machine settings */
    687                 machine.DeleteSettings();
     686                machine.Delete();
    688687                /* remove the item shortly: cmachine it refers to is no longer valid! */
    689688                int row = mVMModel->rowById (item->id());
     
    692691                mVMListView->ensureSomeRowSelected (row);
    693692            }
    694             if (!vbox.isOk() || !machine.isOk())
    695                 vboxProblem().cannotDeleteMachine (vbox, machine);
     693            if (!machine.isOk())
     694                vboxProblem().cannotDeleteMachine(machine);
    696695        }
    697696    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r30929 r30956  
    782782        {
    783783            /* Unregister on failure */
    784             QVector<QString> files;
    785             CMachine machine;
    786             vbox.UnregisterMachine(machineId, false /*fDetachMedia*/, files, machine);
     784            QVector<QString> files = m_Machine.Unregister(false /*fDetachMedia*/);
    787785            if (vbox.isOk())
    788                 m_Machine.DeleteSettings();
     786                m_Machine.Delete();
    789787            return false;
    790788        }
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r30929 r30956  
    12681268            ComPtr<IMachine> failedMachine;
    12691269            SafeArray<BSTR> abstrPaths;
    1270             rc2 = mVirtualBox->UnregisterMachine(bstrGuid, false, ComSafeArrayAsOutParam(abstrPaths), failedMachine.asOutParam());
     1270            rc2 = mVirtualBox->GetMachine(bstrGuid, failedMachine.asOutParam());
    12711271            if (SUCCEEDED(rc2))
    1272                 rc2 = failedMachine->DeleteSettings();
     1272            {
     1273                rc2 = failedMachine->Unregister(false, ComSafeArrayAsOutParam(abstrPaths));
     1274                rc2 = failedMachine->Delete();
     1275            }
    12731276        }
    12741277    }
  • trunk/src/VBox/Main/MachineImpl.cpp

    r30940 r30956  
    36873687}
    36883688
    3689 STDMETHODIMP Machine::DeleteSettings()
     3689/** @note Locks objects! */
     3690STDMETHODIMP Machine::Unregister(BOOL fCloseMedia,
     3691                                 ComSafeArrayOut(BSTR, aFiles))
     3692{
     3693    AutoCaller autoCaller(this);
     3694    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     3695
     3696    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     3697
     3698    MediaList llMedia;
     3699    if (mData->mSession.mState != SessionState_Closed)
     3700        return setError(VBOX_E_INVALID_OBJECT_STATE,
     3701                        tr("Cannot unregister the machine '%ls' because it has an open session"),
     3702                           mUserData->mName.raw());
     3703
     3704    // @todo optionally discard saved state
     3705    if (mData->mMachineState == MachineState_Saved)
     3706        return setError(VBOX_E_INVALID_VM_STATE,
     3707                        tr("Cannot unregister the machine '%ls' because it is in the Saved state"),
     3708                           mUserData->mName.raw());
     3709
     3710    // @todo optionally nuke snapshots
     3711    size_t snapshotCount = 0;
     3712    if (mData->mFirstSnapshot)
     3713        snapshotCount = mData->mFirstSnapshot->getAllChildrenCount() + 1;
     3714    if (snapshotCount)
     3715        return setError(VBOX_E_INVALID_OBJECT_STATE,
     3716                        tr("Cannot unregister the machine '%ls' because it has %d snapshots"),
     3717                           mUserData->mName.raw(), snapshotCount);
     3718
     3719    if (    !mMediaData.isNull()      // can be NULL if machine is inaccessible
     3720         && mMediaData->mAttachments.size()
     3721       )
     3722    {
     3723        // we have media attachments:
     3724        if (fCloseMedia)
     3725        {
     3726            // caller wants automatic detachment: then do that and report all media to the array
     3727
     3728            // make a temporary list because detachDevice invalidates iterators into
     3729            // mMediaData->mAttachments
     3730            MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
     3731
     3732            for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
     3733                 it != llAttachments2.end();
     3734                 ++it)
     3735            {
     3736                ComObjPtr<MediumAttachment> pAttach = *it;
     3737                ComObjPtr<Medium> pMedium = pAttach->getMedium();
     3738
     3739                if (!pMedium.isNull())
     3740                    llMedia.push_back(pMedium);
     3741
     3742                detachDevice(pAttach,
     3743                             alock,
     3744                             NULL /* pfNeedsSaveSettings */);
     3745            };
     3746        }
     3747        else
     3748            return setError(VBOX_E_INVALID_OBJECT_STATE,
     3749                            tr("Cannot unregister the machine '%ls' because it has %d media attachments"),
     3750                               mMediaData->mAttachments.size());
     3751    }
     3752
     3753    // commit all the media changes made above
     3754    commitMedia();
     3755
     3756    mData->mRegistered = false;
     3757
     3758    // machine lock no longer needed
     3759    alock.release();
     3760
     3761    if (fCloseMedia)
     3762    {
     3763        // now go thru the list of attached media reported by prepareUnregister() and close them all
     3764        SafeArray<BSTR> sfaFiles(llMedia.size());
     3765        size_t u = 0;
     3766        for (MediaList::const_iterator it = llMedia.begin();
     3767             it != llMedia.end();
     3768             ++it)
     3769        {
     3770            ComObjPtr<Medium> pMedium = *it;
     3771            Bstr bstrFile = pMedium->getLocationFull();
     3772
     3773            AutoCaller autoCaller2(pMedium);
     3774            if (FAILED(autoCaller2.rc())) return autoCaller2.rc();
     3775
     3776            pMedium->close(NULL /*fNeedsSaveSettings*/,     // we'll call saveSettings() in any case below
     3777                           autoCaller2);
     3778                // this uninitializes the medium
     3779
     3780            // report the path to the caller
     3781            bstrFile.detachTo(&sfaFiles[u]);
     3782            ++u;
     3783        }
     3784        // report all paths to the caller
     3785        sfaFiles.detachTo(ComSafeArrayOutArg(aFiles));
     3786    }
     3787
     3788    mParent->unregisterMachine(this);
     3789
     3790    return S_OK;
     3791}
     3792
     3793STDMETHODIMP Machine::Delete()
    36903794{
    36913795    AutoCaller autoCaller(this);
     
    59436047
    59446048    return rc;
    5945 }
    5946 
    5947 /**
    5948  * Called from VirtualBox::UnregisterMachine() with the flags given there to
    5949  * give the machine a chance to clean up for itself.
    5950  * @param fDetachMedia As passed to VirtualBox::UnregisterMachine(). If true, all
    5951  *                     media are detached from the machine and its snapshots.
    5952  * @param llFiles
    5953  * @return
    5954  */
    5955 HRESULT Machine::prepareUnregister(bool fCloseMedia,
    5956                                    MediaList &llMedia)
    5957 {
    5958     AutoLimitedCaller autoCaller(this);
    5959     AssertComRCReturnRC(autoCaller.rc());
    5960 
    5961     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    5962 
    5963     if (mData->mSession.mState != SessionState_Closed)
    5964         return setError(VBOX_E_INVALID_OBJECT_STATE,
    5965                         tr("Cannot unregister the machine '%ls' because it has an open session"),
    5966                         mUserData->mName.raw());
    5967 
    5968     // @todo optionally discard saved state
    5969     if (mData->mMachineState == MachineState_Saved)
    5970         return setError(VBOX_E_INVALID_VM_STATE,
    5971                         tr("Cannot unregister the machine '%ls' because it is in the Saved state"),
    5972                         mUserData->mName.raw());
    5973 
    5974     // @todo optionally nuke snapshots
    5975     size_t snapshotCount = 0;
    5976     if (mData->mFirstSnapshot)
    5977         snapshotCount = mData->mFirstSnapshot->getAllChildrenCount() + 1;
    5978     if (snapshotCount)
    5979         return setError(VBOX_E_INVALID_OBJECT_STATE,
    5980                         tr("Cannot unregister the machine '%ls' because it has %d snapshots"),
    5981                         mUserData->mName.raw(), snapshotCount);
    5982 
    5983     if (    !mMediaData.isNull()      // can be NULL if machine is inaccessible
    5984          && mMediaData->mAttachments.size()
    5985        )
    5986     {
    5987         // we have media attachments:
    5988         if (fCloseMedia)
    5989         {
    5990             // caller wants automatic detachment: then do that and report all media to the array
    5991 
    5992             // make a temporary list because detachDevice invalidates iterators into
    5993             // mMediaData->mAttachments
    5994             MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
    5995 
    5996             for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
    5997                  it != llAttachments2.end();
    5998                  ++it)
    5999             {
    6000                 ComObjPtr<MediumAttachment> pAttach = *it;
    6001                 ComObjPtr<Medium> pMedium = pAttach->getMedium();
    6002 
    6003                 if (!pMedium.isNull())
    6004                     llMedia.push_back(pMedium);
    6005 
    6006                 detachDevice(pAttach,
    6007                              alock,
    6008                              NULL /* pfNeedsSaveSettings */);
    6009             };
    6010         }
    6011         else
    6012             return setError(VBOX_E_INVALID_OBJECT_STATE,
    6013                             tr("Cannot unregister the machine '%ls' because it has %d media attachments"),
    6014                                mMediaData->mAttachments.size());
    6015     }
    6016 
    6017     // commit all the media changes made above
    6018     commitMedia();
    6019 
    6020     mData->mRegistered = false;
    6021 
    6022     return S_OK;
    60236049}
    60246050
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30950 r30956  
    13691369}
    13701370
    1371 /** @note Locks objects! */
    1372 STDMETHODIMP VirtualBox::UnregisterMachine(IN_BSTR aId,
    1373                                            BOOL fCloseMedia,
    1374                                            ComSafeArrayOut(BSTR, aFiles),
    1375                                            IMachine **aMachine)
    1376 {
    1377     Guid id(aId);
    1378     if (id.isEmpty())
    1379         return E_INVALIDARG;
    1380 
    1381     AutoCaller autoCaller(this);
    1382     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1383 
    1384     // find machine from the given ID
    1385     ComObjPtr<Machine> pMachine;
    1386     HRESULT rc = findMachine(id,
    1387                              true /* fPermitInaccessible */,
    1388                              true /* setError */,
    1389                              &pMachine);
    1390     if (FAILED(rc)) return rc;
    1391 
    1392     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    1393 
    1394     MediaList llMedia;
    1395     rc = pMachine->prepareUnregister(fCloseMedia, llMedia);
    1396     if (FAILED(rc)) return rc;
    1397 
    1398     // remove from the collection of registered machines
    1399     m->allMachines.removeChild(pMachine);
    1400 
    1401     if (fCloseMedia)
    1402     {
    1403         // now go thru the list of attached media reported by prepareUnregister() and close them all
    1404         SafeArray<BSTR> sfaFiles(llMedia.size());
    1405         size_t u = 0;
    1406         for (MediaList::const_iterator it = llMedia.begin();
    1407              it != llMedia.end();
    1408              ++it)
    1409         {
    1410             ComObjPtr<Medium> pMedium = *it;
    1411             Bstr bstrFile = pMedium->getLocationFull();
    1412 
    1413             AutoCaller autoCaller2(pMedium);
    1414             if (FAILED(autoCaller2.rc())) return autoCaller2.rc();
    1415 
    1416             pMedium->close(NULL /*fNeedsSaveSettings*/,     // we'll call saveSettings() in any case below
    1417                            autoCaller2);
    1418                 // this uninitializes the medium
    1419 
    1420             // report the path to the caller
    1421             bstrFile.detachTo(&sfaFiles[u]);
    1422             ++u;
    1423         }
    1424         // report all paths to the caller
    1425         sfaFiles.detachTo(ComSafeArrayOutArg(aFiles));
    1426     }
    1427 
    1428     // save the global registry
    1429     rc = saveSettings();
    1430 
    1431     alock.release();
    1432 
    1433     /* return the unregistered machine to the caller */
    1434     pMachine.queryInterfaceTo(aMachine);
    1435 
    1436     /* fire an event */
    1437     onMachineRegistered(id, FALSE);
    1438 
    1439     return rc;
    1440 }
    1441 
    14421371STDMETHODIMP VirtualBox::CreateHardDisk(IN_BSTR aFormat,
    14431372                                        IN_BSTR aLocation,
     
    38233752    if (pfNeedsSaveSettings)
    38243753        *pfNeedsSaveSettings = true;
     3754
     3755    return rc;
     3756}
     3757
     3758/**
     3759 * Removes the given machine object from the internal list of registered machines.
     3760 * Called from Machine::Unregister().
     3761 * @param pMachine
     3762 * @return
     3763 */
     3764HRESULT VirtualBox::unregisterMachine(Machine *pMachine)
     3765{
     3766    const Guid &id = pMachine->getId();
     3767
     3768    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     3769
     3770    // remove from the collection of registered machines
     3771    m->allMachines.removeChild(pMachine);
     3772
     3773    // save the global registry
     3774    HRESULT rc = saveSettings();
     3775
     3776    alock.release();
     3777
     3778    /* fire an event */
     3779    onMachineRegistered(id, FALSE);
    38253780
    38263781    return rc;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r30929 r30956  
    11051105  <interface
    11061106     name="IVirtualBoxErrorInfo" extends="$errorinfo"
    1107      uuid="4b86d186-407e-4f9e-8be8-e50061be8725"
     1107     uuid="e053d3c0-f493-491b-a735-3a9f0b1feed4"
    11081108     supportsErrorInfo="no"
    11091109     wsmap="managed"
     
    17061706      <param name="name" type="wstring" dir="in"/>
    17071707      <param name="machine" type="IMachine" dir="return"/>
    1708     </method>
    1709 
    1710     <method name="unregisterMachine">
    1711       <desc>
    1712         Unregisters the machine previously registered using
    1713         <link to="#registerMachine"/>. After successful method invocation, the
    1714         <link to="IMachineRegisteredEvent"/> event is fired.
    1715 
    1716         <note>
    1717           The specified machine must not be in the Saved state, have an open
    1718           (or a spawning) direct session associated with it, have snapshots or
    1719           have any medium attached.
    1720         </note>
    1721 
    1722         <note>
    1723           This method implicitly calls <link to="IMachine::saveSettings"/> to
    1724           save all current machine settings before unregistering it.
    1725         </note>
    1726 
    1727         <note>
    1728           If the given machine is inaccessible (see
    1729           <link to="IMachine::accessible"/>), it will be unregistered and
    1730           fully uninitialized right afterwards. As a result, the returned
    1731           machine object will be unusable and an attempt to call
    1732           <b>any</b> method will return the "Object not ready" error.
    1733         </note>
    1734 
    1735         <result name="VBOX_E_OBJECT_NOT_FOUND">
    1736           Could not find registered machine matching @a id.
    1737         </result>
    1738         <result name="VBOX_E_INVALID_VM_STATE">
    1739           Machine is in Saved state.
    1740         </result>
    1741         <result name="VBOX_E_INVALID_OBJECT_STATE">
    1742           Machine has snapshot or open session or medium attached.
    1743         </result>
    1744       </desc>
    1745 
    1746       <param name="id" type="uuid" mod="string" dir="in">
    1747         <desc>UUID of the machine to unregister.</desc>
    1748       </param>
    1749       <param name="fCloseMedia" type="boolean" dir="in">
    1750         <desc>If true, the method will automatically detach all media from the
    1751           machine and its snapshots, call <link to="IMedium::close" /> on each
    1752           medium, and the paths of all media files involved will be reported to
    1753           the caller in the @a aFiles array so the caller can then delete the
    1754           image files.
    1755           If false, the method will fail if media attachments are present.</desc>
    1756       </param>
    1757       <param name="aFiles" type="wstring" safearray="yes" dir="out">
    1758         <desc>
    1759           List of all files detached from medium attachments of the machine, if
    1760           @a fDetachMedia is true.
    1761         </desc>
    1762       </param>
    1763       <param name="machine" type="IMachine" dir="out">
    1764         <desc>Unregistered machine object.</desc>
    1765       </param>
    17661708    </method>
    17671709
     
    39263868  <interface
    39273869     name="IMachine" extends="$unknown"
    3928      uuid="6d9212cb-a5c0-48b7-bbc1-3fa2ba2ee6d2"
     3870     uuid="276e0f43-889b-4b87-b05f-35f1db814700"
    39293871     wsmap="managed"
    39303872     >
     
    39983940        The only possible action you can perform on an inaccessible
    39993941        machine is to unregister it using the
    4000         <link to="IVirtualBox::unregisterMachine"/> call (or, to check
     3942        <link to="#unregisterMachine"/> call (or, to check
    40013943        for the accessibility state once more by querying this
    40023944        property).
     
    42694211          by <link to="IVirtualBox::openMachine"/> but not
    42704212          yet registered, or on unregistered machines after calling
    4271           <link to="IVirtualBox::unregisterMachine"/>. For all other
     4213          <link to="#unregisterMachine"/>. For all other
    42724214          cases, the settings can never be modified.
    42734215        </note>
     
    52285170          created by <link to="IVirtualBox::createMachine"/> but not
    52295171          yet registered, or on unregistered machines after calling
    5230           <link to="IVirtualBox::unregisterMachine"/>.
     5172          <link to="#unregisterMachine"/>.
    52315173        </note>
    52325174
     
    52555197          opened by <link to="IVirtualBox::openMachine"/> but not
    52565198          yet registered, or on unregistered machines after calling
    5257           <link to="IVirtualBox::unregisterMachine"/>.
     5199          <link to="#unregisterMachine"/>.
    52585200        </note>
    52595201
     
    52655207    </method>
    52665208
    5267     <method name="deleteSettings">
    5268       <desc>
    5269         Deletes the settings file of this machine from disk.
    5270         The machine must not be registered in order for this operation
    5271         to succeed.
     5209    <method name="unregister">
     5210      <desc>
     5211        Unregisters the machine, which must have been previously registered using
     5212        <link to="IVirtualBox::registerMachine"/>. After successful method invocation,
     5213        the <link to="IMachineRegisteredEvent"/> event is fired.
     5214
     5215        <note>
     5216          The specified machine must not be in the Saved state nor have an open
     5217          (or a spawning) direct session associated with it.
     5218        </note>
     5219
     5220        <note>
     5221          This method implicitly calls <link to="#saveSettings"/> to
     5222          save all current machine settings before unregistering it.
     5223        </note>
     5224
     5225        <note>
     5226          If the given machine is inaccessible (see <link to="#accessible"/>), it
     5227          will be unregistered and fully uninitialized right afterwards. As a result,
     5228          the returned machine object will be unusable and an attempt to call
     5229          <b>any</b> method will return the "Object not ready" error.
     5230        </note>
     5231
     5232        <result name="VBOX_E_OBJECT_NOT_FOUND">
     5233          Could not find registered machine matching @a id.
     5234        </result>
     5235        <result name="VBOX_E_INVALID_VM_STATE">
     5236          Machine is in Saved state.
     5237        </result>
     5238        <result name="VBOX_E_INVALID_OBJECT_STATE">
     5239          Machine has snapshot or open session or medium attached.
     5240        </result>
     5241      </desc>
     5242
     5243      <param name="fCloseMedia" type="boolean" dir="in">
     5244        <desc>If true, the method will automatically detach all media from the
     5245          machine and its snapshots, call <link to="IMedium::close" /> on each
     5246          medium, and the paths of all media files involved will be reported to
     5247          the caller in the @a aFiles array so the caller can then delete the
     5248          image files.
     5249          If false, the method will fail if media attachments are present.</desc>
     5250      </param>
     5251      <param name="aFiles" type="wstring" safearray="yes" dir="return">
     5252        <desc>
     5253          List of all files detached from medium attachments of the machine, if
     5254          @a fCloseMedia is true.
     5255        </desc>
     5256      </param>
     5257    </method>
     5258
     5259    <method name="delete">
     5260      <desc>
     5261        Deletes the settings (machine XML) file of this machine from disk. The machine
     5262        must not be registered in order for this operation to succeed.
    52725263        <note>
    52735264          <link to="#settingsModified"/> will return @c true after this
     
    52805271          opened by <link to="IVirtualBox::openMachine"/> but not
    52815272          yet registered, or on unregistered machines after calling
    5282           <link to="IVirtualBox::unregisterMachine"/>.
     5273          <link to="#unregisterMachine"/>.
    52835274        </note>
    52845275        <note>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r30940 r30956  
    481481    STDMETHOD(SaveSettings)();
    482482    STDMETHOD(DiscardSettings)();
    483     STDMETHOD(DeleteSettings)();
     483    STDMETHOD(Unregister) (BOOL fCloseMedia, ComSafeArrayOut(BSTR, aFiles));
     484    STDMETHOD(Delete)();
    484485    STDMETHOD(Export)(IAppliance *aAppliance, IVirtualSystemDescription **aDescription);
    485486    STDMETHOD(GetSnapshot)(IN_BSTR aId, ISnapshot **aSnapshot);
     
    683684
    684685    HRESULT prepareRegister();
    685     HRESULT prepareUnregister(bool fDetachMedia, MediaList &llMedia);
    686686
    687687    HRESULT getSharedFolder(CBSTR aName,
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r30938 r30956  
    128128    STDMETHOD(GetMachine) (IN_BSTR aId, IMachine **aMachine);
    129129    STDMETHOD(FindMachine) (IN_BSTR aName, IMachine **aMachine);
    130     STDMETHOD(UnregisterMachine) (IN_BSTR aId, BOOL fCloseMedia, ComSafeArrayOut(BSTR, aFiles), IMachine **aMachine);
    131130    STDMETHOD(CreateAppliance) (IAppliance **anAppliance);
    132131
     
    264263    HRESULT unregisterImage(Medium *aImage, DeviceType_T argType, bool *pfNeedsSaveSettings);
    265264
     265    HRESULT unregisterMachine(Machine *pMachine);
     266
    266267    void rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
    267268                                           const Utf8Str &strNewConfigDir);
     
    288289                                    Utf8Str &aConflictType);
    289290
    290     HRESULT registerMachine (Machine *aMachine);
     291    HRESULT registerMachine(Machine *aMachine);
    291292
    292293    HRESULT registerDHCPServer(DHCPServer *aDHCPServer,
  • trunk/src/VBox/Main/testcase/tstOVF.cpp

    r30931 r30956  
    350350            RTPrintf("  Deleting machine %ls...\n", bstrUUID.raw());
    351351            SafeArray<BSTR> sfaFiles;
    352             rc = pVirtualBox->UnregisterMachine(bstrUUID,
    353                                                 true /* fDetachMedia */,
    354                                                 ComSafeArrayAsOutParam(sfaFiles),
    355                                                 pMachine.asOutParam());
    356             if (FAILED(rc)) throw MyError(rc, "VirtualBox::UnregisterMachine() failed\n");
     352            rc = pMachine->Unregister(true /* fDetachMedia */,
     353                                      ComSafeArrayAsOutParam(sfaFiles));
     354            if (FAILED(rc)) throw MyError(rc, "Machine::Unregister() failed\n");
    357355
    358356            for (size_t u = 0;
     
    364362            }
    365363
    366             rc = pMachine->DeleteSettings();
     364            rc = pMachine->Delete();
    367365            if (FAILED(rc)) throw MyError(rc, "Machine::DeleteSettings() failed\n");
    368366        }
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