Changeset 44029 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Dec 4, 2012 8:07:07 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 82453
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r43915 r44029 5628 5628 * be created for diff images. Only an overly smart user might 5629 5629 * manually create this case. Too bad for him. */ 5630 if ( isImport5630 if ( (isImport || fSetParentId) 5631 5631 && !(uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED)) 5632 5632 { … … 5638 5638 * MediumState_Inaccessible) */ 5639 5639 5640 Guid id = parentId;5641 5640 ComObjPtr<Medium> pParent; 5642 rc = m->pVirtualBox->findHardDiskById(id, false /* aSetError */, &pParent); 5641 if (RTUuidIsNull(&parentId)) 5642 rc = VBOX_E_OBJECT_NOT_FOUND; 5643 else 5644 rc = m->pVirtualBox->findHardDiskById(Guid(parentId), false /* aSetError */, &pParent); 5643 5645 if (FAILED(rc)) 5644 5646 { 5645 lastAccessError = Utf8StrFmt( 5646 tr("Parent medium with UUID {%RTuuid} of the medium '%s' is not found in the media registry ('%s')"), 5647 &parentId, location.c_str(), 5648 m->pVirtualBox->settingsFilePath().c_str()); 5649 throw S_OK; 5647 if (fSetImageId && !fSetParentId) 5648 { 5649 /* If the image UUID gets changed for an existing 5650 * image then the parent UUID can be stale. In such 5651 * cases clear the parent information. The parent 5652 * information may/will be re-set later if the 5653 * API client wants to adjust a complete medium 5654 * hierarchy one by one. */ 5655 rc = S_OK; 5656 alock.acquire(); 5657 RTUuidClear(&parentId); 5658 vrc = VDSetParentUuid(hdd, 0, &parentId); 5659 alock.release(); 5660 ComAssertRCThrow(vrc, E_FAIL); 5661 } 5662 else 5663 { 5664 lastAccessError = Utf8StrFmt(tr("Parent medium with UUID {%RTuuid} of the medium '%s' is not found in the media registry ('%s')"), 5665 &parentId, location.c_str(), 5666 m->pVirtualBox->settingsFilePath().c_str()); 5667 throw S_OK; 5668 } 5650 5669 } 5651 5670 … … 5653 5672 treeLock.acquire(); 5654 5673 5655 Assert(m->pParent.isNull());5656 m->pParent = pParent;5657 m->pParent->m->llChildren.push_back(this);5674 if (m->pParent) 5675 deparent(); 5676 setParent(pParent); 5658 5677 5659 5678 treeLock.release(); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r43907 r44029 1978 1978 return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", deviceType); 1979 1979 } 1980 1981 1980 1982 1981 if (pMedium.isNull())
Note:
See TracChangeset
for help on using the changeset viewer.