- Timestamp:
- Jul 7, 2011 3:29:03 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37817 r37824 467 467 " [--passthrough on|off]\n" 468 468 " [--tempeject on|off]\n" 469 " [--nonrotational on|off]\n" 469 470 " [--bandwidthgroup <name>]\n" 470 471 " [--forceunmount]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r37709 r37824 53 53 { "--passthrough", 'h', RTGETOPT_REQ_STRING }, 54 54 { "--tempeject", 'e', RTGETOPT_REQ_STRING }, 55 { "--nonrotational", 'n', RTGETOPT_REQ_STRING }, 55 56 { "--bandwidthgroup", 'b', RTGETOPT_REQ_STRING }, 56 57 { "--forceunmount", 'f', RTGETOPT_REQ_NOTHING }, … … 86 87 const char *pszPassThrough = NULL; 87 88 const char *pszTempEject = NULL; 89 const char *pszNonRotational = NULL; 88 90 const char *pszBandwidthGroup = NULL; 89 91 Bstr bstrNewUuid; … … 178 180 } 179 181 182 case 'n': // nonrotational <on|off> 183 { 184 if (ValueUnion.psz) 185 pszNonRotational = ValueUnion.psz; 186 else 187 rc = E_FAIL; 188 break; 189 } 190 180 191 case 'b': // bandwidthgroup <name> 181 192 { … … 410 421 if (ctlType == StorageControllerType_I82078) // floppy controller 411 422 devTypeRequested = DeviceType_Floppy; 412 else if (pszMedium)423 else 413 424 { 414 425 /* … … 428 439 mediumAttachment->COMGETTER(Type)(&deviceType); 429 440 430 ComPtr<IMedium> pExistingMedium; 431 rc = findMedium(a, pszMedium, deviceType, true /* fSilent */, 432 pExistingMedium); 433 if (SUCCEEDED(rc) && pExistingMedium) 441 if (pszMedium) 434 442 { 435 if ( (deviceType == DeviceType_DVD) 436 || (deviceType == DeviceType_HardDisk) 437 ) 438 devTypeRequested = deviceType; 443 ComPtr<IMedium> pExistingMedium; 444 rc = findMedium(a, pszMedium, deviceType, true /* fSilent */, 445 pExistingMedium); 446 if (SUCCEEDED(rc) && pExistingMedium) 447 { 448 if ( (deviceType == DeviceType_DVD) 449 || (deviceType == DeviceType_HardDisk) 450 ) 451 devTypeRequested = deviceType; 452 } 439 453 } 454 else 455 devTypeRequested = deviceType; 440 456 } 441 457 } 442 /* for all other cases lets ask the user what type of drive it is */443 458 } 444 459 … … 573 588 else 574 589 { 575 Bstr bstrMedium(pszMedium); 576 if (bstrMedium.isEmpty()) 577 throw Utf8Str("Missing --medium argument"); 578 579 rc = findOrOpenMedium(a, pszMedium, devTypeRequested, 580 pMedium2Mount, fSetNewUuid, NULL); 581 if (FAILED(rc) || !pMedium2Mount) 582 throw Utf8StrFmt("Invalid UUID or filename \"%s\"", pszMedium); 590 if (!pszMedium) 591 { 592 ComPtr<IMediumAttachment> mediumAttachment; 593 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), port, 594 device, 595 mediumAttachment.asOutParam()); 596 if (FAILED(rc)) 597 throw Utf8Str("Missing --medium argument"); 598 } 599 else 600 { 601 Bstr bstrMedium(pszMedium); 602 rc = findOrOpenMedium(a, pszMedium, devTypeRequested, 603 pMedium2Mount, fSetNewUuid, NULL); 604 if (FAILED(rc) || !pMedium2Mount) 605 throw Utf8StrFmt("Invalid UUID or filename \"%s\"", pszMedium); 606 } 583 607 } 584 608 585 609 // set medium/parent medium UUID, if so desired 586 if ( fSetNewUuid || fSetNewParentUuid)610 if (pMedium2Mount && (fSetNewUuid || fSetNewParentUuid)) 587 611 { 588 612 CHECK_ERROR(pMedium2Mount, SetIDs(fSetNewUuid, bstrNewUuid.raw(), … … 605 629 } 606 630 607 switch (devTypeRequested)608 { 609 case DeviceType_DVD:610 case DeviceType_Floppy:611 {612 if (!fRunTime)631 if (pszMedium) 632 { 633 switch (devTypeRequested) 634 { 635 case DeviceType_DVD: 636 case DeviceType_Floppy: 613 637 { 614 ComPtr<IMediumAttachment> mediumAttachment; 615 // check if there is a dvd/floppy drive at the given location, if not attach one first 616 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), 617 port, 618 device, 619 mediumAttachment.asOutParam()); 620 if (SUCCEEDED(rc)) 638 if (!fRunTime) 621 639 { 622 DeviceType_T deviceType; 623 mediumAttachment->COMGETTER(Type)(&deviceType); 624 if (deviceType != devTypeRequested) 640 ComPtr<IMediumAttachment> mediumAttachment; 641 // check if there is a dvd/floppy drive at the given location, if not attach one first 642 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), 643 port, 644 device, 645 mediumAttachment.asOutParam()); 646 if (SUCCEEDED(rc)) 625 647 { 626 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 648 DeviceType_T deviceType; 649 mediumAttachment->COMGETTER(Type)(&deviceType); 650 if (deviceType != devTypeRequested) 651 { 652 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 653 rc = machine->AttachDevice(Bstr(pszCtl).raw(), 654 port, 655 device, 656 devTypeRequested, // DeviceType_DVD or DeviceType_Floppy 657 NULL); 658 } 659 } 660 else 661 { 627 662 rc = machine->AttachDevice(Bstr(pszCtl).raw(), 628 663 port, … … 632 667 } 633 668 } 634 else 669 670 if (pMedium2Mount) 635 671 { 636 rc = machine->AttachDevice(Bstr(pszCtl).raw(),637 port,638 device,639 devTypeRequested, // DeviceType_DVD or DeviceType_Floppy640 NULL);672 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl).raw(), 673 port, 674 device, 675 pMedium2Mount, 676 fForceUnmount)); 641 677 } 678 } // end DeviceType_DVD or DeviceType_Floppy: 679 break; 680 681 case DeviceType_HardDisk: 682 { 683 // if there is anything attached at the given location, remove it 684 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 685 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl).raw(), 686 port, 687 device, 688 DeviceType_HardDisk, 689 pMedium2Mount)); 642 690 } 643 644 if (pMedium2Mount) 645 { 646 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl).raw(), 647 port, 648 device, 649 pMedium2Mount, 650 fForceUnmount)); 651 } 652 } // end DeviceType_DVD or DeviceType_Floppy: 653 break; 654 655 case DeviceType_HardDisk: 656 { 657 // if there is anything attached at the given location, remove it 658 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 659 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl).raw(), 660 port, 661 device, 662 DeviceType_HardDisk, 663 pMedium2Mount)); 664 } 665 break; 691 break; 692 } 666 693 } 667 694 } … … 714 741 else 715 742 throw Utf8StrFmt("Invalid --tempeject argument '%s'", pszTempEject); 743 } 744 else 745 throw Utf8StrFmt("Couldn't find the controller attachment for the controller '%s'\n", pszCtl); 746 } 747 748 if ( pszNonRotational 749 && (SUCCEEDED(rc))) 750 { 751 ComPtr<IMediumAttachment> mattach; 752 CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl).raw(), port, 753 device, mattach.asOutParam())); 754 755 if (SUCCEEDED(rc)) 756 { 757 if (!RTStrICmp(pszNonRotational, "on")) 758 { 759 CHECK_ERROR(machine, NonRotationalDevice(Bstr(pszCtl).raw(), 760 port, device, TRUE)); 761 } 762 else if (!RTStrICmp(pszNonRotational, "off")) 763 { 764 CHECK_ERROR(machine, NonRotationalDevice(Bstr(pszCtl).raw(), 765 port, device, FALSE)); 766 } 767 else 768 throw Utf8StrFmt("Invalid --nonrotational argument '%s'", pszNonRotational); 716 769 } 717 770 else -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r37710 r37824 552 552 , mAttIsPassthrough (false) 553 553 , mAttIsTempEject (false) 554 , mAttIsNonRotational (false) 554 555 { 555 556 /* Check for proper parent type */ … … 610 611 } 611 612 613 bool AttachmentItem::attIsNonRotational() const 614 { 615 return mAttIsNonRotational; 616 } 617 612 618 void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot) 613 619 { … … 635 641 { 636 642 mAttIsTempEject = aIsAttTempEject; 643 } 644 645 void AttachmentItem::setAttIsNonRotational (bool aIsAttNonRotational) 646 { 647 mAttIsNonRotational = aIsAttNonRotational; 637 648 } 638 649 … … 1096 1107 return false; 1097 1108 } 1109 case R_AttIsNonRotational: 1110 { 1111 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1112 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1113 return static_cast <AttachmentItem*> (item)->attIsNonRotational(); 1114 return false; 1115 } 1098 1116 case R_AttSize: 1099 1117 { … … 1311 1329 { 1312 1330 static_cast <AttachmentItem*> (item)->setAttIsTempEject (aValue.toBool()); 1331 emit dataChanged (aIndex, aIndex); 1332 return true; 1333 } 1334 return false; 1335 } 1336 case R_AttIsNonRotational: 1337 { 1338 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1339 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1340 { 1341 static_cast <AttachmentItem*> (item)->setAttIsNonRotational (aValue.toBool()); 1313 1342 emit dataChanged (aIndex, aIndex); 1314 1343 return true; … … 1801 1830 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1802 1831 connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1832 connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1803 1833 1804 1834 /* Applying language settings */ … … 1865 1895 storageAttachmentData.m_fAttachmentPassthrough = attachment.GetPassthrough(); 1866 1896 storageAttachmentData.m_fAttachmentTempEject = attachment.GetTemporaryEject(); 1897 storageAttachmentData.m_fAttachmentNonRotational = attachment.GetNonRotational(); 1867 1898 CMedium comMedium(attachment.GetMedium()); 1868 1899 VBoxMedium vboxMedium; … … 1925 1956 mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough); 1926 1957 mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject); 1958 mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational); 1927 1959 } 1928 1960 } … … 1977 2009 attachmentData.m_fAttachmentPassthrough = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool(); 1978 2010 attachmentData.m_fAttachmentTempEject = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool(); 2011 attachmentData.m_fAttachmentNonRotational = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool(); 1979 2012 attachmentData.m_strAttachmentMediumId = mStorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString(); 1980 2013 … … 2417 2450 mCbTempEject->setChecked (!isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsTempEject).toBool()); 2418 2451 2452 /* Getting NonRotational state */ 2453 mCbNonRotational->setVisible (device == KDeviceType_HardDisk); 2454 mCbNonRotational->setChecked (mStorageModel->data (index, StorageModel::R_AttIsNonRotational).toBool()); 2455 2419 2456 /* Update optional widgets visibility */ 2420 2457 updateAdditionalObjects (device); … … 2489 2526 if (!mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool()) 2490 2527 mStorageModel->setData (index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject); 2528 } 2529 else if (sdr == mCbNonRotational) 2530 { 2531 mStorageModel->setData (index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational); 2491 2532 } 2492 2533 break; … … 3397 3438 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 3398 3439 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 3440 bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational; 3399 3441 /* Get GUI medium object: */ 3400 3442 VBoxMedium vboxMedium = vboxGlobal().findMedium(strAttachmentMediumId); … … 3426 3468 } 3427 3469 } 3470 else if (attachmentDeviceType == KDeviceType_HardDisk) 3471 { 3472 m_machine.NonRotationalDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentNonRotational); 3473 /* Check that machine is OK: */ 3474 fSuccess = m_machine.isOk(); 3475 } 3428 3476 } 3429 3477 else … … 3461 3509 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 3462 3510 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 3511 bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational; 3463 3512 KDeviceType attachmentDeviceType = attachmentData.m_attachmentType; 3464 3513 … … 3497 3546 } 3498 3547 } 3548 if (fSuccess) 3549 { 3550 if (attachmentDeviceType == KDeviceType_DVD) 3551 { 3552 m_machine.NonRotationalDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentNonRotational); 3553 /* Check that machine is OK: */ 3554 fSuccess = m_machine.isOk(); 3555 } 3556 } 3499 3557 } 3500 3558 else … … 3571 3629 mCbPassthrough->setEnabled(isMachineOffline()); 3572 3630 mCbTempEject->setEnabled(isMachineInValidMode()); 3631 mCbNonRotational->setEnabled(isMachineOffline()); 3573 3632 mLsInformation->setEnabled(isMachineInValidMode()); 3574 3633 mLbHDFormat->setEnabled(isMachineInValidMode()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r37710 r37824 357 357 bool attIsPassthrough() const; 358 358 bool attIsTempEject() const; 359 bool attIsNonRotational() const; 359 360 360 361 void setAttSlot (const StorageSlot &aAttSlot); … … 363 364 void setAttIsPassthrough (bool aPassthrough); 364 365 void setAttIsTempEject (bool aTempEject); 366 void setAttIsNonRotational (bool aNonRotational); 365 367 366 368 QString attSize() const; … … 394 396 bool mAttIsPassthrough; 395 397 bool mAttIsTempEject; 398 bool mAttIsNonRotational; 396 399 397 400 QString mAttName; … … 448 451 R_AttIsPassthrough, 449 452 R_AttIsTempEject, 453 R_AttIsNonRotational, 450 454 R_AttSize, 451 455 R_AttLogicalSize, … … 562 566 , m_strAttachmentMediumId(QString()) 563 567 , m_fAttachmentPassthrough(false) 564 , m_fAttachmentTempEject(false) {} 568 , m_fAttachmentTempEject(false) 569 , m_fAttachmentNonRotational(false) {} 565 570 /* Functions: */ 566 571 bool equal(const UIDataSettingsMachineStorageAttachment &other) const … … 571 576 (m_strAttachmentMediumId == other.m_strAttachmentMediumId) && 572 577 (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough) && 573 (m_fAttachmentTempEject == other.m_fAttachmentTempEject); 578 (m_fAttachmentTempEject == other.m_fAttachmentTempEject) && 579 (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational); 574 580 } 575 581 /* Operators: */ … … 583 589 bool m_fAttachmentPassthrough; 584 590 bool m_fAttachmentTempEject; 591 bool m_fAttachmentNonRotational; 585 592 }; 586 593 typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UICacheSettingsMachineStorageAttachment; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui
r37710 r37824 339 339 </widget> 340 340 </item> 341 <item row="2" column="2" > 342 <widget class="QCheckBox" name="mCbNonRotational" > 343 <property name="sizePolicy" > 344 <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" > 345 <horstretch>0</horstretch> 346 <verstretch>0</verstretch> 347 </sizepolicy> 348 </property> 349 <property name="whatsThis" > 350 <string>When checked, this marks the medium as non-rotational storage (SSD).</string> 351 </property> 352 <property name="text" > 353 <string>&Solid-state drive</string> 354 </property> 355 </widget> 356 </item> 341 357 <item row="3" column="0" colspan="3" > 342 358 <widget class="QILabelSeparator" native="1" name="mLsInformation" > -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37779 r37824 4691 4691 </method> 4692 4692 4693 <method name="nonRotationalDevice"> 4694 <desc> 4695 Sets a flag in the device information which indicates that the medium 4696 is not based on rotational technology, i.e. that the access times are 4697 more or less independent of the position on the medium. This may or may 4698 not be supported by a particular drive, and is silently ignored in the 4699 latter case. At the moment only hard disks (which is a misnomer in this 4700 context) accept this setting. Changing the setting while the VM is 4701 running is forbidden. The device must already exist; see 4702 <link to="IMachine::attachDevice"/> for how to attach a new device. 4703 4704 The @a controllerPort and @a device parameters specify the device slot and 4705 have have the same meaning as with <link to="IMachine::attachDevice" />. 4706 4707 <result name="E_INVALIDARG"> 4708 SATA device, SATA port, IDE port or IDE slot out of range. 4709 </result> 4710 <result name="VBOX_E_INVALID_OBJECT_STATE"> 4711 Attempt to modify an unregistered virtual machine. 4712 </result> 4713 <result name="VBOX_E_INVALID_VM_STATE"> 4714 Invalid machine state. 4715 </result> 4716 4717 </desc> 4718 <param name="name" type="wstring" dir="in"> 4719 <desc>Name of the storage controller.</desc> 4720 </param> 4721 <param name="controllerPort" type="long" dir="in"> 4722 <desc>Storage controller port.</desc> 4723 </param> 4724 <param name="device" type="long" dir="in"> 4725 <desc>Device slot in the given port.</desc> 4726 </param> 4727 <param name="nonRotational" type="boolean" dir="in"> 4728 <desc>New value for the non-rotational device flag.</desc> 4729 </param> 4730 </method> 4731 4693 4732 <method name="setBandwidthGroupForDevice"> 4694 4733 <desc> … … 9840 9879 <desc>Signals that the removable medium has been ejected. This is not 9841 9880 necessarily equivalent to having a @c null medium association.</desc> 9881 </attribute> 9882 9883 <attribute name="nonRotational" type="boolean" readonly="yes"> 9884 <desc>Whether the associated medium is non-rotational.</desc> 9842 9885 </attribute> 9843 9886 -
trunk/src/VBox/Main/include/MachineImpl.h
r37779 r37824 478 478 STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough); 479 479 STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject); 480 STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational); 480 481 STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 481 482 LONG aDevice, IBandwidthGroup *aBandwidthGroup); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r37709 r37824 50 50 bool fPassthrough, 51 51 bool fTempEject, 52 bool fNonRotational, 52 53 const Utf8Str &strBandwidthGroup); 53 54 void uninit(); … … 65 66 STDMETHOD(COMGETTER(TemporaryEject))(BOOL *aTemporaryEject); 66 67 STDMETHOD(COMGETTER(IsEjected))(BOOL *aIsEjected); 68 STDMETHOD(COMGETTER(NonRotational))(BOOL *aNonRotational); 67 69 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup); 68 70 … … 83 85 bool getPassthrough() const; 84 86 bool getTempEject() const; 87 bool getNonRotational() const; 85 88 const Utf8Str& getBandwidthGroup() const; 86 89 … … 95 98 /** Must be called from under this object's write lock. */ 96 99 void updateTempEject(bool aTempEject); 100 101 /** Must be called from under this object's write lock. */ 102 void updateNonRotational(bool aNonRotational); 97 103 98 104 /** Must be called from under this object's write lock. */ -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r37813 r37824 316 316 #endif 317 317 318 static const char *const g_apszIDEDrives[4] = 319 { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" }; 318 320 319 321 class ConfigError : public RTCError … … 1571 1573 for (uint32_t j = 0; j < 4; ++j) 1572 1574 { 1573 static const char * const s_apszConfig[4] =1574 { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" };1575 1575 static const char * const s_apszBiosConfig[4] = 1576 1576 { "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" }; … … 1578 1578 LONG lPortNumber = -1; 1579 1579 hrc = ctrls[i]->GetIDEEmulationPort(j, &lPortNumber); H(); 1580 InsertConfigInteger(pCfg, s_apszConfig[j], lPortNumber);1580 InsertConfigInteger(pCfg, g_apszIDEDrives[j], lPortNumber); 1581 1581 if (pBiosCfg) 1582 1582 InsertConfigInteger(pBiosCfg, s_apszBiosConfig[j], lPortNumber); … … 2861 2861 DeviceType_T lType; 2862 2862 hrc = pMediumAtt->COMGETTER(Type)(&lType); H(); 2863 BOOL fNonRotational; 2864 hrc = pMediumAtt->COMGETTER(NonRotational)(&fNonRotational); H(); 2863 2865 2864 2866 unsigned uLUN; 2865 2867 PCFGMNODE pLunL0 = NULL; 2866 PCFGMNODE pCfg = NULL;2867 2868 hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN); H(); 2868 2869 … … 2912 2913 InsertConfigNode(pCtlInst, Utf8StrFmt("LUN#%u", uLUN).c_str(), &pLunL0); 2913 2914 2915 PCFGMNODE pCfg = CFGMR3GetChild(pCtlInst, "Config"); 2916 if (pCfg) 2917 { 2918 if (!strcmp(pcszDevice, "piix3ide")) 2919 { 2920 PCFGMNODE pDrive = CFGMR3GetChild(pCfg, g_apszIDEDrives[uLUN]); 2921 if (!pDrive) 2922 InsertConfigNode(pCfg, g_apszIDEDrives[uLUN], &pDrive); 2923 PCFGMNODE pNonRot = CFGMR3GetChild(pCtlInst, "NonRotationalMedium"); 2924 if (pNonRot) 2925 CFGMR3RemoveNode(pNonRot); 2926 InsertConfigInteger(pDrive, "NonRotationalMedium", !!fNonRotational); 2927 } 2928 else if (!strcmp(pcszDevice, "ahci")) 2929 { 2930 Utf8Str strPort = Utf8StrFmt("Port%u", uLUN); 2931 PCFGMNODE pDrive = CFGMR3GetChild(pCfg, strPort.c_str()); 2932 if (!pDrive) 2933 InsertConfigNode(pCfg, strPort.c_str(), &pDrive); 2934 PCFGMNODE pNonRot = CFGMR3GetChild(pCtlInst, "NonRotationalMedium"); 2935 if (pNonRot) 2936 CFGMR3RemoveNode(pNonRot); 2937 InsertConfigInteger(pDrive, "NonRotationalMedium", !!fNonRotational); 2938 } 2939 } 2940 /** @todo add SCSI/SAS support once the SSD support is there */ 2941 2914 2942 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 2915 2943 mapMediumAttachments[devicePath] = pMediumAtt; … … 2919 2947 { 2920 2948 InsertConfigString(pLunL0, "Driver", "SCSI"); 2921 InsertConfigNode(pLunL0, "Config", &pCfg); 2949 PCFGMNODE pL1Cfg = NULL; 2950 InsertConfigNode(pLunL0, "Config", &pL1Cfg); 2922 2951 2923 2952 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL0); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r37777 r37824 3804 3804 false /* fPassthrough */, 3805 3805 false /* fTempEject */, 3806 false /* fNonRotational */, 3806 3807 Utf8Str::Empty); 3807 3808 if (FAILED(rc)) return rc; … … 3994 3995 if (pAttach->getType() != DeviceType_DVD) 3995 3996 return setError(E_INVALIDARG, 3996 tr("Setting passthroughrejected as the device attached to device slot %d on port %d of controller '%ls' is not a DVD"),3997 tr("Setting temporary eject flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a DVD"), 3997 3998 aDevice, aControllerPort, aControllerName); 3998 3999 pAttach->updateTempEject(!!aTemporaryEject); 4000 4001 return S_OK; 4002 } 4003 4004 STDMETHODIMP Machine::NonRotationalDevice(IN_BSTR aControllerName, LONG aControllerPort, 4005 LONG aDevice, BOOL aNonRotational) 4006 { 4007 CheckComArgStrNotEmptyOrNull(aControllerName); 4008 4009 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aNonRotational=%d\n", 4010 aControllerName, aControllerPort, aDevice, aNonRotational)); 4011 4012 AutoCaller autoCaller(this); 4013 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4014 4015 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4016 4017 HRESULT rc = checkStateDependency(MutableStateDep); 4018 if (FAILED(rc)) return rc; 4019 4020 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 4021 4022 if (Global::IsOnlineOrTransient(mData->mMachineState)) 4023 return setError(VBOX_E_INVALID_VM_STATE, 4024 tr("Invalid machine state: %s"), 4025 Global::stringifyMachineState(mData->mMachineState)); 4026 4027 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments, 4028 aControllerName, 4029 aControllerPort, 4030 aDevice); 4031 if (!pAttach) 4032 return setError(VBOX_E_OBJECT_NOT_FOUND, 4033 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 4034 aDevice, aControllerPort, aControllerName); 4035 4036 4037 setModified(IsModified_Storage); 4038 mMediaData.backup(); 4039 4040 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 4041 4042 if (pAttach->getType() != DeviceType_HardDisk) 4043 return setError(E_INVALIDARG, 4044 tr("Setting the non-rotational medium flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a hard disk"), 4045 aDevice, aControllerPort, aControllerName); 4046 pAttach->updateNonRotational(!!aNonRotational); 3999 4047 4000 4048 return S_OK; … … 8098 8146 dev.fPassThrough, 8099 8147 dev.fTempEject, 8148 dev.fNonRotational, 8100 8149 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName()); 8101 8150 if (FAILED(rc)) break; … … 9045 9094 dev.fPassThrough = pAttach->getPassthrough(); 9046 9095 dev.fTempEject = pAttach->getTempEject(); 9096 dev.fNonRotational = pAttach->getNonRotational(); 9047 9097 } 9048 9098 … … 9368 9418 false /* aPassthrough */, 9369 9419 false /* aTempEject */, 9420 false /* aNonRotational */, 9370 9421 pAtt->getBandwidthGroup()); 9371 9422 if (FAILED(rc)) throw rc; -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r37709 r37824 41 41 fPassthrough(false), 42 42 fTempEject(false), 43 fNonRotational(false), 43 44 fImplicit(false) 44 45 { } … … 58 59 bool fPassthrough; 59 60 bool fTempEject; 61 bool fNonRotational; 60 62 bool fImplicit; 61 63 }; … … 117 119 bool aPassthrough, 118 120 bool aTempEject, 121 bool aNonRotational, 119 122 const Utf8Str &strBandwidthGroup) 120 123 { 121 124 LogFlowThisFuncEnter(); 122 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d \n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject));125 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, strBandwidthGroup.c_str())); 123 126 124 127 if (aType == DeviceType_HardDisk) … … 143 146 m->bd->fPassthrough = aPassthrough; 144 147 m->bd->fTempEject = aTempEject; 148 m->bd->fNonRotational = aNonRotational; 145 149 m->bd->fImplicit = aImplicit; 146 150 … … 319 323 } 320 324 325 STDMETHODIMP MediumAttachment::COMGETTER(NonRotational)(BOOL *aNonRotational) 326 { 327 LogFlowThisFuncEnter(); 328 329 CheckComArgOutPointerValid(aNonRotational); 330 331 AutoCaller autoCaller(this); 332 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 333 334 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 335 336 *aNonRotational = m->bd->fNonRotational; 337 338 LogFlowThisFuncLeave(); 339 return S_OK; 340 } 341 321 342 STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwGroup) 322 343 { … … 429 450 } 430 451 452 bool MediumAttachment::getNonRotational() const 453 { 454 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 455 return m->bd->fNonRotational; 456 } 457 431 458 const Utf8Str& MediumAttachment::getBandwidthGroup() const 432 459 { … … 481 508 } 482 509 510 /** Must be called from under this object's write lock. */ 511 void MediumAttachment::updateNonRotational(bool aNonRotational) 512 { 513 Assert(isWriteLockOnCurrentThread()); 514 515 m->bd.backup(); 516 m->bd->fNonRotational = aNonRotational; 517 } 518 483 519 void MediumAttachment::updateBandwidthGroup(const Utf8Str &aBandwidthGroup) 484 520 { -
trunk/src/VBox/Main/xml/Settings.cpp
r37709 r37824 1692 1692 && (fPassThrough == a.fPassThrough) 1693 1693 && (fTempEject == a.fTempEject) 1694 && (fNonRotational == a.fNonRotational) 1694 1695 && (lPort == a.lPort) 1695 1696 && (lDevice == a.lDevice) … … 2984 2985 2985 2986 if (strTemp == "HardDisk") 2987 { 2986 2988 att.deviceType = DeviceType_HardDisk; 2989 pelmAttached->getAttributeValue("nonrotational", att.fNonRotational); 2990 } 2987 2991 else if (m->sv >= SettingsVersion_v1_9) 2988 2992 { … … 4229 4233 case DeviceType_HardDisk: 4230 4234 pcszType = "HardDisk"; 4235 if (att.fNonRotational) 4236 pelmDevice->setAttribute("nonrotational", att.fNonRotational); 4231 4237 break; 4232 4238
Note:
See TracChangeset
for help on using the changeset viewer.