VirtualBox

Ignore:
Timestamp:
Dec 13, 2018 6:58:16 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127481
Message:

Main: bugref:6913: Added generation of medium events

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r74804 r76215  
    1616 */
    1717
     18#include <set>
     19#include <map>
    1820#include "MachineImplCloneVM.h"
    1921
     
    730732                                          pMediumLockList,
    731733                                          NULL /* aProgress */,
    732                                           true /* aWait */);
     734                                          true /* aWait */,
     735                                          false /* aNotify */);
    733736        delete pMediumLockList;
    734737        if (FAILED(rc)) throw rc;
     
    10161019    RTCList<ComObjPtr<Medium> > newMedia;   /* All created images */
    10171020    RTCList<Utf8Str> newFiles;              /* All extra created files (save states, ...) */
     1021    std::set<ComObjPtr<Medium> > pMediumsForNotify;
     1022    std::map<Guid, DeviceType_T> uIdsForNotify;
    10181023    try
    10191024    {
     
    11531158                        /* diff image has to be used... */
    11541159                        pNewParent = pDiff;
     1160                        pMediumsForNotify.insert(pDiff->i_getParent());
     1161                        uIdsForNotify[pDiff->i_getId()] = pDiff->i_getDeviceType();
    11551162                    }
    11561163                    else
     
    12841291                                                   progress2.asOutParam(),
    12851292                                                   uSrcParentIdx,
    1286                                                    uTrgParentIdx);
     1293                                                   uTrgParentIdx,
     1294                                                   false /* aNotify */);
    12871295                        srcLock.acquire();
    12881296                        if (FAILED(rc)) throw rc;
     
    13181326                         * chain. */
    13191327                        pNewParent = pTarget;
     1328                        uIdsForNotify[pTarget->i_getId()] = pTarget->i_getDeviceType();
    13201329                    }
    13211330                }
     
    13561365                    /* diff image has to be used... */
    13571366                    pNewParent = pDiff;
     1367                    pMediumsForNotify.insert(pDiff->i_getParent());
     1368                    uIdsForNotify[pDiff->i_getId()] = pDiff->i_getDeviceType();
    13581369                }
    13591370                else
     
    15341545            const ComObjPtr<Medium> &pMedium = newMedia.at(i - 1);
    15351546            mrc = pMedium->i_deleteStorage(NULL /* aProgress */,
    1536                                            true /* aWait */);
     1547                                           true /* aWait */,
     1548                                           false /* aNotify */);
    15371549            pMedium->Close();
    15381550        }
     
    15461558        p->mParent->i_saveModifiedRegistries();
    15471559    }
     1560    else
     1561    {
     1562        for (std::map<Guid, DeviceType_T>::const_iterator it = uIdsForNotify.begin();
     1563             it != uIdsForNotify.end();
     1564             ++it)
     1565        {
     1566            p->mParent->i_onMediumRegistered(it->first, it->second, TRUE);
     1567        }
     1568        for (std::set<ComObjPtr<Medium> >::const_iterator it = pMediumsForNotify.begin();
     1569             it != pMediumsForNotify.end();
     1570             ++it)
     1571        {
     1572            if (it->isNotNull())
     1573                p->mParent->i_onMediumConfigChanged(*it);
     1574        }
     1575    }
    15481576
    15491577    return mrc;
Note: See TracChangeset for help on using the changeset viewer.

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