VirtualBox

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


Ignore:
Timestamp:
Feb 27, 2007 5:33:11 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18964
Message:

Main: Added new IMachine attributes: description, sessionType and sessionPid.

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

Legend:

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

    r1071 r1077  
    795795}
    796796
     797STDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription)
     798{
     799    if (!aDescription)
     800        return E_POINTER;
     801
     802    AutoCaller autoCaller (this);
     803    CheckComRCReturnRC (autoCaller.rc());
     804
     805    AutoReaderLock alock (this);
     806
     807    mUserData->mDescription.cloneTo (aDescription);
     808
     809    return S_OK;
     810}
     811
     812STDMETHODIMP Machine::COMSETTER(Description) (INPTR BSTR aDescription)
     813{
     814    AutoCaller autoCaller (this);
     815    CheckComRCReturnRC (autoCaller.rc());
     816
     817    AutoLock alock (this);
     818
     819    CHECK_SETTER();
     820
     821    mUserData.backup();
     822    mUserData->mDescription = aDescription;
     823
     824    return S_OK;
     825}
     826
    797827STDMETHODIMP Machine::COMGETTER(Id) (GUIDPARAMOUT aId)
    798828{
     
    11771207}
    11781208
    1179 STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *sessionState)
    1180 {
    1181     if (!sessionState)
     1209STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState)
     1210{
     1211    if (!aSessionState)
    11821212        return E_POINTER;
    11831213
     
    11871217    AutoReaderLock alock (this);
    11881218
    1189     *sessionState = mData->mSession.mState;
     1219    *aSessionState = mData->mSession.mState;
     1220
     1221    return S_OK;
     1222}
     1223
     1224STDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType)
     1225{
     1226    if (!aSessionType)
     1227        return E_POINTER;
     1228
     1229    AutoCaller autoCaller (this);
     1230    CheckComRCReturnRC (autoCaller.rc());
     1231
     1232    AutoReaderLock alock (this);
     1233
     1234    mData->mSession.mType.cloneTo (aSessionType);
     1235
     1236    return S_OK;
     1237}
     1238
     1239STDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid)
     1240{
     1241    if (!aSessionPid)
     1242        return E_POINTER;
     1243
     1244    AutoCaller autoCaller (this);
     1245    CheckComRCReturnRC (autoCaller.rc());
     1246
     1247    AutoReaderLock alock (this);
     1248
     1249    *aSessionPid = mData->mSession.mPid;
    11901250
    11911251    return S_OK;
     
    23672427    AssertReturn (mData->mMachineState < MachineState_Running, E_FAIL);
    23682428
     2429    /* get the sesion PID */
     2430    RTPROCESS pid = NIL_RTPROCESS;
     2431    AssertCompile (sizeof (ULONG) == sizeof (RTPROCESS));
     2432    aControl->GetPID ((ULONG *) &pid);
     2433    Assert (pid != NIL_RTPROCESS);
     2434
    23692435    if (mData->mSession.mState == SessionState_SessionSpawning)
    23702436    {
    2371         /*
    2372          *  this machine awaits for a spawning session to be opened,
    2373          *  so reject any other open attempts from processes other than
    2374          *  one started by #openRemoteSession().
    2375          */
    2376 
    2377         RTPROCESS pid = NIL_RTPROCESS; AssertCompile (sizeof (ULONG) == sizeof (RTPROCESS));
    2378         aControl->GetPID ((ULONG *)&pid);
     2437        /* This machine is awaiting for a spawning session to be opened, so
     2438         * reject any other open attempts from processes other than one
     2439         * started by #openRemoteSession(). */
    23792440
    23802441        LogFlowThisFunc (("mSession.mPid=%d(0x%x)\n",
     
    24762537        /* Note that the progress object is finalized later */
    24772538
    2478         /* We don't reset mSession.mPid here because it is necessary for
    2479          * SessionMachine::uninit() to reap the child process later. */
     2539        /* We don't reset mSession.mPid and mType here because both are
     2540         * necessary for SessionMachine::uninit() to reap the child process
     2541         * later. */
    24802542
    24812543        if (FAILED (rc))
     
    24862548            mData->mSession.mState = SessionState_SessionClosed;
    24872549        }
     2550    }
     2551    else
     2552    {
     2553        /* memorize PID of the directly opened session */
     2554        if (SUCCEEDED (rc))
     2555            mData->mSession.mPid = pid;
    24882556    }
    24892557
     
    26362704    mData->mSession.mPid = pid;
    26372705    mData->mSession.mState = SessionState_SessionSpawning;
     2706    mData->mSession.mType = type;
    26382707
    26392708    LogFlowThisFuncLeave();
     
    30553124            CFGLDRQueryBool (machineNode, "nameSync", &nameSync);
    30563125            mUserData->mNameSync = nameSync;
     3126        }
     3127
     3128        /* Description (optional, default is null) */
     3129        {
     3130            CFGNODE descNode = 0;
     3131            CFGLDRGetChildNode (machineNode, "Description", 0, &descNode);
     3132            if (descNode)
     3133            {
     3134                CFGLDRQueryBSTR (descNode, NULL,
     3135                                 mUserData->mDescription.asOutParam());
     3136                CFGLDRReleaseNode (descNode);
     3137            }
     3138            else
     3139                mUserData->mDescription.setNull();
    30573140        }
    30583141
     
    32903373            CFGNODE descNode = 0;
    32913374            CFGLDRGetChildNode (aNode, "Description", 0, &descNode);
    3292             CFGLDRQueryBSTR (descNode, NULL, description.asOutParam());
    3293             CFGLDRReleaseNode (descNode);
     3375            if (descNode)
     3376            {
     3377                CFGLDRQueryBSTR (descNode, NULL, description.asOutParam());
     3378                CFGLDRReleaseNode (descNode);
     3379            }
    32943380        }
    32953381
     
    46824768            CFGLDRDeleteAttribute (machineNode, "nameSync");
    46834769
     4770        /* Description node (optional) */
     4771        if (!mUserData->mDescription.isNull())
     4772        {
     4773            CFGNODE descNode = 0;
     4774            CFGLDRCreateChildNode (machineNode, "Description", &descNode);
     4775            Assert (descNode);
     4776            CFGLDRSetBSTR (descNode, NULL, mUserData->mDescription);
     4777            CFGLDRReleaseNode (descNode);
     4778        }
     4779        else
     4780        {
     4781            CFGNODE descNode = 0;
     4782            CFGLDRGetChildNode (machineNode, "Description", 0, &descNode);
     4783            if (descNode)
     4784                CFGLDRDeleteNode (descNode);
     4785        }
     4786
    46844787        /* OSType (required) */
    46854788        {
     
    50995202
    51005203    /* Description node (optional) */
     5204    if (!aSnapshot->data().mDescription.isNull())
    51015205    {
    51025206        CFGNODE descNode = 0;
    51035207        CFGLDRCreateChildNode (aNode, "Description", &descNode);
     5208        Assert (descNode);
    51045209        CFGLDRSetBSTR (descNode, NULL, aSnapshot->data().mDescription);
    51055210        CFGLDRReleaseNode (descNode);
     5211    }
     5212    else
     5213    {
     5214        CFGNODE descNode = 0;
     5215        CFGLDRGetChildNode (aNode, "Description", 0, &descNode);
     5216        if (descNode)
     5217            CFGLDRDeleteNode (descNode);
    51065218    }
    51075219
     
    70867198    mParent->host()->releaseAllUSBDevices (this);
    70877199
    7088     if (mData->mSession.mPid != NIL_RTPROCESS)
    7089     {
    7090         /*
    7091          *  pid is not NIL, meaning this machine's process has been started
    7092          *  using VirtualBox::OpenRemoteSession(), thus it is our child.
    7093          *  we need to queue this pid to be reaped (to avoid zombies on Linux)
    7094          */
     7200    if (!mData->mSession.mType.isNull())
     7201    {
     7202        /* mType is not null when this machine's process has been started by
     7203         * VirtualBox::OpenRemoteSession(), therefore it is our child.  We
     7204         * need to queue the PID to reap the process (and avoid zombies on
     7205         * Linux). */
     7206        Assert (mData->mSession.mPid != NIL_RTPROCESS);
    70957207        mParent->addProcessToReap (mData->mSession.mPid);
    7096         mData->mSession.mPid = NIL_RTPROCESS;
    7097     }
     7208    }
     7209
     7210    mData->mSession.mPid = NIL_RTPROCESS;
    70987211
    70997212    if (aReason == Uninit::Unexpected)
    71007213    {
    7101         /*
    7102          *  uninitialization didn't come from #checkForDeath(), so tell the
    7103          *  client watcher thread to update the set of machines that have
    7104          *  open sessions.
    7105          */
     7214        /* Uninitialization didn't come from #checkForDeath(), so tell the
     7215         * client watcher thread to update the set of machines that have open
     7216         * sessions. */
    71067217        mParent->updateClientWatcher();
    71077218    }
     
    71627273    mData->mSession.mMachine.setNull();
    71637274    mData->mSession.mState = SessionState_SessionClosed;
     7275    mData->mSession.mType.setNull();
    71647276
    71657277    /* close the interprocess semaphore before leaving the shared lock */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r953 r1077  
    13691369                it is invalid.
    13701370                </p>
     1371
     1372                Currently supported session types (values of the @a type
     1373                parameter) are:
     1374                <ul>
     1375                    <li><tt>gui</tt>: VirtualBox Qt GUI session</li>
     1376                    <li><tt>vrdp</tt>: VirtualBox VRDP Server session</li>
     1377                </ul>
     1378
    13711379                <note>
    13721380                    It is impossible to open a remote session with the machine
     
    13751383                    (see <link to="IMachine::sessionState"/>).
    13761384                </note>
     1385
     1386                <note>
     1387                    The opened @a session will be automatically closed when
     1388                    the corresponding direct session dies or gets closed.
     1389                </note>
     1390
    13771391                <see>openExistingSession</see>
    13781392            </desc>
     
    13801394                <desc>
    13811395                    Session object that will represent the opened remote session
    1382                     after successful method invocation. This object must not
    1383                     represent an already open session.
    1384                     <note>
    1385                         This session will be automatically closed when the peer
    1386                         (direct) session dies or gets closed.
    1387                     </note>
     1396                    after successful method invocation (this object must not
     1397                    represent an already open session).
    13881398                </desc>
    13891399            </param>
     
    13931403            <param name="type" type="wstring" dir="in">
    13941404                <desc>
    1395                     Type of the remote session (case sensitive). Currently
    1396                     supported values are:
    1397                     <ul>
    1398                         <li><tt>gui</tt>: Qt-based VM session</li>
    1399                         <li><tt>rdp</tt>: VRDP server session</li>
    1400                     </ul>
     1405                    Type of the remote session (case sensitive).
    14011406                </desc>
    14021407            </param>
     
    17601765    <interface
    17611766        name="IMachine" extends="$unknown"
    1762         uuid="FD443EC1-0009-4F5B-9282-D72760A66916"
     1767        uuid="50fa9181-d2d4-45ca-bf0e-742677b9c707"
    17631768    >
    17641769        <attribute name="parent" type="IVirtualBox" readonly="yes">
     
    18761881        </attribute>
    18771882
     1883        <attribute name="description" type="wstring">
     1884            <desc>
     1885                Description of the virtual machine.
     1886
     1887                The description attribute can contain any text and is
     1888                typically used to describe the hardware and software
     1889                configuration of the virtual machine in detail (i.e. network
     1890                settings, versions of the installed software and so on).
     1891            </desc>
     1892        </attribute>
     1893
    18781894        <attribute name="id" type="uuid" readonly="yes">
    18791895            <desc>UUID of the virtual machine.</desc>
     
    20012017        <attribute name="sessionState" type="SessionState" readonly="yes">
    20022018            <desc>Current session state for this machine.</desc>
     2019        </attribute>
     2020
     2021        <attribute name="sessionType" type="wstring" readonly="yes">
     2022            <desc>
     2023                Type of the session.  If <link to="#sessionState"/> is
     2024                SessionSpawning or SessionOpen, this attribute contains the
     2025                same value as passed to the
     2026                <link to="IVirtualBox::openRemoteSession()"/> method in the @a
     2027                type parameter. If the session was opened directly using
     2028                <link to="IVirtualBox::openSession()"/>, or if
     2029                <link to="#sessionState"/> is SessionClosed, the value of this
     2030                attribute is @c null.
     2031            </desc>
     2032        </attribute>
     2033
     2034        <attribute name="sessionPid" type="unsigned long" readonly="yes">
     2035            <desc>
     2036                Identifier of the session process. This attribute contains the
     2037                platform-dependent identifier of the process that has opened a
     2038                direct session for this machine using the
     2039                <link to="IVirtualBox::openSession()"/> call. The returned value
     2040                is only valid if <link to="#sessionState"/> is SessionOpen or
     2041                SessionClosing (i.e. a session is currently open or being
     2042                closed) by the time this property is read.
     2043            </desc>
    20032044        </attribute>
    20042045
  • trunk/src/VBox/Main/include/MachineImpl.h

    r606 r1077  
    142142            RTPROCESS mPid;
    143143
    144             /** current session state */
     144            /** Current session state */
    145145            SessionState_T mState;
    146146
    147             /** sesison machine object */
     147            /** Session type string (for indirect sessions) */
     148            Bstr mType;
     149
     150            /** Sesison machine object */
    148151            ComObjPtr <SessionMachine> mMachine;
    149152        };
     
    210213                   (mName == that.mName &&
    211214                    mNameSync == that.mNameSync &&
     215                    mDescription == that.mDescription &&
    212216                    mOSType.equalsTo (that.mOSType) &&
    213217                    mSnapshotFolderFull == that.mSnapshotFolderFull);
    214218        }
    215219
    216         Bstr   mName;
    217         BOOL   mNameSync;
     220        Bstr    mName;
     221        BOOL    mNameSync;
     222        Bstr    mDescription;
    218223        ComPtr <IGuestOSType> mOSType;
    219         Bstr   mSnapshotFolder;
    220         Bstr   mSnapshotFolderFull;
     224        Bstr    mSnapshotFolder;
     225        Bstr    mSnapshotFolderFull;
    221226    };
    222227
     
    305310    STDMETHOD(COMGETTER(Name))(BSTR *aName);
    306311    STDMETHOD(COMSETTER(Name))(INPTR BSTR aName);
     312    STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
     313    STDMETHOD(COMSETTER(Description))(INPTR BSTR aDescription);
    307314    STDMETHOD(COMGETTER(Id))(GUIDPARAMOUT aId);
    308315    STDMETHOD(COMGETTER(OSType)) (IGuestOSType **aOSType);
     
    325332    STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *filePath);
    326333    STDMETHOD(COMGETTER(SettingsModified))(BOOL *modified);
    327     STDMETHOD(COMGETTER(SessionState))(SessionState_T *sessionState);
     334    STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState);
     335    STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType);
     336    STDMETHOD(COMGETTER(SessionPid))(ULONG *aSessionPid);
    328337    STDMETHOD(COMGETTER(State))(MachineState_T *machineState);
    329338    STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange);
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r1015 r1077  
    553553<xsd:complexType name="TMachine">
    554554  <xsd:all>
     555    <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
    555556    <xsd:element name="Hardware" type="THardware"/>
    556557    <xsd:element name="HardDiskAttachments" type="THardDiskAttachments"/>
  • trunk/src/VBox/Main/xml/samples/VirtualBox-machine-windows.xml

    r1 r1077  
    2020    aborted="true"
    2121  >
     22    <Description>
     23        Something is here.
     24    </Description>
    2225    <Hardware>
    2326      <Memory RAMSize="128"/>
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