Changeset 48538 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 19, 2013 3:17:43 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89083
- Location:
- trunk/src/VBox/Main
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r48505 r48538 1383 1383 ///////////////////////////////////////////////////////////////////////// 1384 1384 --> 1385 <!-- This is experimental interface to LWIP based NAT server --> 1385 1386 1386 <interface name="INATNetwork" extends="$unknown" 1387 1387 uuid="a63c75da-4c99-4e9d-8351-eb73651c18cc" … … 2586 2586 <!-- Here we create a record in NAT network array with name 2587 2587 and gateway/network parameters this information should 2588 be enough for VBoxNet [Lwip]NAT and VBoxNetDHCP for2588 be enough for VBoxNetNAT and VBoxNetDHCP for 2589 2589 servicing the guests. 2590 2590 --> … … 4122 4122 <interface 4123 4123 name="IMachine" extends="$unknown" 4124 uuid=" 8c931034-83f6-46b8-97f0-31e70d30402e"4124 uuid="7108c7c7-2c0a-47ee-9c69-022fe2a466bf" 4125 4125 wsmap="managed" 4126 4126 > … … 4548 4548 </attribute> 4549 4549 4550 <attribute name="settingsFilePath" type="wstring" >4550 <attribute name="settingsFilePath" type="wstring" readonly="yes"> 4551 4551 <desc> 4552 4552 Full name of the file containing machine settings data. 4553 4554 Currently, it is an error to change this property on any machine.4555 Later this will allow setting a new path for the settings file, with4556 automatic relocation of all files (including snapshots and disk images)4557 which are inside the base directory.4558 4559 <note>4560 Setting this property to @c null or to an empty string is forbidden.4561 </note>4562 <note>4563 When setting this property, the specified path must be absolute. When4564 reading this property, an absolute (full) path is always returned.4565 </note>4566 <note>4567 The specified path may not exist, it will be created when necessary.4568 </note>4569 4553 </desc> 4570 4554 </attribute> … … 6313 6297 New property value. 6314 6298 </desc> 6299 </param> 6300 </method> 6301 6302 <method name="setSettingsFilePath"> 6303 <desc> 6304 Currently, it is an error to change this property on any machine. 6305 Later this will allow setting a new path for the settings file, with 6306 automatic relocation of all files (including snapshots and disk images) 6307 which are inside the base directory. This operation is only allowed 6308 when there are no pending unsaved settings. 6309 6310 <note> 6311 Setting this property to @c null or to an empty string is forbidden. 6312 When setting this property, the specified path must be absolute. 6313 The specified path may not exist, it will be created when necessary. 6314 </note> 6315 6316 <result name="E_NOTIMPL"> 6317 The operation is not implemented yet. 6318 </result> 6319 </desc> 6320 6321 <param name="settingsFilePath" type="wstring" dir="in"> 6322 <desc>New settings file path, will be used to determine the new 6323 location for the attached media if it is in the same directory or 6324 below as the original settings file.</desc> 6325 </param> 6326 <param name="progress" type="IProgress" dir="return"> 6327 <desc>Progress object to track the operation completion.</desc> 6315 6328 </param> 6316 6329 </method> … … 13045 13058 <interface 13046 13059 name="IMedium" extends="$unknown" 13047 uuid=" 8df5fc17-503a-4171-85bc-039b6f24d86b"13060 uuid="05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac" 13048 13061 wsmap="managed" 13049 13062 > … … 13259 13272 </attribute> 13260 13273 13261 <attribute name="location" type="wstring" >13274 <attribute name="location" type="wstring" readonly="yes"> 13262 13275 <desc> 13263 13276 Location of the storage unit holding medium data. … … 13266 13279 types using regular files in a host's file system, the location 13267 13280 string is the full file name. 13268 13269 Some medium types may support changing the storage unit location by13270 simply changing the value of this property. If this operation is not13271 supported, the implementation will return E_NOTIMPL in attempt to set13272 this attribute's value.13273 13274 When setting a value of the location attribute which is a regular file13275 in the host's file system, the given file name may be either relative to13276 the <link to="IVirtualBox::homeFolder">VirtualBox home folder</link> or13277 absolute. Note that if the given location specification does not contain13278 the file extension part then a proper default extension will be13279 automatically appended by the implementation depending on the medium type.13280 13281 </desc> 13281 13282 </attribute> … … 14186 14187 <!-- other methods --> 14187 14188 14189 <method name="setLocation"> 14190 <desc> 14191 Changes the location of this medium. Some medium types may support 14192 changing the storage unit location by simply changing the value of the 14193 associated property. In this case the operation is performed 14194 immediately, and @a progress is returning a @c null reference. 14195 Otherwise on success there is a progress object returned, which 14196 signals progress and completion of the operation. This distinction is 14197 necessary because for some formats the operation is very fast, while 14198 for others it can be very slow (moving the image file by copying all 14199 data), and in the former case it'd be a waste of resources to create 14200 a progress object which will immediately signal completion. 14201 14202 When setting a location for a medium which corresponds to a/several 14203 regular file(s) in the host's file system, the given file name may be 14204 either relative to the <link to="IVirtualBox::homeFolder">VirtualBox 14205 home folder</link> or absolute. Note that if the given location 14206 specification does not contain the file extension part then a proper 14207 default extension will be automatically appended by the implementation 14208 depending on the medium type. 14209 14210 <result name="E_NOTIMPL"> 14211 The operation is not implemented yet. 14212 </result> 14213 <result name="VBOX_E_NOT_SUPPORTED"> 14214 Medium format does not support changing the location. 14215 </result> 14216 </desc> 14217 <param name="location" type="wstring" dir="in"> 14218 <desc>New location.</desc> 14219 </param> 14220 <param name="progress" type="IProgress" dir="return"> 14221 <desc>Progress object to track the operation completion.</desc> 14222 </param> 14223 </method> 14224 14188 14225 <method name="compact"> 14189 14226 <desc> … … 15651 15688 <enum 15652 15689 name="NetworkAttachmentType" 15653 uuid=" 2ac4bc71-6b82-417a-acd1-f7426d2570d6"15690 uuid="524a8f9d-4b86-4b51-877d-1aa27c4ebeac" 15654 15691 > 15655 15692 <desc> … … 15665 15702 <const name="HostOnly" value="4"/> 15666 15703 <const name="Generic" value="5"/> 15704 <const name="NATNetwork" value="6"/> 15667 15705 </enum> 15668 15706 -
trunk/src/VBox/Main/include/MachineImpl.h
r48505 r48538 457 457 STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters); 458 458 STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath); 459 STDMETHOD(COMSETTER(SettingsFilePath))(IN_BSTR aFilePath);460 459 STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified); 461 460 STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState); … … 568 567 STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal); 569 568 STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal); 569 STDMETHOD(SetSettingsFilePath)(IN_BSTR aFilePath, IProgress **aProgress); 570 570 STDMETHOD(SaveSettings)(); 571 571 STDMETHOD(DiscardSettings)(); -
trunk/src/VBox/Main/include/MediumImpl.h
r48297 r48538 106 106 STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant)); 107 107 STDMETHOD(COMGETTER(Location))(BSTR *aLocation); 108 STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);109 108 STDMETHOD(COMGETTER(Name))(BSTR *aName); 110 109 STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType); … … 154 153 STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant), 155 154 IProgress **aProgress); 155 STDMETHOD(SetLocation)(IN_BSTR aLocation, IProgress **aProgress); 156 156 STDMETHOD(Compact)(IProgress **aProgress); 157 157 STDMETHOD(Resize)(LONG64 aLogicalSize, IProgress **aProgress); -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r48528 r48538 4857 4857 } 4858 4858 4859 case NetworkAttachmentType_NATNetwork: 4860 { 4861 hrc = aNetworkAdapter->COMGETTER(NATNetwork)(bstr.asOutParam()); H(); 4862 if (!bstr.isEmpty()) 4863 { 4864 /** @todo add intnet prefix to separate namespaces, and add trunk if dealing with vboxnatX */ 4865 InsertConfigString(pLunL0, "Driver", "IntNet"); 4866 InsertConfigNode(pLunL0, "Config", &pCfg); 4867 InsertConfigString(pCfg, "Network", bstr); 4868 InsertConfigInteger(pCfg, "TrunkType", kIntNetTrunkType_WhateverNone); 4869 InsertConfigString(pCfg, "IfPolicyPromisc", pszPromiscuousGuestPolicy); 4870 networkName = bstr; 4871 trunkType = Bstr(TRUNKTYPE_WHATEVER); 4872 } 4873 break; 4874 } 4875 4859 4876 default: 4860 4877 AssertMsgFailed(("should not get here!\n")); … … 4875 4892 case NetworkAttachmentType_NAT: 4876 4893 case NetworkAttachmentType_Generic: 4894 case NetworkAttachmentType_NATNetwork: 4877 4895 { 4878 4896 if (SUCCEEDED(hrc) && SUCCEEDED(rc)) -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r47716 r48538 6 6 7 7 /* 8 * Copyright (C) 2008-201 2Oracle Corporation8 * Copyright (C) 2008-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 305 305 case NetworkAttachmentType_HostOnly: strType = "HostOnly"; break; 306 306 case NetworkAttachmentType_Generic: strType = "Generic"; break; 307 case NetworkAttachmentType_NATNetwork: strType = "NATNetwork"; break; 307 308 case NetworkAttachmentType_Null: strType = "Null"; break; 308 309 } … … 775 776 /** @todo: Maybe too cost-intensive; try to find a lighter way */ 776 777 while ( RTPathExists(tmpName) 777 || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, &harddisk) != VBOX_E_OBJECT_NOT_FOUND 778 || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, &harddisk) != VBOX_E_OBJECT_NOT_FOUND 778 779 ) 779 780 { -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r48117 r48538 2714 2714 if (FAILED(rc)) throw rc; 2715 2715 /* Set the interface name to attach to */ 2716 pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw());2716 rc = pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw()); 2717 2717 if (FAILED(rc)) throw rc; 2718 2718 break; … … 2747 2747 if (FAILED(rc)) throw rc; 2748 2748 /* Set the interface name to attach to */ 2749 pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw());2749 rc = pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw()); 2750 2750 if (FAILED(rc)) throw rc; 2751 2751 break; … … 2766 2766 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Generic); 2767 2767 if (FAILED(rc)) throw rc; 2768 } 2769 /* Next test for NAT network interfaces */ 2770 else if (pvsys->strExtraConfigCurrent.endsWith("type=NATNetwork", Utf8Str::CaseInsensitive)) 2771 { 2772 /* Attach to the right interface */ 2773 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork); 2774 if (FAILED(rc)) throw rc; 2775 com::SafeIfaceArray<INATNetwork> nwNATNetworks; 2776 rc = mVirtualBox->COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nwNATNetworks)); 2777 if (FAILED(rc)) throw rc; 2778 // Pick the first NAT network (if there is any) 2779 if (nwNATNetworks.size()) 2780 { 2781 Bstr name; 2782 rc = nwNATNetworks[0]->COMGETTER(NetworkName)(name.asOutParam()); 2783 if (FAILED(rc)) throw rc; 2784 /* Set the NAT network name to attach to */ 2785 rc = pNetworkAdapter->COMSETTER(NATNetwork)(name.raw()); 2786 if (FAILED(rc)) throw rc; 2787 break; 2788 } 2768 2789 } 2769 2790 } … … 3325 3346 it1->fEnabled = false; 3326 3347 if (!( fKeepAllMACs 3327 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT))) 3348 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT) 3349 || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NATNetwork))) 3328 3350 Host::generateMACAddress(it1->strMACAddress); 3329 3351 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48505 r48538 2752 2752 mData->m_strConfigFileFull.cloneTo(aFilePath); 2753 2753 return S_OK; 2754 }2755 2756 STDMETHODIMP Machine::COMSETTER(SettingsFilePath)(IN_BSTR aFilePath)2757 {2758 CheckComArgStrNotEmptyOrNull(aFilePath);2759 2760 AutoCaller autoCaller(this);2761 if (FAILED(autoCaller.rc())) return autoCaller.rc();2762 2763 ReturnComNotImplemented();2764 2754 } 2765 2755 … … 5287 5277 5288 5278 return S_OK; 5279 } 5280 5281 STDMETHODIMP Machine::SetSettingsFilePath(IN_BSTR aFilePath, IProgress **aProgress) 5282 { 5283 CheckComArgStrNotEmptyOrNull(aFilePath); 5284 CheckComArgOutPointerValid(aProgress); 5285 5286 AutoCaller autoCaller(this); 5287 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5288 5289 *aProgress = NULL; 5290 ReturnComNotImplemented(); 5289 5291 } 5290 5292 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r48297 r48538 1543 1543 } 1544 1544 1545 STDMETHODIMP Medium::COMSETTER(Location)(IN_BSTR aLocation)1546 {1547 CheckComArgStrNotEmptyOrNull(aLocation);1548 1549 AutoCaller autoCaller(this);1550 if (FAILED(autoCaller.rc())) return autoCaller.rc();1551 1552 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);1553 1554 /// @todo NEWMEDIA for file names, add the default extension if no extension1555 /// is present (using the information from the VD backend which also implies1556 /// that one more parameter should be passed to setLocation() requesting1557 /// that functionality since it is only allowed when called from this method1558 1559 /// @todo NEWMEDIA rename the file and set m->location on success, then save1560 /// the global registry (and local registries of portable VMs referring to1561 /// this medium), this will also require to add the mRegistered flag to data1562 1563 ReturnComNotImplemented();1564 }1565 1566 1545 STDMETHODIMP Medium::COMGETTER(Name)(BSTR *aName) 1567 1546 { … … 2892 2871 2893 2872 return rc; 2873 } 2874 2875 STDMETHODIMP Medium::SetLocation(IN_BSTR aLocation, IProgress **aProgress) 2876 { 2877 CheckComArgStrNotEmptyOrNull(aLocation); 2878 CheckComArgOutPointerValid(aProgress); 2879 2880 AutoCaller autoCaller(this); 2881 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2882 2883 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2884 2885 /// @todo NEWMEDIA for file names, add the default extension if no extension 2886 /// is present (using the information from the VD backend which also implies 2887 /// that one more parameter should be passed to setLocation() requesting 2888 /// that functionality since it is only allowed when called from this method 2889 2890 /// @todo NEWMEDIA rename the file and set m->location on success, then save 2891 /// the global registry (and local registries of portable VMs referring to 2892 /// this medium), this will also require to add the mRegistered flag to data 2893 2894 *aProgress = NULL; 2895 ReturnComNotImplemented(); 2894 2896 } 2895 2897 … … 5986 5988 pToken->Abandon(); 5987 5989 pToken.setNull(); 5988 5990 5989 5991 if (FAILED(rc)) return rc; 5990 5992 -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r42825 r48538 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 478 478 } 479 479 480 /* there must a NAT network name */ 481 if (mData->mNATNetwork.isEmpty()) 482 { 483 Log(("NAT network name not defined, setting to default \"NatNetwork\"\n")); 484 mData->mNATNetwork = "NatNetwork"; 485 } 486 480 487 mData->mAttachmentType = aAttachmentType; 481 488 … … 526 533 if (mData->mBridgedInterface != aBridgedInterface) 527 534 { 535 /* if an empty/null string is to be set, bridged interface must be 536 * turned off */ 537 if ( (aBridgedInterface == NULL || *aBridgedInterface == '\0') 538 && mData->mAttachmentType == NetworkAttachmentType_Bridged) 539 { 540 return setError(E_FAIL, 541 tr("Empty or null bridged interface name is not valid")); 542 } 543 528 544 mData.backup(); 529 545 mData->mBridgedInterface = aBridgedInterface; … … 577 593 if (mData->mHostOnlyInterface != aHostOnlyInterface) 578 594 { 595 /* if an empty/null string is to be set, host only interface must be 596 * turned off */ 597 if ( (aHostOnlyInterface == NULL || *aHostOnlyInterface == '\0') 598 && mData->mAttachmentType == NetworkAttachmentType_HostOnly) 599 { 600 return setError(E_FAIL, 601 tr("Empty or null host only interface name is not valid")); 602 } 603 579 604 mData.backup(); 580 605 mData->mHostOnlyInterface = aHostOnlyInterface; … … 684 709 if (mData->mNATNetwork != aNATNetwork) 685 710 { 711 /* if an empty/null string is to be set, host only interface must be 712 * turned off */ 713 if ( (aNATNetwork == NULL || *aNATNetwork == '\0') 714 && mData->mAttachmentType == NetworkAttachmentType_NATNetwork) 715 { 716 return setError(E_FAIL, 717 tr("Empty or null NAT network name is not valid")); 718 } 719 686 720 mData.backup(); 687 721 mData->mNATNetwork = aNATNetwork; … … 695 729 mlock.release(); 696 730 697 /* Changing the NAT network isn't allowed during runtime, therefore 698 * no immediate replug in CFGM logic => changeAdapter=FALSE */ 699 mParent->onNetworkAdapterChange(this, FALSE); 731 /* When changing the host adapter, adapt the CFGM logic to make this 732 * change immediately effect and to notify the guest that the network 733 * might have changed, therefore changeAdapter=TRUE. */ 734 mParent->onNetworkAdapterChange(this, TRUE); 700 735 } 701 736 … … 1209 1244 mData->mGenericDriver = data.strGenericDriver; 1210 1245 mData->mGenericProperties = data.genericProperties; 1246 mData->mNATNetwork = data.strNATNetworkName; 1211 1247 1212 1248 // leave the lock before setting attachment type … … 1269 1305 data.genericProperties = mData->mGenericProperties; 1270 1306 1307 data.strNATNetworkName = mData->mNATNetwork; 1308 1271 1309 // after saving settings, we are no longer different from the XML on disk 1272 1310 m_fModified = false; -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r48004 r48538 390 390 case NetworkAttachmentType_NAT: 391 391 case NetworkAttachmentType_Internal: 392 case NetworkAttachmentType_NATNetwork: 392 393 /* chipset default is OK */ 393 394 break; -
trunk/src/VBox/Main/xml/Settings.cpp
r48408 r48538 2422 2422 } 2423 2423 } 2424 else if (elmMode.nameEquals("NATNetwork")) 2425 { 2426 enmAttachmentType = NetworkAttachmentType_NATNetwork; 2427 2428 if (!elmMode.getAttributeValue("name", nic.strNATNetworkName)) // required network name 2429 throw ConfigFileError(this, &elmMode, N_("Required NATNetwork/@name element is missing")); 2430 } 2424 2431 else if (elmMode.nameEquals("VDE")) 2425 2432 { … … 4460 4467 if (nic.mode != NetworkAttachmentType_Generic) 4461 4468 buildNetworkXML(NetworkAttachmentType_Generic, *pelmDisabledNode, false, nic); 4469 if (nic.mode != NetworkAttachmentType_NATNetwork) 4470 buildNetworkXML(NetworkAttachmentType_NATNetwork, *pelmDisabledNode, false, nic); 4462 4471 buildNetworkXML(nic.mode, *pelmAdapter, true, nic); 4463 4472 } … … 4772 4781 } 4773 4782 } 4783 break; 4784 4785 case NetworkAttachmentType_NATNetwork: 4786 if (fEnabled || !nic.strNATNetworkName.isEmpty()) 4787 elmParent.createChild("NATNetwork")->setAttribute("name", nic.strNATNetworkName); 4774 4788 break; 4775 4789 … … 5319 5333 { 5320 5334 // VirtualBox 4.3 adds default frontend setting, graphics controller 5321 // setting, explicit long mode setting and video capturing.5335 // setting, explicit long mode setting, video capturing and NAT networking. 5322 5336 if ( !hardwareMachine.strDefaultFrontend.isEmpty() 5323 5337 || hardwareMachine.graphicsControllerType != GraphicsControllerType_VBoxVGA … … 5325 5339 || machineUserData.ovIcon.length() > 0 5326 5340 || hardwareMachine.fVideoCaptureEnabled) 5341 { 5327 5342 m->sv = SettingsVersion_v1_14; 5343 return; 5344 } 5345 NetworkAdaptersList::const_iterator netit; 5346 for (netit = hardwareMachine.llNetworkAdapters.begin(); 5347 netit != hardwareMachine.llNetworkAdapters.end(); 5348 ++netit) 5349 { 5350 if (netit->mode == NetworkAttachmentType_NATNetwork) 5351 { 5352 m->sv = SettingsVersion_v1_14; 5353 break; 5354 } 5355 } 5328 5356 } 5329 5357
Note:
See TracChangeset
for help on using the changeset viewer.