VirtualBox

Changeset 33238 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 19, 2010 3:41:23 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66787
Message:

Main: new VirtualBox::ComposeMachineFilename() API; remove the 'default hard disk folder' concept and related APIs; GUI wizards need fixing

Location:
trunk/src/VBox/Main
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImpl.cpp

    r33080 r33238  
    633633
    634634/**
    635  * Little shortcut to SystemProperties::DefaultHardDiskFolder.
    636  * @param str
    637  * @return
    638  */
    639 HRESULT Appliance::getDefaultHardDiskFolder(Utf8Str &str) const
    640 {
    641     /* We need the default path for storing disk images */
    642     ComPtr<ISystemProperties> systemProps;
    643     HRESULT rc = mVirtualBox->COMGETTER(SystemProperties)(systemProps.asOutParam());
    644     if (FAILED(rc)) return rc;
    645     Bstr bstrDefaultHardDiskFolder;
    646     rc = systemProps->COMGETTER(DefaultHardDiskFolder)(bstrDefaultHardDiskFolder.asOutParam());
    647     if (FAILED(rc)) return rc;
    648     str = bstrDefaultHardDiskFolder;
    649 
    650     return S_OK;
    651 }
    652 
    653 /**
    654635 * Called from the import and export background threads to synchronize the second
    655636 * background disk thread's progress object with the current progress object so
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r33102 r33238  
    126126    /* Clear any previous virtual system descriptions */
    127127    m->virtualSystemDescriptions.clear();
    128 
    129     Utf8Str strDefaultHardDiskFolder;
    130     rc = getDefaultHardDiskFolder(strDefaultHardDiskFolder);
    131     if (FAILED(rc)) return rc;
    132128
    133129    if (!m->pReader)
     
    256252            /* RAM */
    257253            uint64_t ullMemSizeVBox = vsysThis.ullMemorySize / _1M;
    258             /* Check for the constrains */
     254            /* Check for the constraints */
    259255            if (    ullMemSizeVBox != 0
    260256                 && (    ullMemSizeVBox < MM_RAM_MIN_IN_MB
     
    499495                        if (!strFilename.length())
    500496                            strFilename = Utf8StrFmt("%s.vmdk", nameVBox.c_str());
    501                         /* Construct a unique target path */
    502                         Utf8StrFmt strPath("%s%c%s",
    503                                            strDefaultHardDiskFolder.c_str(),
    504                                            RTPATH_DELIMITER,
    505                                            strFilename.c_str());
    506                         searchUniqueDiskImageFilePath(strPath);
    507497
    508498                        /* find the description for the hard disk controller
     
    522512                                           hd.strDiskId,
    523513                                           di.strHref,
    524                                            strPath,
     514                                           strFilename,
    525515                                           di.ulSuggestedSizeMB,
    526516                                           strExtraConfig);
     
    12631253                               tr("Missing VM name"));
    12641254            stack.strNameVBox = vsdeName.front()->strVboxCurrent;
     1255
     1256            // have VirtualBox suggest where the filename would be placed so we can
     1257            // put the disk images in the same directory
     1258            Bstr bstrMachineFilename;
     1259            rc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(),
     1260                                                     NULL,
     1261                                                     bstrMachineFilename.asOutParam());
     1262            if (FAILED(rc)) throw rc;
     1263            // and determine the machine folder from that
     1264            stack.strMachineFolder = bstrMachineFilename;
     1265            stack.strMachineFolder.stripFilename();
    12651266
    12661267            // guest OS type
     
    22002201    Assert(vsdescThis->m->pConfig);
    22012202
     2203    HRESULT rc = S_OK;
     2204
    22022205    settings::MachineConfigFile &config = *vsdescThis->m->pConfig;
    2203 
    2204     Utf8Str strDefaultHardDiskFolder;
    2205     HRESULT rc = getDefaultHardDiskFolder(strDefaultHardDiskFolder);
    2206     if (FAILED(rc)) throw rc;
    22072206
    22082207    /*
     
    22952294                if (di.uuidVbox == strUuid)
    22962295                {
    2297                     Utf8Str strTargetPath(strDefaultHardDiskFolder);
     2296                    Utf8Str strTargetPath(stack.strMachineFolder);
    22982297                    strTargetPath.append(RTPATH_DELIMITER);
    22992298                    strTargetPath.append(di.strHref);
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r32531 r33238  
    8585
    8686    setDefaultMachineFolder(Utf8Str::Empty);
    87     setDefaultHardDiskFolder(Utf8Str::Empty);
    8887    setDefaultHardDiskFormat(Utf8Str::Empty);
    8988
     
    565564}
    566565
    567 STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFolder)(BSTR *aDefaultHardDiskFolder)
    568 {
    569     CheckComArgOutPointerValid(aDefaultHardDiskFolder);
     566STDMETHODIMP SystemProperties::COMGETTER(MediumFormats)(ComSafeArrayOut(IMediumFormat *, aMediumFormats))
     567{
     568    CheckComArgOutSafeArrayPointerValid(aMediumFormats);
    570569
    571570    AutoCaller autoCaller(this);
     
    574573    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    575574
    576     m_strDefaultHardDiskFolderFull.cloneTo(aDefaultHardDiskFolder);
    577 
    578     return S_OK;
    579 }
    580 
    581 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFolder)(IN_BSTR aDefaultHardDiskFolder)
     575    SafeIfaceArray<IMediumFormat> mediumFormats(m_llMediumFormats);
     576    mediumFormats.detachTo(ComSafeArrayOutArg(aMediumFormats));
     577
     578    return S_OK;
     579}
     580
     581STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFormat)(BSTR *aDefaultHardDiskFormat)
     582{
     583    CheckComArgOutPointerValid(aDefaultHardDiskFormat);
     584
     585    AutoCaller autoCaller(this);
     586    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     587
     588    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     589
     590    m->strDefaultHardDiskFormat.cloneTo(aDefaultHardDiskFormat);
     591
     592    return S_OK;
     593}
     594
     595STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat)(IN_BSTR aDefaultHardDiskFormat)
    582596{
    583597    AutoCaller autoCaller(this);
     
    585599
    586600    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    587     HRESULT rc = setDefaultHardDiskFolder(aDefaultHardDiskFolder);
     601    HRESULT rc = setDefaultHardDiskFormat(aDefaultHardDiskFormat);
    588602    alock.release();
    589603
     
    598612}
    599613
    600 STDMETHODIMP SystemProperties::COMGETTER(MediumFormats)(ComSafeArrayOut(IMediumFormat *, aMediumFormats))
    601 {
    602     CheckComArgOutSafeArrayPointerValid(aMediumFormats);
     614STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceWarning)(LONG64 *aFreeSpace)
     615{
     616    CheckComArgOutPointerValid(aFreeSpace);
     617
     618    ReturnComNotImplemented();
     619}
     620
     621STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceWarning)(LONG64 /* aFreeSpace */)
     622{
     623    ReturnComNotImplemented();
     624}
     625
     626STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentWarning)(ULONG *aFreeSpacePercent)
     627{
     628    CheckComArgOutPointerValid(aFreeSpacePercent);
     629
     630    ReturnComNotImplemented();
     631}
     632
     633STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentWarning)(ULONG /* aFreeSpacePercent */)
     634{
     635    ReturnComNotImplemented();
     636}
     637
     638STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceError)(LONG64 *aFreeSpace)
     639{
     640    CheckComArgOutPointerValid(aFreeSpace);
     641
     642    ReturnComNotImplemented();
     643}
     644
     645STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceError)(LONG64 /* aFreeSpace */)
     646{
     647    ReturnComNotImplemented();
     648}
     649
     650STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentError)(ULONG *aFreeSpacePercent)
     651{
     652    CheckComArgOutPointerValid(aFreeSpacePercent);
     653
     654    ReturnComNotImplemented();
     655}
     656
     657STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentError)(ULONG /* aFreeSpacePercent */)
     658{
     659    ReturnComNotImplemented();
     660}
     661
     662STDMETHODIMP SystemProperties::COMGETTER(RemoteDisplayAuthLibrary)(BSTR *aRemoteDisplayAuthLibrary)
     663{
     664    CheckComArgOutPointerValid(aRemoteDisplayAuthLibrary);
    603665
    604666    AutoCaller autoCaller(this);
     
    607669    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    608670
    609     SafeIfaceArray<IMediumFormat> mediumFormats(m_llMediumFormats);
    610     mediumFormats.detachTo(ComSafeArrayOutArg(aMediumFormats));
    611 
    612     return S_OK;
    613 }
    614 
    615 STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFormat)(BSTR *aDefaultHardDiskFormat)
    616 {
    617     CheckComArgOutPointerValid(aDefaultHardDiskFormat);
    618 
    619     AutoCaller autoCaller(this);
    620     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    621 
    622     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    623 
    624     m->strDefaultHardDiskFormat.cloneTo(aDefaultHardDiskFormat);
    625 
    626     return S_OK;
    627 }
    628 
    629 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat)(IN_BSTR aDefaultHardDiskFormat)
     671    m->strRemoteDisplayAuthLibrary.cloneTo(aRemoteDisplayAuthLibrary);
     672
     673    return S_OK;
     674}
     675
     676STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary)(IN_BSTR aRemoteDisplayAuthLibrary)
    630677{
    631678    AutoCaller autoCaller(this);
     
    633680
    634681    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    635     HRESULT rc = setDefaultHardDiskFormat(aDefaultHardDiskFormat);
     682    HRESULT rc = setRemoteDisplayAuthLibrary(aRemoteDisplayAuthLibrary);
    636683    alock.release();
    637684
     
    646693}
    647694
    648 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceWarning)(LONG64 *aFreeSpace)
    649 {
    650     CheckComArgOutPointerValid(aFreeSpace);
    651 
    652     ReturnComNotImplemented();
    653 }
    654 
    655 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceWarning)(LONG64 /* aFreeSpace */)
    656 {
    657     ReturnComNotImplemented();
    658 }
    659 
    660 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentWarning)(ULONG *aFreeSpacePercent)
    661 {
    662     CheckComArgOutPointerValid(aFreeSpacePercent);
    663 
    664     ReturnComNotImplemented();
    665 }
    666 
    667 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentWarning)(ULONG /* aFreeSpacePercent */)
    668 {
    669     ReturnComNotImplemented();
    670 }
    671 
    672 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceError)(LONG64 *aFreeSpace)
    673 {
    674     CheckComArgOutPointerValid(aFreeSpace);
    675 
    676     ReturnComNotImplemented();
    677 }
    678 
    679 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceError)(LONG64 /* aFreeSpace */)
    680 {
    681     ReturnComNotImplemented();
    682 }
    683 
    684 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentError)(ULONG *aFreeSpacePercent)
    685 {
    686     CheckComArgOutPointerValid(aFreeSpacePercent);
    687 
    688     ReturnComNotImplemented();
    689 }
    690 
    691 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentError)(ULONG /* aFreeSpacePercent */)
    692 {
    693     ReturnComNotImplemented();
    694 }
    695 
    696 STDMETHODIMP SystemProperties::COMGETTER(RemoteDisplayAuthLibrary)(BSTR *aRemoteDisplayAuthLibrary)
    697 {
    698     CheckComArgOutPointerValid(aRemoteDisplayAuthLibrary);
     695STDMETHODIMP SystemProperties::COMGETTER(WebServiceAuthLibrary)(BSTR *aWebServiceAuthLibrary)
     696{
     697    CheckComArgOutPointerValid(aWebServiceAuthLibrary);
    699698
    700699    AutoCaller autoCaller(this);
     
    703702    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    704703
    705     m->strRemoteDisplayAuthLibrary.cloneTo(aRemoteDisplayAuthLibrary);
    706 
    707     return S_OK;
    708 }
    709 
    710 STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary)(IN_BSTR aRemoteDisplayAuthLibrary)
     704    m->strWebServiceAuthLibrary.cloneTo(aWebServiceAuthLibrary);
     705
     706    return S_OK;
     707}
     708
     709STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary)(IN_BSTR aWebServiceAuthLibrary)
    711710{
    712711    AutoCaller autoCaller(this);
     
    714713
    715714    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    716     HRESULT rc = setRemoteDisplayAuthLibrary(aRemoteDisplayAuthLibrary);
     715    HRESULT rc = setWebServiceAuthLibrary(aWebServiceAuthLibrary);
    717716    alock.release();
    718717
     
    727726}
    728727
    729 STDMETHODIMP SystemProperties::COMGETTER(WebServiceAuthLibrary)(BSTR *aWebServiceAuthLibrary)
    730 {
    731     CheckComArgOutPointerValid(aWebServiceAuthLibrary);
    732 
    733     AutoCaller autoCaller(this);
    734     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    735 
    736     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    737 
    738     m->strWebServiceAuthLibrary.cloneTo(aWebServiceAuthLibrary);
    739 
    740     return S_OK;
    741 }
    742 
    743 STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary)(IN_BSTR aWebServiceAuthLibrary)
    744 {
    745     AutoCaller autoCaller(this);
    746     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    747 
    748     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    749     HRESULT rc = setWebServiceAuthLibrary(aWebServiceAuthLibrary);
    750     alock.release();
    751 
    752     if (SUCCEEDED(rc))
    753     {
    754         // VirtualBox::saveSettings() needs vbox write lock
    755         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
    756         rc = mParent->saveSettings();
    757     }
    758 
    759     return rc;
    760 }
    761 
    762728STDMETHODIMP SystemProperties::COMGETTER(LogHistoryCount)(ULONG *count)
    763729{
     
    817783
    818784    rc = setDefaultMachineFolder(data.strDefaultMachineFolder);
    819     if (FAILED(rc)) return rc;
    820 
    821     rc = setDefaultHardDiskFolder(data.strDefaultHardDiskFolder);
    822785    if (FAILED(rc)) return rc;
    823786
     
    905868}
    906869
    907 HRESULT SystemProperties::setDefaultHardDiskFolder(const Utf8Str &aPath)
    908 {
    909     Utf8Str path(aPath);
    910     if (path.isEmpty())
    911         path = "HardDisks";
    912 
    913     /* get the full file name */
    914     Utf8Str folder;
    915     int vrc = mParent->calculateFullPath(path, folder);
    916     if (RT_FAILURE(vrc))
    917         return setError(E_FAIL,
    918                         tr("Invalid default hard disk folder '%s' (%Rrc)"),
    919                         path.c_str(),
    920                         vrc);
    921 
    922     m->strDefaultHardDiskFolder = path;
    923     m_strDefaultHardDiskFolderFull = folder;
    924 
    925     return S_OK;
    926 }
    927 
    928870HRESULT SystemProperties::setDefaultHardDiskFormat(const Utf8Str &aFormat)
    929871{
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r33232 r33238  
    11491149/////////////////////////////////////////////////////////////////////////////
    11501150
     1151STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName,
     1152                                                IN_BSTR aBaseFolder,
     1153                                                BSTR *aFilename)
     1154{
     1155    LogFlowThisFuncEnter();
     1156    LogFlowThisFunc(("aName=\"%ls\",aBaseFolder=\"%ls\"\n", aName, aBaseFolder));
     1157
     1158    CheckComArgStrNotEmptyOrNull(aName);
     1159    CheckComArgOutPointerValid(aFilename);
     1160
     1161    AutoCaller autoCaller(this);
     1162    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1163
     1164    /* Compose the settings file name using the following scheme:
     1165     *
     1166     *     <base_folder>/<machine_name>/<machine_name>.xml
     1167     *
     1168     * If a non-null and non-empty base folder is specified, the default
     1169     * machine folder will be used as a base folder.
     1170     */
     1171    Utf8Str strBase = aBaseFolder;
     1172    if (strBase.isEmpty())
     1173        /* we use the non-full folder value below to keep the path relative */
     1174        getDefaultMachineFolder(strBase);
     1175
     1176    Bstr bstrSettingsFile = BstrFmt("%s%c%ls%c%ls.vbox",
     1177                                    strBase.c_str(),
     1178                                    RTPATH_DELIMITER,
     1179                                    aName,
     1180                                    RTPATH_DELIMITER,
     1181                                    aName);
     1182
     1183    bstrSettingsFile.detachTo(aFilename);
     1184
     1185    return S_OK;
     1186}
     1187
    11511188/** @note Locks mSystemProperties object for reading. */
    11521189STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aName,
     
    11671204    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    11681205
    1169     /* Compose the settings file name using the following scheme:
    1170      *
    1171      *     <base_folder>/<machine_name>/<machine_name>.xml
    1172      *
    1173      * If a non-null and non-empty base folder is specified, the default
    1174      * machine folder will be used as a base folder.
    1175      */
    1176     Utf8Str strSettingsFile = aBaseFolder;
    1177     if (strSettingsFile.isEmpty())
    1178         /* we use the non-full folder value below to keep the path relative */
    1179         getDefaultMachineFolder(strSettingsFile);
    1180 
    1181     strSettingsFile = Utf8StrFmt("%s%c%ls%c%ls.vbox",
    1182                                  strSettingsFile.c_str(),
    1183                                  RTPATH_DELIMITER,
    1184                                  aName,
    1185                                  RTPATH_DELIMITER,
    1186                                  aName);
    1187 
    1188     HRESULT rc = E_FAIL;
     1206    Bstr bstrSettingsFilename;
     1207    HRESULT rc = ComposeMachineFilename(aName, aBaseFolder, bstrSettingsFilename.asOutParam());
     1208    if (FAILED(rc)) return rc;
    11891209
    11901210    /* create a new object */
     
    12041224    /* initialize the machine object */
    12051225    rc = machine->init(this,
    1206                        strSettingsFile,
     1226                       Utf8Str(bstrSettingsFilename),
    12071227                       Utf8Str(aName),
    12081228                       id,
     
    28462866    AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS);
    28472867    str = m->pSystemProperties->m->strDefaultMachineFolder;
    2848 }
    2849 
    2850 /**
    2851  * Returns the default hard disk folder from the system properties
    2852  * with proper locking.
    2853  * @return
    2854  */
    2855 void VirtualBox::getDefaultHardDiskFolder(Utf8Str &str) const
    2856 {
    2857     AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS);
    2858     str = m->pSystemProperties->m->strDefaultHardDiskFolder;
    28592868}
    28602869
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r33201 r33238  
    13741374  <interface
    13751375    name="IVirtualBox" extends="$unknown"
    1376     uuid="ec6cc7e7-06a2-4c5d-8993-1e3619c53817"
     1376    uuid="1489e5b2-40ed-4037-b8c9-d316bbf5e07c"
    13771377    wsmap="managed"
    13781378  >
     
    15141514    </attribute>
    15151515
    1516 
    1517     <method name="createMachine">
    1518       <desc>
    1519         Creates a new virtual machine.
    1520 
    1521         The new machine is created unregistered, with the initial configuration
    1522         set according to the specified guest OS type. A typical sequence of
    1523         actions to create a new virtual machine is as follows:
    1524 
    1525         <ol>
    1526           <li>
    1527             Call this method to have a new machine created. The returned machine
    1528             object will be "mutable" allowing to change any machine property.
    1529           </li>
    1530 
    1531           <li>
    1532             Configure the machine using the appropriate attributes and methods.
    1533           </li>
    1534 
    1535           <li>
    1536             Call <link to="IMachine::saveSettings" /> to write the settings
    1537             to the machine's XML settings file. The configuration of the newly
    1538             created machine will not be saved to disk until this method is
    1539             called.
    1540           </li>
    1541 
    1542           <li>
    1543             Call <link to="#registerMachine" /> to add the machine to the list
    1544             of machines known to VirtualBox.
    1545           </li>
    1546         </ol>
    1547 
    1548         You should specify valid name for the newly created machine when calling
    1549         this method. See the <link to="IMachine::name"/> attribute description
    1550         for more details about the machine name.
    1551 
    1552         The specified guest OS type identifier must match an ID of one of known
    1553         guest OS types listed in the <link to="IVirtualBox::guestOSTypes"/>
    1554         array.
     1516    <method name="composeMachineFilename">
     1517      <desc>
     1518        Returns the full path of the settings file name that <link to="#createMachine" />
     1519        would use. This method gets called by createMachine(), but calling this method
     1520        independently might be helpful if one needs to create the machine directory
     1521        to place files (such as disk images) there before actually creating the machine.
     1522
     1523        See the <link to="IMachine::name"/> attribute description for more details about
     1524        the machine name.
    15551525
    15561526        Every machine has a <i>settings file</i> that is used to store
     
    15731543        </pre>
    15741544
    1575         Note that if the resulting settings file already exists, this method
    1576         will fail with <link to="VBOX_E_FILE_ERROR"/>.
     1545
     1546        This method does not access the host disks. In particular, it does not check for
     1547        whether a machine of this name already exists.
     1548      </desc>
     1549      <param name="name" type="wstring" dir="in">
     1550        <desc>Suggested machine name.</desc>
     1551      </param>
     1552      <param name="baseFolder" type="wstring" dir="in">
     1553        <desc>Base machine folder (optional).</desc>
     1554      </param>
     1555      <param name="file" type="wstring" dir="return">
     1556        <desc>Fully qualified path where the machine would be created.</desc>
     1557      </param>
     1558    </method>
     1559
     1560    <method name="createMachine">
     1561      <desc>
     1562        Creates a new virtual machine.
     1563
     1564        The new machine is created unregistered, with the initial configuration
     1565        set according to the specified guest OS type. A typical sequence of
     1566        actions to create a new virtual machine is as follows:
     1567
     1568        <ol>
     1569          <li>
     1570            Call this method to have a new machine created. The returned machine
     1571            object will be "mutable" allowing to change any machine property.
     1572          </li>
     1573
     1574          <li>
     1575            Configure the machine using the appropriate attributes and methods.
     1576          </li>
     1577
     1578          <li>
     1579            Call <link to="IMachine::saveSettings" /> to write the settings
     1580            to the machine's XML settings file. The configuration of the newly
     1581            created machine will not be saved to disk until this method is
     1582            called.
     1583          </li>
     1584
     1585          <li>
     1586            Call <link to="#registerMachine" /> to add the machine to the list
     1587            of machines known to VirtualBox.
     1588          </li>
     1589        </ol>
     1590
     1591        The specified guest OS type identifier must match an ID of one of known
     1592        guest OS types listed in the <link to="IVirtualBox::guestOSTypes"/>
     1593        array.
     1594
     1595        This method uses the <link to="#composeMachineFilename" /> method to determine
     1596        where to create the machine's directory and settings file. Please refer
     1597        to the additional remarks and restrictions there.
     1598
     1599        If the resulting settings file already exists, this method will fail
     1600        with <link to="VBOX_E_FILE_ERROR"/>.
    15771601
    15781602        Optionally, you may specify an UUID of to assign to the created machine.
     
    17461770
    17471771        Note that the format of the location string is storage format specific.
    1748         See <link to="IMedium::location"/>, IMedium and
    1749         <link to="ISystemProperties::defaultHardDiskFolder"/> for more details.
     1772        See <link to="IMedium::location"/> and IMedium for more details.
    17501773
    17511774        <result name="VBOX_E_OBJECT_NOT_FOUND">
     
    18251848
    18261849        The format of the location string is storage format specific. See
    1827         <link to="IMedium::location"/>, IMedium and
    1828         <link to="ISystemProperties::defaultHardDiskFolder"/> for more details.
     1850        <link to="IMedium::location"/> and IMedium for more details.
    18291851
    18301852        Prior to VirtualBox 3.3, opening a medium added it to a global media
     
    18761898    <method name="findMedium">
    18771899      <desc>
    1878         Returns a medium of the given type that uses the given location or
    1879         UUID to store medium data.
     1900        Returns a medium of the given type that uses the given fully qualified
     1901        location or UUID to store medium data.
    18801902
    18811903        The given medium must be known to this VirtualBox installation, i.e.
     
    18871909        attributes of each known medium.
    18881910
    1889         For locations represented by file names in the host's file system, the
    1890         requested location can be a path relative to the
    1891         <link to="IVirtualBox::homeFolder">VirtualBox home folder</link>. If
    1892         only a file name without any path is given, the
    1893         <link to="ISystemProperties::defaultHardDiskFolder"> default medium
    1894         folder</link> will be prepended to the file name before searching. Note
    1895         that on case sensitive file systems, a case sensitive comparison is
    1896         performed, otherwise the case of symbols in the file path is ignored.
     1911        On case sensitive file systems, a case sensitive comparison is performed,
     1912        otherwise the case of symbols in the file path is ignored.
    18971913
    18981914        <result name="VBOX_E_OBJECT_NOT_FOUND">
     
    72037219     name="ISystemProperties"
    72047220     extends="$unknown"
    7205      uuid="5e54e767-293c-441b-a5e4-03a1fdbc0dcb"
     7221     uuid="f8fff1f1-eeb4-4483-a2a4-b4186fab5a1e"
    72067222     wsmap="managed"
    72077223     >
     
    73127328    </attribute>
    73137329
    7314     <attribute name="defaultHardDiskFolder" type="wstring">
    7315       <desc>
    7316         Full path to the default directory used to create new or open existing
    7317         virtual disks.
    7318 
    7319         This path is used when the storage unit of a hard disk is a regular file
    7320         in the host's file system and only a file name that contains no path is
    7321         given.
    7322 
    7323         The initial value of this property is
    7324         <tt>&lt;</tt>
    7325         <link to="IVirtualBox::homeFolder">VirtualBox_home</link>
    7326         <tt>&gt;/HardDisks</tt>.
    7327 
    7328         <note>
    7329           Setting this property to @c null or empty string will restore the
    7330           initial value.
    7331         </note>
    7332         <note>
    7333           When settings this property, the specified path can be relative
    7334           to the
    7335           <link to="IVirtualBox::homeFolder">VirtualBox home directory</link> or
    7336           absolute. When reading this property, a full path is
    7337           always returned.
    7338         </note>
    7339         <note>
    7340           The specified path may not exist, it will be created
    7341           when necessary.
    7342         </note>
    7343 
    7344         <see>
    7345           IMedium,
    7346           <link to="IVirtualBox::createHardDisk"/>,
    7347           <link to="IVirtualBox::openMedium"/>,
    7348           <link to="IMedium::location"/>
    7349         </see>
    7350       </desc>
    7351     </attribute>
    7352 
    73537330    <attribute name="mediumFormats" type="IMediumFormat" safearray="yes" readonly="yes">
    73547331      <desc>
     
    88178794      If the storage unit of the hard disk is a regular file in the host's
    88188795      file system then the rules stated in the description of the
    8819       <link to="IMedium::location"/> attribute apply when setting its value. In
    8820       addition, a plain file name without any path may be given, in which case
    8821       the <link to="ISystemProperties::defaultHardDiskFolder"> default hard disk
    8822       folder</link> will be prepended to it.
     8796      <link to="IMedium::location"/> attribute apply when setting its value.
    88238797
    88248798      <h4>Automatic composition of the file name part</h4>
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r33060 r33238  
    121121    HRESULT searchUniqueVMName(Utf8Str& aName) const;
    122122    HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
    123     HRESULT getDefaultHardDiskFolder(Utf8Str &str) const;
    124123    void waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis, ComPtr<IProgress> &pProgressAsync);
    125124    void addWarning(const char* aWarning, ...);
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r33060 r33238  
    147147    // input parameters from VirtualSystemDescriptions
    148148    Utf8Str                         strNameVBox;        // VM name
     149    Utf8Str                         strMachineFolder;   // FQ host folder where the VirtualBox machine would be created
    149150    Utf8Str                         strOsTypeVBox;      // VirtualBox guest OS type as string
    150151    Utf8Str                         strDescription;
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r32531 r33238  
    7575    STDMETHOD(COMGETTER(DefaultMachineFolder))(BSTR *aDefaultMachineFolder);
    7676    STDMETHOD(COMSETTER(DefaultMachineFolder))(IN_BSTR aDefaultMachineFolder);
    77     STDMETHOD(COMGETTER(DefaultHardDiskFolder))(BSTR *aDefaultHardDiskFolder);
    78     STDMETHOD(COMSETTER(DefaultHardDiskFolder))(IN_BSTR aDefaultHardDiskFolder);
    7977    STDMETHOD(COMGETTER(MediumFormats))(ComSafeArrayOut(IMediumFormat *, aMediumFormats));
    8078    STDMETHOD(COMGETTER(DefaultHardDiskFormat))(BSTR *aDefaultHardDiskFormat);
     
    118116
    119117    HRESULT setDefaultMachineFolder(const Utf8Str &aPath);
    120     HRESULT setDefaultHardDiskFolder(const Utf8Str &aPath);
    121118    HRESULT setDefaultHardDiskFormat(const Utf8Str &aFormat);
    122119
     
    129126
    130127    Utf8Str             m_strDefaultMachineFolderFull;
    131     Utf8Str             m_strDefaultHardDiskFolderFull;
    132128
    133129    MediumFormatList    m_llMediumFormats;
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r33232 r33238  
    122122
    123123    /* IVirtualBox methods */
     124    STDMETHOD(ComposeMachineFilename) (IN_BSTR aName, IN_BSTR aBaseFolder, BSTR *aFilename);
    124125    STDMETHOD(CreateMachine) (IN_BSTR aName, IN_BSTR aOsTypeId, IN_BSTR aBaseFolder,
    125126                              IN_BSTR aId, BOOL aOverride, IMachine **aMachine);
     
    241242
    242243    void getDefaultMachineFolder(Utf8Str &str) const;
    243     void getDefaultHardDiskFolder(Utf8Str &str) const;
    244244    void getDefaultHardDiskFormat(Utf8Str &str) const;
    245245
  • trunk/src/VBox/Main/xml/Settings.cpp

    r33201 r33238  
    12281228                    {
    12291229                        pelmGlobalChild->getAttributeValue("defaultMachineFolder", systemProperties.strDefaultMachineFolder);
    1230                         if (!pelmGlobalChild->getAttributeValue("defaultHardDiskFolder", systemProperties.strDefaultHardDiskFolder))
    1231                             // pre-1.4 used @defaultVDIFolder instead
    1232                             pelmGlobalChild->getAttributeValue("defaultVDIFolder", systemProperties.strDefaultHardDiskFolder);
    12331230                        pelmGlobalChild->getAttributeValue("defaultHardDiskFormat", systemProperties.strDefaultHardDiskFormat);
    12341231                        pelmGlobalChild->getAttributeValue("remoteDisplayAuthLibrary", systemProperties.strRemoteDisplayAuthLibrary);
     
    13361333    if (systemProperties.strDefaultMachineFolder.length())
    13371334        pelmSysProps->setAttribute("defaultMachineFolder", systemProperties.strDefaultMachineFolder);
    1338     if (systemProperties.strDefaultHardDiskFolder.length())
    1339         pelmSysProps->setAttribute("defaultHardDiskFolder", systemProperties.strDefaultHardDiskFolder);
    13401335    if (systemProperties.strDefaultHardDiskFormat.length())
    13411336        pelmSysProps->setAttribute("defaultHardDiskFormat", systemProperties.strDefaultHardDiskFormat);
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