VirtualBox

Ignore:
Timestamp:
Oct 13, 2008 4:51:18 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37799
Message:

VirtualBox.xidl: improve API documentation for session APIs

File:
1 edited

Legend:

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

    r13221 r13227  
    18961896        Opens a new direct session with the given virtual machine.
    18971897
    1898         Within the direct session context, it is possible to change
    1899         all VM settings, as well as to execute the VM in the process
    1900         space of the session object. There can be only one direct
    1901         session open at a time for every virtual machine. In VirtualBox
    1902         terminology, the machine becomes "mutable" after a session has
    1903         been opened.
     1898        A direct session acts as a local lock on the given VM.
     1899        There can be only one direct session open at a time for every
     1900        virtual machine, protecting the VM from being manipulated by
     1901        conflicting actions from different processes. Only after a
     1902        direct session has been opened, one can change all VM settings
     1903        and execute the VM in the process space of the session object.
     1904
     1905        Sessions therefore can be compared to mutex semaphores that
     1906        lock a given VM for modification and execution.
     1907        See <link to="ISession">ISession</link> for details.
     1908
     1909        <note>Unless you are writing a new VM frontend, you will not
     1910        want to execute a VM in the current process. To spawn a new
     1911        process that executes a VM, use
     1912        <link to="IVirtualBox::openRemoteSession" />
     1913        instead.</note>
    19041914
    19051915        Upon successful return, the session object can be used to
    19061916        get access to the machine and to the VM console.
    19071917
    1908         Note that the "mutable" machine object, on which you may want
    1909         to invoke IMachine methods to change its settings, will be a
    1910         different object from the immutable IMachine objects returned
    1911         by various IVirtualBox methods. To obtain a mutable
    1912         IMachine object, upon which you can invoke settings methods,
    1913         use the "machine" attribute of the ISession object which represents
    1914         your open session.
     1918        In VirtualBox terminology, the machine becomes "mutable" after
     1919        a session has been opened. Note that the "mutable" machine
     1920        object, on which you may invoke IMachine methods to change its
     1921        settings, will be a different object from the immutable IMachine
     1922        objects returned by various IVirtualBox methods. To obtain a
     1923        mutable IMachine object (upon which you can invoke settings methods),
     1924        use the <link to="ISession::machine" /> attribute.
     1925
     1926        One must always call <link to="ISession::close" /> to release the
     1927        lock on the machine, or the machine's state will eventually be
     1928        set to "Aborted".
    19151929
    19161930        In other words, to change settings on a machine, the following
     
    19211935        the current session.</li>
    19221936
    1923         <li>Obtain a mutable IMachine object from ISession::machine.</li>
     1937        <li>Obtain a mutable IMachine object from <link to="ISession::machine" />.</li>
    19241938
    19251939        <li>Change the settings of the machine.</li>
    19261940
    1927         <li>Call IMachine::saveSettings.</li>
    1928 
    1929         <li>Close the session by calling <link to="#close" />.</li>
     1941        <li>Call <link to="IMachine::saveSettings" />.</li>
     1942
     1943        <li>Close the session by calling <link to="ISession::close" />.</li>
    19301944        </ol>
    19311945      </desc>
     
    19481962    <method name="openRemoteSession">
    19491963      <desc>
    1950         Opens a new remote session with the given virtual machine.
     1964        Spawns a new process that executes a virtual machine (called a
     1965        "remote session").
    19511966
    19521967        Opening a remote session causes the VirtualBox server to start a new
    1953         process that opens a direct session with the given VM.  The remote
    1954         session provides some level of control over the VM execution to the
    1955         caller (using the IConsole interface); however, within the remote
    1956         session context, not all VM settings are available for modification.
     1968        process that opens a direct session with the given VM. As a result, the
     1969        VM is locked by that direct session in the new process, preventing
     1970        conflicting changes from other processes. Since sessions act as locks
     1971        that such prevent conflicting changes, one cannot open a remote session
     1972        for a VM that already has another open session (direct or remote), or
     1973        is currently in the process of opening one (see <link to="IMachine::sessionState"/>).
     1974
     1975        While the remote session still provides some level of control over the
     1976        VM execution to the caller (using the <link to="IConsole" /> interface),
     1977        not all VM settings are available for modification within the remote
     1978        session context.
    19571979
    19581980        This operation can take some time (a new VM is started in a new process,
    1959         for which memory and other resources need to be set up, which can take
    1960         a few seconds). Because of this, a progress object is returned to allow the
    1961         caller to wait for this asynchronous operation to be completed. Until then,
    1962         the remote session object remains in the closed state and accessing the
    1963         machine or its console through it is invalid. It is recommended to use
     1981        for which memory and other resources need to be set up). Because of this,
     1982        an <link to="IProgress" /> is returned to allow the caller to wait for this
     1983        asynchronous operation to be completed. Until then, the remote session
     1984        object remains in the closed state, and accessing the machine or its
     1985        console through it is invalid. It is recommended to use
    19641986        <link to="IProgress::waitForCompletion" /> or similar calls to wait for
    19651987        completion.
     1988
     1989        As with all <link to="ISession" /> objects, it is recommended to call
     1990        <link to="ISession::close" /> on the local session object once openRemoteSession()
     1991        has been called. However, the session's state (see <link to="ISession::state" />)
     1992        will not return to "Closed" until the remote session has also closed (i.e.
     1993        until the VM is no longer running). In that case, however, the state of
     1994        the session will automatically change back to "Closed".
    19661995
    19671996        Currently supported session types (values of the @a type
     
    19872016        If the environment string is @c null, the server environment is
    19882017        inherited by the started process as is.
    1989 
    1990         <note>
    1991           It is an error to open a remote session with the machine
    1992           that already has an open direct session or waits until the
    1993           previous request to open the remote session is completed
    1994           (see <link to="IMachine::sessionState"/>).
    1995         </note>
    1996 
    1997         <note>
    1998           The opened @a session will be automatically closed when
    1999           the corresponding direct session dies or gets closed.
    2000         </note>
    20012018
    20022019        <see>openExistingSession</see>
     
    1014310160      machines.
    1014410161
    10145       Within VirtualBox, every time one wishes to manipulate a virtual machine
    10146       (for example, change its settings or start execution), an instance of
    10147       the ISession interface is required. One first creates a local session
    10148       object that implements the ISession interface and then passes the
    10149       created object with the method call that opens the given session and
    10150       thus initiates the machine manipulation. The session serves several
    10151       purposes: it identifies to the inter-process VirtualBox code which
    10152       process is currently working with the virtual machine, and it ensures
     10162      With VirtualBox, every time one wishes to manipulate a virtual machine
     10163      (e.g. change its settings or start execution), a session object is
     10164      required. Such an object must be passed to one of the session methods
     10165      that open the given session, which then initiates the machine manipulation.
     10166
     10167      A session serves several purposes: it identifies to the inter-process VirtualBox
     10168      code which process is currently working with the virtual machine, and it ensures
    1015310169      that there are no incompatible requests from several processes for the
    10154       same virtual machine.
     10170      same virtual machine. Session objects can therefore be thought of as mutex
     10171      semaphores that lock virtual machines to prevent conflicting accesses from
     10172      several processes.
    1015510173
    1015610174      How sessions objects are used depends on whether you use the Main API
    10157       via COM or via the web service:
     10175      via COM or via the webservice:
    1015810176
    1015910177      <ul>
     
    1023410252    <method name="close">
    1023510253      <desc>
    10236         Closes this session.
    10237         <note>
    10238           If a direct session for a machine opened with
    10239           <link to="IVirtualBox::openSession()"/> is not explicitly
    10240           closed when the application terminates, the state of the
    10241           machine will be set to <link to="MachineState::Aborted"/>
    10242           on the server. Generally, it is recommended to close all
    10243           open sessions explicitly before terminating the application
    10244           (no matter what is the reason of the termination).
     10254        Closes a session that was previously opened.
     10255
     10256        It is recommended that every time an "open session" method (such as
     10257        <link to="IVirtualBox::openRemoteSession" /> or
     10258        <link to="IVirtualBox::openSession" />) has been called to
     10259        manipulate a virtual machine, the caller invoke
     10260        ISession::close() when it's done doing so. Since sessions are
     10261        serialization primitives much like ordinary mutexes, they are
     10262        best used the same way: for each "open" call, there should be
     10263        a matching "close" call, even when errors occur.
     10264
     10265        Otherwise, if a direct session for a machine opened with
     10266        <link to="IVirtualBox::openSession()"/> is not explicitly closed
     10267        when the application terminates, the state of the machine will
     10268        be set to <link to="MachineState::Aborted" /> on the server.
     10269
     10270        Generally, it is recommended to close all open sessions explicitly
     10271        before terminating the application (no matter what is the reason of
     10272        the termination).
     10273
     10274        <note>
     10275          Do not expect the session state (<link to="ISession::state" />
     10276          to return to "Closed" immediately after you invoke
     10277          ISession::close(), particularly if you have started a remote
     10278          session to execute the VM in a new process. The session state will
     10279          automatically return to "Closed" once the VM is no longer executing,
     10280          which can of course take a very long time.
    1024510281        </note>
    1024610282      </desc>
     
    1049510531      sub-metrics are collected when their base metric is collected.
    1049610532      Collected values for any set of sub-metrics can be queried with
    10497       <link to="IPerformanceCollector::queryMetricsData" />. When setting up 
    10498       metric parameters, querying metric data, enabling or disabling metrics 
    10499       wildcards can be used in metric names to specify a subset of metrics. For 
    10500       example, to select all CPU-related metrics use <tt>CPU/*</tt>, all 
    10501       averages can be queried using <tt>*:avg</tt> and so on. To query metric 
     10533      <link to="IPerformanceCollector::queryMetricsData" />. When setting up
     10534      metric parameters, querying metric data, enabling or disabling metrics
     10535      wildcards can be used in metric names to specify a subset of metrics. For
     10536      example, to select all CPU-related metrics use <tt>CPU/*</tt>, all
     10537      averages can be queried using <tt>*:avg</tt> and so on. To query metric
    1050210538      values without aggregates <tt>*:</tt> can be used.
    1050310539
     
    1059710633    <method name="setupMetrics">
    1059810634      <desc>
    10599         Sets parameters of specified base metrics for a set of objects. Returns 
    10600         an array of <link to="IPerformanceMetric" /> describing the metrics have 
     10635        Sets parameters of specified base metrics for a set of objects. Returns
     10636        an array of <link to="IPerformanceMetric" /> describing the metrics have
    1060110637        been affected.
    1060210638        <note>
    1060310639          @c Null or empty metric name array means all metrics. @c Null or empty
    10604           object array means all existing objects. If metric name array contains 
    10605           a single element and object array contains many, the single metric 
    10606           name array element is applied to each object array element to form 
     10640          object array means all existing objects. If metric name array contains
     10641          a single element and object array contains many, the single metric
     10642          name array element is applied to each object array element to form
    1060710643          metric/object pairs.
    1060810644        </note>
     
    1061010646      <param name="metricNames" type="wstring" dir="in" safearray="yes">
    1061110647        <desc>
    10612           Metric name filter. Comma-separated list of metrics with wildcard 
     10648          Metric name filter. Comma-separated list of metrics with wildcard
    1061310649          support.
    1061410650        </desc>
     
    1064510681        <note>
    1064610682          @c Null or empty metric name array means all metrics. @c Null or empty
    10647           object array means all existing objects. If metric name array contains 
    10648           a single element and object array contains many, the single metric 
    10649           name array element is applied to each object array element to form 
     10683          object array means all existing objects. If metric name array contains
     10684          a single element and object array contains many, the single metric
     10685          name array element is applied to each object array element to form
    1065010686          metric/object pairs.
    1065110687        </note>
     
    1065310689      <param name="metricNames" type="wstring" dir="in" safearray="yes">
    1065410690        <desc>
    10655           Metric name filter. Comma-separated list of metrics with wildcard 
     10691          Metric name filter. Comma-separated list of metrics with wildcard
    1065610692          support.
    1065710693        </desc>
     
    1067610712        <note>
    1067710713          @c Null or empty metric name array means all metrics. @c Null or empty
    10678           object array means all existing objects. If metric name array contains 
    10679           a single element and object array contains many, the single metric 
    10680           name array element is applied to each object array element to form 
     10714          object array means all existing objects. If metric name array contains
     10715          a single element and object array contains many, the single metric
     10716          name array element is applied to each object array element to form
    1068110717          metric/object pairs.
    1068210718        </note>
     
    1068410720      <param name="metricNames" type="wstring" dir="in" safearray="yes">
    1068510721        <desc>
    10686           Metric name filter. Comma-separated list of metrics with wildcard 
     10722          Metric name filter. Comma-separated list of metrics with wildcard
    1068710723          support.
    1068810724        </desc>
     
    1070510741
    1070610742        The data itself and related metric information are returned in seven
    10707         parallel and one flattened array of arrays. Elements of 
     10743        parallel and one flattened array of arrays. Elements of
    1070810744        <tt>returnMetricNames, returnObjects, returnUnits, returnScales,
    10709         returnSequenceNumbers, returnDataIndices and returnDataLengths</tt> with 
    10710         the same index describe one set of values corresponding to a single 
     10745        returnSequenceNumbers, returnDataIndices and returnDataLengths</tt> with
     10746        the same index describe one set of values corresponding to a single
    1071110747        metric.
    1071210748
    10713         The <tt>returnData</tt> parameter is a flattened array of arrays. Each 
    10714         start and length of a sub-array is indicated by 
    10715         <tt>returnDataIndices</tt> and <tt>returnDataLengths</tt>. The first 
    10716         value for metric <tt>metricNames[i]</tt> is at 
     10749        The <tt>returnData</tt> parameter is a flattened array of arrays. Each
     10750        start and length of a sub-array is indicated by
     10751        <tt>returnDataIndices</tt> and <tt>returnDataLengths</tt>. The first
     10752        value for metric <tt>metricNames[i]</tt> is at
    1071710753        <tt>returnData[returnIndices[i]]</tt>.
    1071810754
    1071910755        <note>
    1072010756          @c Null or empty metric name array means all metrics. @c Null or empty
    10721           object array means all existing objects. If metric name array contains 
    10722           a single element and object array contains many, the single metric 
    10723           name array element is applied to each object array element to form 
     10757          object array means all existing objects. If metric name array contains
     10758          a single element and object array contains many, the single metric
     10759          name array element is applied to each object array element to form
    1072410760          metric/object pairs.
    1072510761        </note>
     
    1073810774      <param name="metricNames" type="wstring" dir="in" safearray="yes">
    1073910775        <desc>
    10740           Metric name filter. Comma-separated list of metrics with wildcard 
     10776          Metric name filter. Comma-separated list of metrics with wildcard
    1074110777          support.
    1074210778        </desc>
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