VirtualBox

Changeset 105847 in vbox


Ignore:
Timestamp:
Aug 23, 2024 3:24:55 PM (7 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164566
Message:

FE/VBoxManage: Relaxed the default parameters of the "createvm" a bit by not making the platform type mandatory. Instead, rely on the guest OS' platform type if given, or use the host platform as the VM platform by default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r105333 r105847  
    367367
    368368    /* check for required options */
    369     if (platformArch == PlatformArchitecture_None)
    370         return errorSyntax(Misc::tr("Parameter --platform-architecture is required"));
    371369    if (bstrName.isEmpty())
    372370        return errorSyntax(Misc::tr("Parameter --name is required"));
     371
     372    /* If the platform architecture is not specified explicitly ... */
     373    if (platformArch == PlatformArchitecture_None)
     374    {
     375        /* ... determine it from the guest OS type, if given. */
     376        if (bstrOsTypeId.isNotEmpty())
     377        {
     378            ComPtr<IGuestOSType> ptrGuestOsType;
     379            a->virtualBox->GetGuestOSType(bstrOsTypeId.raw(), ptrGuestOsType.asOutParam());
     380            if (ptrGuestOsType.isNull())
     381                return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Unknown or invalid guest OS type given."));
     382            CHECK_ERROR2I_RET(ptrGuestOsType, COMGETTER(PlatformArchitecture)(&platformArch), RTEXITCODE_FAILURE);
     383        }
     384        else /* use the host's platform type as the VM platform type. */
     385        {
     386            ComPtr<IHost> host;
     387            CHECK_ERROR2I_RET(a->virtualBox, COMGETTER(Host)(host.asOutParam()), RTEXITCODE_FAILURE);
     388            CHECK_ERROR2I_RET(host, COMGETTER(Architecture)(&platformArch), RTEXITCODE_FAILURE);
     389        }
     390    }
    373391
    374392    do
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette