VirtualBox

Changeset 42017 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 4, 2012 9:19:44 AM (13 years ago)
Author:
vboxsync
Message:

Main/Machine: All attached devices will be detached automatically when a storage controller is removed from VM. Now this logic concentrated in the one place - function STDMETHODIMP Machine::RemoveStorageController.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r41347 r42017  
    10131013    if (fRemoveCtl)
    10141014    {
    1015         com::SafeIfaceArray<IMediumAttachment> mediumAttachments;
    1016 
    1017         CHECK_ERROR(machine,
    1018                      GetMediumAttachmentsOfController(Bstr(pszCtl).raw(),
    1019                                                       ComSafeArrayAsOutParam(mediumAttachments)));
    1020         for (size_t i = 0; i < mediumAttachments.size(); ++ i)
    1021         {
    1022             ComPtr<IMediumAttachment> mediumAttach = mediumAttachments[i];
    1023             LONG port = 0;
    1024             LONG device = 0;
    1025 
    1026             CHECK_ERROR(mediumAttach, COMGETTER(Port)(&port));
    1027             CHECK_ERROR(mediumAttach, COMGETTER(Device)(&device));
    1028             CHECK_ERROR(machine, DetachDevice(Bstr(pszCtl).raw(), port, device));
    1029         }
    1030 
    1031         if (SUCCEEDED(rc))
    1032             CHECK_ERROR(machine, RemoveStorageController(Bstr(pszCtl).raw()));
    1033         else
    1034             errorArgument("Can't detach the devices connected to '%s' Controller\n"
    1035                           "and thus its removal failed.", pszCtl);
     1015        CHECK_ERROR(machine, RemoveStorageController(Bstr(pszCtl).raw()));
    10361016    }
    10371017    else
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r41819 r42017  
    32763276        if (fSuccess && !controller.isNull())
    32773277        {
    3278             /* Remove storage attachments first: */
    3279             // TODO: Later, it will be possible to remove controller with all the attachments at one shot!
    3280             /* For each storage attachment: */
    3281             for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
    3282             {
    3283                 /* Get attachment cache: */
    3284                 const UICacheSettingsMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
    3285 
    3286                 /* Remove attachment if it was not just 'created': */
    3287                 if (!attachmentCache.wasCreated())
    3288                     fSuccess = removeStorageAttachment(controllerCache, attachmentCache);
    3289             }
    3290             /* Remove storage controller finally: */
    3291             if (fSuccess)
    3292             {
    3293                 m_machine.RemoveStorageController(strControllerName);
    3294                 /* Check that machine is OK: */
    3295                 fSuccess = m_machine.isOk();
    3296             }
     3278            /*remove controller with all the attachments at one shot*/
     3279            m_machine.RemoveStorageController(strControllerName);
     3280            /* Check that machine is OK: */
     3281            fSuccess = m_machine.isOk();
    32973282        }
    32983283    }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r41925 r42017  
    52025202    <method name="removeStorageController">
    52035203      <desc>
    5204         Removes a storage controller from the machine.
     5204        Removes a storage controller from the machine with all devices attache to one.
    52055205
    52065206        <result name="VBOX_E_OBJECT_NOT_FOUND">
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