VirtualBox

Changeset 7283 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 4, 2008 8:45:05 PM (17 years ago)
Author:
vboxsync
Message:

Main: improve session documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r7207 r7283  
    927927    </attribute>
    928928
    929         <attribute name="machines" type="IMachineCollection" readonly="yes">
     929    <attribute name="machines" type="IMachineCollection" readonly="yes">
    930930      <desc>
    931931        Collection of machine objects registered within this VirtualBox
     
    980980        Creates a new virtual machine.
    981981
     982        The new machine will have "empty" default settings and will not
     983        yet be registered. The typical sequence to create a virtual machine
     984        is therefore something like this:
     985
     986        <ol>
     987           <li>Call this method (IVirtualBox::createMachine) to have a new
     988           machine created. The machine object returned is "mutable", i.e.
     989           automatically locked for the current session, as if
     990           <link to="#openSession" /> had been called on it.</li>
     991
     992           <li>Assign meaningful settings to the new machine by calling the
     993           respective methods.</li>
     994
     995           <li>Call <link to="IMachine::saveSettings" /> to have the settings written
     996           to the machine's XML settings file. The configuration of the newly
     997           created machine will not be saved to disk (and the settings subfolder
     998           and file, as described below, will not be created) until this method
     999           is called.</li>
     1000
     1001           <li>Call <link to="#registerMachine" /> to have the
     1002           machine show up in the list of machines registered with VirtualBox.</li>
     1003        </ol>
     1004
    9821005        Every machine has a <i>settings file</i> that is used to store
    9831006        the machine configuration. This file is stored in the directory
    984         called <i>machine settings subfolder</i>. Both the subfolder
    985         and the settings file have the same name that corresponds to the
    986         name of the virtual machine. You can specify where
    987         to create the machine settings subfolder using the @a
     1007        called <i>machine settings subfolder</i>. Unless specified otherwise,
     1008        both the subfolder and the settings file will have a name that
     1009        corresponds to the name of the virtual machine. You can specify
     1010        where to create the machine settings subfolder using the @a
    9881011        baseFolder argument. The base folder can be absolute (full path)
    9891012        or relative to the <link to="IVirtualBox::homeFolder">
     
    10011024        not desired (i.e. a new UUID should be generated), pass just an
    10021025        empty or null UUID.
    1003 
    1004         Note that the configuration of the newly created machine is not
    1005         saved to disk (and therefore no settings subfolder and file are
    1006         created) until <link to="IMachine::saveSettings()"/> is called.
    10071026
    10081027        You should also specify a valid name for the machine.
     
    17391758        all VM settings, as well as to execute the VM in the process
    17401759        space of the session object. There can be only one direct
    1741         session open at a time for every virtual machine.
     1760        session open at a time for every virtual machine. In VirtualBox
     1761        terminology, the machine becomes "mutable" after a session has
     1762        been opened.
    17421763
    17431764        Upon successful return, the session object can be used to
    17441765        get access to the machine and to the VM console.
     1766
     1767        Note that the "mutable" machine object, on which you may want
     1768        to invoke IMachine methods to change its settings, will be a
     1769        different object from the immutable IMachine objects returned
     1770        by various IVirtualBox methods. To obtain a mutable
     1771        IMachine object, upon which you can invoke settings methods,
     1772        use the "machine" attribute of the ISession object which represents
     1773        your open session.
     1774
     1775        In other words, to change settings on a machine, the following
     1776        sequence is typically performed:
     1777
     1778        <ol>
     1779        <li>Call this method (openSession) to have a machine locked for
     1780        the current session.</li>
     1781
     1782        <li>Obtain a mutable IMachine object from ISession::machine.</li>
     1783
     1784        <li>Change the settings of the machine.</li>
     1785
     1786        <li>Call IMachine::saveSettings.</li>
     1787
     1788        <li>Close the session by calling <link to="#close" />.</li>
     1789        </ol>
    17451790      </desc>
    17461791      <param name="session" type="ISession" dir="in">
     
    93819426      same virtual machine.
    93829427
    9383       When using the COM API directly, an object of the Session class from the
    9384       VirtualBox type library needs to be created. This object will then act
    9385       as a local session object in further calls to open a session.
    9386 
    9387       In the webservice, the session manager creates one session object during
    9388       <link to="IWebsessionManager::logon" /> automatically; a managed object
    9389       reference to that session object can be retrieved by calling
    9390       <link to="IWebsessionManager::getSessionObject" />.
    9391 
     9428      How sessions objects are used depends on whether you use the Main API
     9429      via COM or via the web service:
     9430
     9431      <ul>
     9432      <li>When using the COM API directly, an object of the Session class from the
     9433      VirtualBox type library needs to be created. In regular COM C++ client code,
     9434      this can be done by calling <tt>createLocalObject()</tt>, a standard COM API.
     9435      This object will  then act as a local session object in further calls to open
     9436      a session.
     9437      </li>
     9438
     9439      <li>In the webservice, the session manager (IWebsessionManager) instead creates
     9440      one session object automatically when <link to="IWebsessionManager::logon" />
     9441      is called. A managed object reference to that session object can be retrieved by
     9442      calling <link to="IWebsessionManager::getSessionObject" />. This session object
     9443      reference can then be used to open sessions.
     9444      </li>
     9445      </ul>
     9446
     9447      Sessions are mainly used in two variations:
     9448
     9449      <ul>
     9450      <li>
    93929451      To start a virtual machine in a separate process, one would call
    93939452      <link to="IVirtualBox::openRemoteSession"/>, which requires a session
     
    93969455      execution or power it down) as well as be notified about machine
    93979456      execution state changes.
    9398 
    9399       To alter machine settings, or to start machine execution within its own
    9400       process, one needs to open a direct session for the machine first by
    9401       calling <link to="IVirtualBox::openSession"/>. Once the direct session
    9402       is successfully opened within one process, no any other process may open
    9403       a direct session for the same machine as long as the successful direct
    9404       session remains open. This prevents the machine from being changed by
    9405       other processes while it is running or while the machine is being
    9406       configured.
     9457      </li>
     9458
     9459      <li>To alter machine settings, or to start machine execution within the
     9460      current process, one needs to open a direct session for the machine first by
     9461      calling <link to="IVirtualBox::openSession"/>. While a direct session
     9462      is open within one process, no any other process may open another direct
     9463      session for the same machine. This prevents the machine from being changed
     9464      by other processes while it is running or while the machine is being configured.
     9465      </li>
     9466      </ul>
    94079467
    94089468      One also can attach to an existing direct session alreay opened by
     
    94109470      virtual machine such as the pause or the reset request). This is done by
    94119471      calling <link to="IVirtualBox::openExistingSession"/>.
    9412 
    9413       In regular COM C++ client code, one can simply create a session object,
    9414       for example by calling <tt>createLocalObject().</tt>
    94159472
    94169473      <note>
Note: See TracChangeset for help on using the changeset viewer.

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