Changeset 64987 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 21, 2016 3:05:56 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r63582 r64987 504 504 bool fModifyCompact = false; 505 505 bool fModifyResize = false; 506 bool fModifyResizeMB = false; 506 507 bool fModifyLocation = false; 507 508 bool fModifyDescription = false; … … 591 592 cbResize = ValueUnion.u64 * _1M; 592 593 fModifyResize = true; 594 fModifyResizeMB = true; // do sanity check! 593 595 break; 594 596 … … 670 672 RTMsgError("Invalid medium reference, avoiding crash"); 671 673 return RTEXITCODE_FAILURE; 674 } 675 676 if ( fModifyResize 677 && fModifyResizeMB) 678 { 679 // Sanity check 680 // 681 // In general users should know what they do but in this case users have no 682 // alternative to VBoxManage. If happens that one wants to resize the disk 683 // and uses --resize and does not consider that this parameter expects the 684 // new medium size in MB not Byte. If the operation is started and then 685 // aborted by the user, the result is most likely a medium which doesn't 686 // work anymore. 687 LONG64 logicalSize; 688 pMedium->COMGETTER(LogicalSize)(&logicalSize); 689 if (cbResize > (uint64_t)logicalSize * _1M) 690 { 691 RTMsgError("Error: Attempt to resize the medium from %RU64.%RU64 MB to %RU64.%RU64 MB. Use --resizebyte is this is intended!\n", 692 logicalSize / _1M, (logicalSize % _1M) / (_1M / 10), cbResize / _1M, (cbResize % _1M) / (_1M / 10)); 693 return RTEXITCODE_FAILURE; 694 } 672 695 } 673 696
Note:
See TracChangeset
for help on using the changeset viewer.