Changeset 50447 in vbox
- Timestamp:
- Feb 13, 2014 1:42:17 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_VBoxManage.xml
r50352 r50447 1367 1367 OVF standard 1.0 you can enable a OVF 0.9 legacy mode with the 1368 1368 <computeroutput>--legacy09</computeroutput> option.</para> 1369 1370 <para>To specify options controlling the exact content of the appliance 1371 file, you can use <computeroutput>--option</computeroutput> to request the 1372 creation of a manifest file (encouraged, allows detection of corrupted 1373 appliances on import), the additional export of DVD images, and the 1374 exclusion of MAC addresses. You can specify a list of options, e.g. 1375 <computeroutput>--option manifest,nomacs</computeroutput>. For details, 1376 check the help output of <computeroutput>VBoxManage export</computeroutput>.</para> 1369 1377 </sect1> 1370 1378 -
trunk/doc/manual/user_ChangeLogImpl.xml
r50402 r50447 18 18 19 19 <itemizedlist> 20 21 <listitem> 22 <para>VBoxManage: when exporting an appliance, support the suppression 23 of MAC addresses, which means they will be always recreated on 24 import, avoiding duplicate MAC addresses for VMs which are imported 25 several times</para> 26 </listitem> 20 27 21 28 <listitem> -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
r50323 r50447 5 5 6 6 /* 7 * Copyright (C) 2009-201 3Oracle Corporation7 * Copyright (C) 2009-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 788 788 } 789 789 790 static const RTGETOPTDEF g_aExportOptions[] 791 = { 792 { "--output", 'o', RTGETOPT_REQ_STRING }, 793 { "--legacy09", 'l', RTGETOPT_REQ_NOTHING }, 794 { "--ovf09", 'l', RTGETOPT_REQ_NOTHING }, 795 { "--ovf10", '1', RTGETOPT_REQ_NOTHING }, 796 { "--ovf20", '2', RTGETOPT_REQ_NOTHING }, 797 { "--manifest", 'm', RTGETOPT_REQ_NOTHING }, 798 { "--iso", 'I', RTGETOPT_REQ_NOTHING }, 799 { "--vsys", 's', RTGETOPT_REQ_UINT32 }, 800 { "--product", 'p', RTGETOPT_REQ_STRING }, 801 { "--producturl", 'P', RTGETOPT_REQ_STRING }, 802 { "--vendor", 'n', RTGETOPT_REQ_STRING }, 803 { "--vendorurl", 'N', RTGETOPT_REQ_STRING }, 804 { "--version", 'v', RTGETOPT_REQ_STRING }, 805 { "--description", 'd', RTGETOPT_REQ_STRING }, 806 { "--eula", 'e', RTGETOPT_REQ_STRING }, 807 { "--eulafile", 'E', RTGETOPT_REQ_STRING }, 808 }; 790 static int parseExportOptions(const char *psz, com::SafeArray<ExportOptions_T> *options) 791 { 792 int rc = VINF_SUCCESS; 793 while (psz && *psz && RT_SUCCESS(rc)) 794 { 795 size_t len; 796 const char *pszComma = strchr(psz, ','); 797 if (pszComma) 798 len = pszComma - psz; 799 else 800 len = strlen(psz); 801 if (len > 0) 802 { 803 if (!RTStrNICmp(psz, "CreateManifest", len)) 804 options->push_back(ExportOptions_CreateManifest); 805 else if (!RTStrNICmp(psz, "manifest", len)) 806 options->push_back(ExportOptions_CreateManifest); 807 else if (!RTStrNICmp(psz, "ExportDVDImages", len)) 808 options->push_back(ExportOptions_ExportDVDImages); 809 else if (!RTStrNICmp(psz, "iso", len)) 810 options->push_back(ExportOptions_ExportDVDImages); 811 else if (!RTStrNICmp(psz, "StripAllMACs", len)) 812 options->push_back(ExportOptions_StripAllMACs); 813 else if (!RTStrNICmp(psz, "nomacs", len)) 814 options->push_back(ExportOptions_StripAllMACs); 815 else if (!RTStrNICmp(psz, "StripAllNonNATMACs", len)) 816 options->push_back(ExportOptions_StripAllNonNATMACs); 817 else if (!RTStrNICmp(psz, "nomacsbutnat", len)) 818 options->push_back(ExportOptions_StripAllNonNATMACs); 819 else 820 rc = VERR_PARSE_ERROR; 821 } 822 if (pszComma) 823 psz += len + 1; 824 else 825 psz += len; 826 } 827 828 return rc; 829 } 830 831 static const RTGETOPTDEF g_aExportOptions[] = 832 { 833 { "--output", 'o', RTGETOPT_REQ_STRING }, 834 { "--legacy09", 'l', RTGETOPT_REQ_NOTHING }, 835 { "--ovf09", 'l', RTGETOPT_REQ_NOTHING }, 836 { "--ovf10", '1', RTGETOPT_REQ_NOTHING }, 837 { "--ovf20", '2', RTGETOPT_REQ_NOTHING }, 838 { "--manifest", 'm', RTGETOPT_REQ_NOTHING }, // obsoleted by --options 839 { "--iso", 'I', RTGETOPT_REQ_NOTHING }, // obsoleted by --options 840 { "--vsys", 's', RTGETOPT_REQ_UINT32 }, 841 { "--product", 'p', RTGETOPT_REQ_STRING }, 842 { "--producturl", 'P', RTGETOPT_REQ_STRING }, 843 { "--vendor", 'n', RTGETOPT_REQ_STRING }, 844 { "--vendorurl", 'N', RTGETOPT_REQ_STRING }, 845 { "--version", 'v', RTGETOPT_REQ_STRING }, 846 { "--description", 'd', RTGETOPT_REQ_STRING }, 847 { "--eula", 'e', RTGETOPT_REQ_STRING }, 848 { "--eulafile", 'E', RTGETOPT_REQ_STRING }, 849 { "--options", 'O', RTGETOPT_REQ_STRING }, 850 }; 809 851 810 852 int handleExportAppliance(HandlerArg *a) … … 816 858 bool fManifest = false; // the default 817 859 bool fExportISOImages = false; // the default 860 com::SafeArray<ExportOptions_T> options; 818 861 std::list< ComPtr<IMachine> > llMachines; 819 862 … … 844 887 845 888 case 'l': // --legacy09/--ovf09 846 847 889 strOvfFormat = "ovf-0.9"; 890 break; 848 891 849 892 case '1': // --ovf10 850 851 893 strOvfFormat = "ovf-1.0"; 894 break; 852 895 853 896 case '2': // --ovf20 854 855 897 strOvfFormat = "ovf-2.0"; 898 break; 856 899 857 900 case 'I': // --iso 858 859 901 fExportISOImages = true; 902 break; 860 903 861 904 case 'm': // --manifest 862 863 905 fManifest = true; 906 break; 864 907 865 908 case 's': // --vsys 866 867 909 ulCurVsys = ValueUnion.u32; 910 break; 868 911 869 912 case 'p': // --product 870 871 872 873 913 if (ulCurVsys == (uint32_t)-1) 914 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 915 mapArgsMapsPerVsys[ulCurVsys]["product"] = ValueUnion.psz; 916 break; 874 917 875 918 case 'P': // --producturl 876 877 878 879 919 if (ulCurVsys == (uint32_t)-1) 920 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 921 mapArgsMapsPerVsys[ulCurVsys]["producturl"] = ValueUnion.psz; 922 break; 880 923 881 924 case 'n': // --vendor 882 883 884 885 925 if (ulCurVsys == (uint32_t)-1) 926 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 927 mapArgsMapsPerVsys[ulCurVsys]["vendor"] = ValueUnion.psz; 928 break; 886 929 887 930 case 'N': // --vendorurl 888 889 890 891 931 if (ulCurVsys == (uint32_t)-1) 932 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 933 mapArgsMapsPerVsys[ulCurVsys]["vendorurl"] = ValueUnion.psz; 934 break; 892 935 893 936 case 'v': // --version 894 895 896 897 937 if (ulCurVsys == (uint32_t)-1) 938 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 939 mapArgsMapsPerVsys[ulCurVsys]["version"] = ValueUnion.psz; 940 break; 898 941 899 942 case 'd': // --description 900 901 902 903 943 if (ulCurVsys == (uint32_t)-1) 944 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 945 mapArgsMapsPerVsys[ulCurVsys]["description"] = ValueUnion.psz; 946 break; 904 947 905 948 case 'e': // --eula 906 907 908 909 949 if (ulCurVsys == (uint32_t)-1) 950 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 951 mapArgsMapsPerVsys[ulCurVsys]["eula"] = ValueUnion.psz; 952 break; 910 953 911 954 case 'E': // --eulafile 912 if (ulCurVsys == (uint32_t)-1) 913 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 914 mapArgsMapsPerVsys[ulCurVsys]["eulafile"] = ValueUnion.psz; 915 break; 955 if (ulCurVsys == (uint32_t)-1) 956 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 957 mapArgsMapsPerVsys[ulCurVsys]["eulafile"] = ValueUnion.psz; 958 break; 959 960 case 'O': // --options 961 if (RT_FAILURE(parseExportOptions(ValueUnion.psz, &options))) 962 return errorArgument("Invalid export options '%s'\n", ValueUnion.psz); 963 break; 916 964 917 965 case VINF_GETOPT_NOT_OPTION: … … 1057 1105 break; 1058 1106 1059 com::SafeArray<ExportOptions_T> options;1060 1107 if (fManifest) 1061 1108 options.push_back(ExportOptions_CreateManifest); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r50307 r50447 415 415 " [--manifest]\n" 416 416 " [--iso]\n" 417 " [--options manifest|iso|nomacs|nomacsbutnat]\n" 417 418 " [--vsys <number of virtual system>]\n" 418 419 " [--product <product name>]\n" -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r50380 r50447 3 3 <!-- 4 4 5 Copyright (C) 2006-201 3Oracle Corporation5 Copyright (C) 2006-2014 Oracle Corporation 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 2826 2826 needed for typical VMs.</desc> 2827 2827 </const> 2828 <const name="StripAllMACs" value="3"> 2829 <desc>Do not export any MAC address information. Default is to keep them 2830 to avoid losing information which can cause trouble after import, at the 2831 price of risking duplicate MAC addresses, if the import options are used 2832 to keep them.</desc> 2833 </const> 2834 <const name="StripAllNonNATMACs" value="4"> 2835 <desc>Do not export any MAC address information, except for adapters 2836 using NAT. Default is to keep them to avoid losing information which can 2837 cause trouble after import, at the price of risking duplicate MAC 2838 addresses, if the import options are used to keep them.</desc> 2839 </const> 2828 2840 2829 2841 </enum> -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r50444 r50447 5 5 6 6 /* 7 * Copyright (C) 2008-201 3Oracle Corporation7 * Copyright (C) 2008-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1835 1835 // fill the machine config 1836 1836 vsdescThis->m->pMachine->copyMachineDataToSettings(*pConfig); 1837 1838 // Apply export tweaks to machine settings 1839 bool fStripAllMACs = m->optListExport.contains(ExportOptions_StripAllMACs); 1840 bool fStripAllNonNATMACs = m->optListExport.contains(ExportOptions_StripAllNonNATMACs); 1841 if (fStripAllMACs || fStripAllNonNATMACs) 1842 { 1843 for (settings::NetworkAdaptersList::iterator it = pConfig->hardwareMachine.llNetworkAdapters.begin(); 1844 it != pConfig->hardwareMachine.llNetworkAdapters.end(); 1845 ++it) 1846 { 1847 settings::NetworkAdapter &nic = *it; 1848 if (fStripAllMACs || (fStripAllNonNATMACs && nic.mode != NetworkAttachmentType_NAT)) 1849 nic.strMACAddress.setNull(); 1850 } 1851 } 1837 1852 1838 1853 // write the machine config to the vbox:Machine element
Note:
See TracChangeset
for help on using the changeset viewer.