VirtualBox

Changeset 23599 in vbox


Ignore:
Timestamp:
Oct 7, 2009 5:24:18 PM (15 years ago)
Author:
vboxsync
Message:

Main: Live migration work.

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

Legend:

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

    r23585 r23599  
    155155
    156156    mNameSync = TRUE;
     157    mLiveMigrationTarget = FALSE;
     158    mLiveMigrationPort = 0;
    157159
    158160    /* mName, mOSTypeId, mSnapshotFolder, mSnapshotFolderFull are initialized in
     
    18171819    mHWData->mGuestPropertyNotificationPatterns.cloneTo(aPatterns);
    18181820
    1819     return RT_LIKELY (aPatterns != NULL) ? S_OK : E_OUTOFMEMORY;
     1821    return RT_LIKELY (aPatterns != NULL) ? S_OK : E_OUTOFMEMORY; /** @todo r=bird: this is wrong... :-) */
    18201822}
    18211823
     
    18541856    return S_OK;
    18551857}
     1858
     1859STDMETHODIMP
     1860Machine::COMGETTER(LiveMigrationTarget)(BOOL *aEnabled)
     1861{
     1862    CheckComArgOutPointerValid(aEnabled);
     1863
     1864    AutoCaller autoCaller(this);
     1865    CheckComRCReturnRC(autoCaller.rc());
     1866
     1867    AutoReadLock alock(this);
     1868
     1869    *aEnabled = mUserData->mLiveMigrationTarget;
     1870
     1871    return S_OK;
     1872}
     1873
     1874STDMETHODIMP
     1875Machine::COMSETTER(LiveMigrationTarget)(BOOL aEnabled)
     1876{
     1877    AutoCaller autoCaller(this);
     1878    CheckComRCReturnRC(autoCaller.rc());
     1879
     1880    AutoWriteLock alock(this);
     1881
     1882    /* Only allow it to be set to true when PoweredOff.
     1883       (Clearing it is always permitted.) */
     1884    if (    aEnabled
     1885        &&  mData->mRegistered
     1886        &&  (   mType != IsSessionMachine
     1887             || mData->mMachineState > MachineState_PoweredOff)
     1888       )
     1889        return setError(VBOX_E_INVALID_VM_STATE,
     1890                        tr("The machine is not powered off (state is %d)"),
     1891                        mData->mMachineState);
     1892
     1893    mUserData.backup();
     1894    mUserData->mLiveMigrationTarget = aEnabled;
     1895
     1896    return S_OK;
     1897}
     1898
     1899STDMETHODIMP
     1900Machine::COMGETTER(LiveMigrationPort)(ULONG *aPort)
     1901{
     1902    CheckComArgOutPointerValid(aPort);
     1903
     1904    AutoCaller autoCaller(this);
     1905    CheckComRCReturnRC(autoCaller.rc());
     1906
     1907    AutoReadLock alock(this);
     1908
     1909    *aPort = mUserData->mLiveMigrationPort;
     1910
     1911    return S_OK;
     1912}
     1913
     1914STDMETHODIMP
     1915Machine::COMSETTER(LiveMigrationPort)(ULONG aPort)
     1916{
     1917    if (aPort >= _64K)
     1918        return setError(E_INVALIDARG, tr("Invalid port number %d"), aPort);
     1919
     1920    AutoCaller autoCaller(this);
     1921    CheckComRCReturnRC(autoCaller.rc());
     1922
     1923    AutoWriteLock alock(this);
     1924
     1925    HRESULT rc = checkStateDependency(MutableStateDep);
     1926    CheckComRCReturnRC(rc);
     1927
     1928    mUserData.backup();
     1929    mUserData->mLiveMigrationPort = aPort;
     1930
     1931    return S_OK;
     1932}
     1933
     1934STDMETHODIMP
     1935Machine::COMGETTER(LiveMigrationPassword)(BSTR *aPassword)
     1936{
     1937    CheckComArgOutPointerValid(aPassword);
     1938
     1939    AutoCaller autoCaller(this);
     1940    CheckComRCReturnRC(autoCaller.rc());
     1941
     1942    AutoReadLock alock(this);
     1943
     1944    mUserData->mLiveMigrationPassword.cloneTo(aPassword);
     1945
     1946    return S_OK;
     1947}
     1948
     1949STDMETHODIMP
     1950Machine::COMSETTER(LiveMigrationPassword)(IN_BSTR aPassword)
     1951{
     1952    AutoCaller autoCaller(this);
     1953    CheckComRCReturnRC(autoCaller.rc());
     1954
     1955    AutoWriteLock alock(this);
     1956
     1957    HRESULT rc = checkStateDependency(MutableStateDep);
     1958    CheckComRCReturnRC(rc);
     1959
     1960    mUserData.backup();
     1961    mUserData->mLiveMigrationPassword = aPassword;
     1962
     1963    return S_OK;
     1964}
     1965
    18561966
    18571967// IMachine methods
     
    49225032        mData->mLastStateChange = mData->m_pMachineConfigFile->timeLastStateChange;
    49235033
     5034/** @todo LiveMigration: Load LiveMigration properties here. */
    49245035        /*
    49255036         *  note: all mUserData members must be assigned prior this point because
     
    59116022        mData->m_pMachineConfigFile->timeLastStateChange = mData->mLastStateChange;
    59126023        mData->m_pMachineConfigFile->fAborted = (mData->mMachineState == MachineState_Aborted);
     6024/** @todo LiveMigration: Save LiveMigration properties here. */
    59136025
    59146026        rc = saveHardware(mData->m_pMachineConfigFile->hardwareMachine);
  • trunk/src/VBox/Main/Makefile.kmk

    r23537 r23599  
    598598        ConsoleImpl.cpp \
    599599        ConsoleImpl2.cpp \
     600        ConsoleImpl-LiveMigration.cpp \
    600601        ConsoleVRDPServer.cpp \
    601602        GuestImpl.cpp \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r23567 r23599  
    40024002  <interface
    40034003     name="IMachine" extends="$unknown"
    4004      uuid="445ecfcc-8ebd-a2a5-459c-4d21ae0b206b"
     4004     uuid="160b0ccc-c3d6-4c1b-bbe9-39b1a732f833"
    40054005     wsmap="managed"
    40064006     >
     
    44914491    </attribute>
    44924492
     4493    <attribute name="liveMigrationTarget" type="boolean">
     4494      <desc>
     4495        When set to @a true, the virtual machine becomes a live migration
     4496        target.  This can only set to @a true when the VM is in the @a
     4497        PoweredOff state.
     4498
     4499        This property is automatically set to @a false when the VM is powered
     4500        on.
     4501      </desc>
     4502    </attribute>
     4503
     4504    <attribute name="liveMigrationPort" type="unsigned long">
     4505      <desc>
     4506        The TCP port used for live migration.  This can only be set when the
     4507        VM is in the @a PoweredOff state.
     4508
     4509        0 means the port is automatically selected and the source machine will
     4510        have to be told where to connected after the destination has been
     4511        started.
     4512      </desc>
     4513    </attribute>
     4514
     4515    <attribute name="liveMigrationPassword" type="wstring">
     4516      <desc>
     4517        The password the live migration target will check for.
     4518      </desc>
     4519    </attribute>
     4520
    44934521    <method name="setBootOrder">
    44944522      <desc>
     
    59135941  <interface
    59145942     name="IConsole" extends="$unknown"
    5915      uuid="0a51994b-cbc6-4686-94eb-d4e4023280e2"
     5943     uuid="c47486e1-3d99-4212-b1c5-86451978999d"
    59165944     wsmap="managed"
    59175945     >
     
    66466674        </result>
    66476675      </desc>
     6676      <param name="progress" type="IProgress" dir="return">
     6677        <desc>Progress object to track the operation completion.</desc>
     6678      </param>
     6679    </method>
     6680
     6681    <method name="migrate">
     6682      <desc>
     6683        Migrate the VM to a different host machine.
     6684
     6685        TODO explain the details.
     6686
     6687        <result name="VBOX_E_INVALID_VM_STATE">
     6688          Virtual machine not running or paused.
     6689        </result>
     6690      </desc>
     6691      <param name="hostname" type="wstring" dir="in">
     6692        <desc>The name or IP of the host to migrate to.</desc>
     6693      </param>
     6694      <param name="port" type="unsigned long" dir="in">
     6695        <desc>The TCP port to connect to (1..65535).</desc>
     6696      </param>
     6697      <param name="password" type="wstring" dir="in">
     6698        <desc>The password.</desc>
     6699      </param>
    66486700      <param name="progress" type="IProgress" dir="return">
    66496701        <desc>Progress object to track the operation completion.</desc>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r23419 r23599  
    147147    STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
    148148    STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
     149    STDMETHOD(Migrate)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, IProgress **aProgress);
    149150    STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
    150151    STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r23223 r23599  
    233233                    mDescription == that.mDescription &&
    234234                    mOSTypeId == that.mOSTypeId &&
    235                     mSnapshotFolderFull == that.mSnapshotFolderFull);
     235                    mSnapshotFolderFull == that.mSnapshotFolderFull &&
     236                    mLiveMigrationTarget == that.mLiveMigrationTarget &&
     237                    mLiveMigrationPort == that.mLiveMigrationPort &&
     238                    mLiveMigrationPassword == that.mLiveMigrationPassword);
    236239        }
    237240
     
    242245        Bstr    mSnapshotFolder;
    243246        Bstr    mSnapshotFolderFull;
     247        BOOL    mLiveMigrationTarget;
     248        ULONG   mLiveMigrationPort;
     249        Bstr    mLiveMigrationPassword;
    244250    };
    245251
     
    560566    STDMETHOD(COMSETTER(GuestPropertyNotificationPatterns))(IN_BSTR aPattern);
    561567    STDMETHOD(COMGETTER(StorageControllers))(ComSafeArrayOut(IStorageController *, aStorageControllers));
     568    STDMETHOD(COMGETTER(LiveMigrationTarget))(BOOL *aEnabled);
     569    STDMETHOD(COMSETTER(LiveMigrationTarget))(BOOL aEnabled);
     570    STDMETHOD(COMGETTER(LiveMigrationPort))(ULONG *aPort);
     571    STDMETHOD(COMSETTER(LiveMigrationPort))(ULONG aPort);
     572    STDMETHOD(COMGETTER(LiveMigrationPassword))(BSTR *aPassword);
     573    STDMETHOD(COMSETTER(LiveMigrationPassword))(IN_BSTR aPassword);
    562574
    563575    // IMachine methods
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