VirtualBox

Changeset 50736 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Mar 10, 2014 2:44:56 PM (11 years ago)
Author:
vboxsync
Message:

Main/Console: fixed error code if changing a medium / network attachment doesn't work for invalid VM state

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r50723 r50736  
    570570    HRESULT removeSharedFolder(const Utf8Str &strName);
    571571
    572     int suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
    573     void resumeAfterConfigChange(PUVM pUVM);
     572    HRESULT suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
     573    void    resumeAfterConfigChange(PUVM pUVM);
    574574
    575575    static DECLCALLBACK(int) configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r50723 r50736  
    35443544 *                          afterwards.
    35453545 */
    3546 int Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
     3546HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
    35473547{
    35483548    *pfResume = false;
     
    35693569            break;
    35703570        default:
    3571             return VERR_INVALID_STATE;
    3572     }
    3573 
    3574     return VINF_SUCCESS;
     3571            return setErrorInternal(VBOX_E_INVALID_VM_STATE,
     3572                                    COM_IIDOF(IConsole),
     3573                                    getStaticComponentName(),
     3574                                    Utf8StrFmt("Invalid state '%s' for changing medium",
     3575                                        VMR3GetStateName(enmVMState)),
     3576                                    false /*aWarning*/,
     3577                                    true /*aLogIt*/);
     3578    }
     3579
     3580    return S_OK;
    35753581}
    35763582
     
    36723678     */
    36733679    bool fResume = false;
    3674     int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
    3675     if (RT_FAILURE(vrc))
    3676         return vrc;
     3680    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
     3681    if (FAILED(rc))
     3682        return rc;
    36773683
    36783684    /*
     
    36823688     */
    36833689    PVMREQ pReq;
    3684     vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
    3685                        (PFNRT)changeRemovableMedium, 8,
    3686                        this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);
     3690    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
     3691                           (PFNRT)changeRemovableMedium, 8,
     3692                           this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);
    36873693
    36883694    /* release the lock before waiting for a result (EMT will call us back!) */
     
    38653871     */
    38663872    bool fResume = false;
    3867     int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
    3868     if (RT_FAILURE(vrc))
    3869         return vrc;
     3873    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
     3874    if (FAILED(rc))
     3875        return rc;
    38703876
    38713877    /*
     
    38753881     */
    38763882    PVMREQ pReq;
    3877     vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
    3878                        (PFNRT)attachStorageDevice, 8,
    3879                        this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);
     3883    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
     3884                           (PFNRT)attachStorageDevice, 8,
     3885                           this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);
    38803886
    38813887    /* release the lock before waiting for a result (EMT will call us back!) */
     
    40574063     */
    40584064    bool fResume = false;
    4059     int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
    4060     if (RT_FAILURE(vrc))
    4061         return vrc;
     4065    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
     4066    if (FAILED(rc))
     4067        return rc;
    40624068
    40634069    /*
     
    40674073     */
    40684074    PVMREQ pReq;
    4069     vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
    4070                        (PFNRT)detachStorageDevice, 7,
    4071                        this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);
     4075    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
     4076                           (PFNRT)detachStorageDevice, 7,
     4077                           this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);
    40724078
    40734079    /* release the lock before waiting for a result (EMT will call us back!) */
     
    44464452     */
    44474453    bool fResume = false;
    4448     int vrc = suspendBeforeConfigChange(pUVM, NULL, &fResume);
    4449     if (RT_FAILURE(vrc))
    4450         return vrc;
     4454    int rc = suspendBeforeConfigChange(pUVM, NULL, &fResume);
     4455    if (FAILED(rc))
     4456        return rc;
    44514457
    44524458    /*
     
    44564462     */
    44574463    PVMREQ pReq;
    4458     vrc = VMR3ReqCallU(pUVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
    4459                        (PFNRT)changeNetworkAttachment, 6,
    4460                        this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
     4464    int vrc = VMR3ReqCallU(pUVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
     4465                           (PFNRT)changeNetworkAttachment, 6,
     4466                           this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
    44614467
    44624468    if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc))
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