Changeset 48538 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Sep 19, 2013 3:17:43 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89083
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.