VirtualBox

Changeset 24136 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 28, 2009 12:48:41 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54055
Message:

Main,VBoxManage,xml: Added a HardwareUUID property for reporting the original machine UUID after cloning or teleporting a VM.

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r23998 r24136  
    237237                 "                            [--teleporterport <port>]\n"
    238238                 "                            [--teleporteraddress <address|empty>\n"
    239                  "                            [--teleporterpassword <password>]\n");
     239                 "                            [--teleporterpassword <password>]\n"
     240                 "                            [--hardwareuuid <uuid>]\n"
     241                );
    240242        RTPrintf("\n");
    241243    }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r23884 r24136  
    146146
    147147    BOOL accessible = FALSE;
    148     CHECK_ERROR (machine, COMGETTER(Accessible) (&accessible));
    149     CheckComRCReturnRC (rc);
     148    CHECK_ERROR(machine, COMGETTER(Accessible)(&accessible));
     149    CheckComRCReturnRC(rc);
    150150
    151151    Bstr uuid;
    152     rc = machine->COMGETTER(Id) (uuid.asOutParam());
     152    rc = machine->COMGETTER(Id)(uuid.asOutParam());
    153153
    154154    if (!accessible)
     
    161161                RTPrintf("name=\"<inaccessible>\"\n");
    162162            else
    163                 RTPrintf ("Name:            <inaccessible!>\n");
     163                RTPrintf("Name:            <inaccessible!>\n");
    164164            if (details == VMINFO_MACHINEREADABLE)
    165                 RTPrintf ("UUID=\"%s\"\n", Utf8Str(uuid).raw());
    166             else
    167                 RTPrintf ("UUID:            %s\n", Utf8Str(uuid).raw());
     165                RTPrintf("UUID=\"%s\"\n", Utf8Str(uuid).raw());
     166            else
     167                RTPrintf("UUID:            %s\n", Utf8Str(uuid).raw());
    168168            if (details != VMINFO_MACHINEREADABLE)
    169169            {
    170170                Bstr settingsFilePath;
    171                 rc = machine->COMGETTER(SettingsFilePath) (settingsFilePath.asOutParam());
    172                 RTPrintf ("Config file:     %lS\n", settingsFilePath.raw());
     171                rc = machine->COMGETTER(SettingsFilePath)(settingsFilePath.asOutParam());
     172                RTPrintf("Config file:     %lS\n", settingsFilePath.raw());
    173173                ComPtr<IVirtualBoxErrorInfo> accessError;
    174                 rc = machine->COMGETTER(AccessError) (accessError.asOutParam());
    175                 RTPrintf ("Access error details:\n");
    176                 ErrorInfo ei (accessError);
     174                rc = machine->COMGETTER(AccessError)(accessError.asOutParam());
     175                RTPrintf("Access error details:\n");
     176                ErrorInfo ei(accessError);
    177177                GluePrintErrorInfo(ei);
    178                 RTPrintf ("\n");
     178                RTPrintf("\n");
    179179            }
    180180        }
     
    218218    else
    219219        RTPrintf("Config file:     %lS\n", settingsFilePath.raw());
     220
     221    Bstr strHardwareUuid;
     222    rc = machine->COMGETTER(HardwareUUID)(strHardwareUuid.asOutParam());
     223    if (details == VMINFO_MACHINEREADABLE)
     224        RTPrintf("HardwareUUID=\"%s\"\n", strHardwareUuid.raw());
     225    else
     226        RTPrintf("Hardware UUID:   %lS\n", strHardwareUuid.raw());
    220227
    221228    ULONG memorySize;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r24135 r24136  
    126126    MODIFYVM_TELEPORTER_PORT,
    127127    MODIFYVM_TELEPORTER_ADDRESS,
    128     MODIFYVM_TELEPORTER_PASSWORD
     128    MODIFYVM_TELEPORTER_PASSWORD,
     129    MODIFYVM_HARDWARE_UUID
    129130};
    130131
     
    201202    { "--teleporteraddress",        MODIFYVM_TELEPORTER_ADDRESS,        RTGETOPT_REQ_STRING },
    202203    { "--teleporterpassword",       MODIFYVM_TELEPORTER_PASSWORD,       RTGETOPT_REQ_STRING },
     204    { "--hardwareuuid",             MODIFYVM_HARDWARE_UUID,             RTGETOPT_REQ_STRING },
    203205};
    204206
     
    18161818            }
    18171819
     1820            case MODIFYVM_HARDWARE_UUID:
     1821            {
     1822                CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz)));
     1823                break;
     1824            }
     1825
    18181826            default:
    18191827            {
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r23894 r24136  
    199199    hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());             H();
    200200
    201     hrc = pMachine->COMGETTER(Id)(&str);                                            H();
    202     Guid MachineUuid(str);
    203     PCRTUUID pUuid = MachineUuid.raw();
     201    hrc = pMachine->COMGETTER(HardwareUUID)(&str);                                  H();
     202    RTUUID HardwareUuid;
     203    rc = RTUuidFromUtf16(&HardwareUuid, str);                                       RC_CHECK();
    204204    STR_FREE();
    205205
     
    234234    hrc = pMachine->COMGETTER(Name)(&str);                                          H();
    235235    rc = CFGMR3InsertStringW(pRoot, "Name",                 str);                   RC_CHECK();
    236     rc = CFGMR3InsertBytes(pRoot,   "UUID", pUuid, sizeof(*pUuid));                 RC_CHECK();
     236    rc = CFGMR3InsertBytes(pRoot,   "UUID", &HardwareUuid, sizeof(HardwareUuid));   RC_CHECK();
    237237    rc = CFGMR3InsertInteger(pRoot, "RamSize",              cbRam);                 RC_CHECK();
    238238    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",          cbRamHole);             RC_CHECK();
     
    705705        rc = CFGMR3InsertInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);           RC_CHECK();
    706706        rc = CFGMR3InsertInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);         RC_CHECK();
    707         rc = CFGMR3InsertBytes(pBiosCfg,    "UUID", pUuid, sizeof(*pUuid));             RC_CHECK();
     707        rc = CFGMR3InsertBytes(pBiosCfg,    "UUID", &HardwareUuid,sizeof(HardwareUuid));RC_CHECK();
    708708
    709709        DeviceType_T bootDevice;
  • trunk/src/VBox/Main/MachineImpl.cpp

    r24090 r24136  
    213213
    214214    if (mHWVersion != that.mHWVersion ||
     215        mHardwareUUID != that.mHardwareUUID ||
    215216        mMemorySize != that.mMemorySize ||
    216217        mMemoryBalloonSize != that.mMemoryBalloonSize ||
     
    988989    mHWData.backup();
    989990    mHWData->mHWVersion = hwVersion;
     991
     992    return S_OK;
     993}
     994
     995STDMETHODIMP Machine::COMGETTER(HardwareUUID)(BSTR *aUUID)
     996{
     997    CheckComArgOutPointerValid(aUUID);
     998
     999    AutoCaller autoCaller(this);
     1000    CheckComRCReturnRC(autoCaller.rc());
     1001
     1002    AutoReadLock alock(this);
     1003
     1004    if (!mHWData->mHardwareUUID.isEmpty())
     1005        mHWData->mHardwareUUID.toUtf16().cloneTo(aUUID);
     1006    else
     1007        mData->mUuid.toUtf16().cloneTo(aUUID);
     1008
     1009    return S_OK;
     1010}
     1011
     1012STDMETHODIMP Machine::COMSETTER(HardwareUUID) (IN_BSTR aUUID)
     1013{
     1014    Guid hardwareUUID(aUUID);
     1015    if (hardwareUUID.isEmpty())
     1016        return E_INVALIDARG;
     1017
     1018    AutoCaller autoCaller(this);
     1019    CheckComRCReturnRC(autoCaller.rc());
     1020
     1021    AutoWriteLock alock(this);
     1022
     1023    HRESULT rc = checkStateDependency(MutableStateDep);
     1024    CheckComRCReturnRC(rc);
     1025
     1026    mHWData.backup();
     1027    if (hardwareUUID == mData->mUuid)
     1028        mHWData->mHardwareUUID.clear();
     1029    else
     1030        mHWData->mHardwareUUID = hardwareUUID;
    9901031
    9911032    return S_OK;
     
    53045345        /* The hardware version attribute (optional). */
    53055346        mHWData->mHWVersion = data.strVersion;
     5347        mHWData->mHardwareUUID = data.uuid;
    53065348
    53075349        mHWData->mHWVirtExEnabled             = data.fHardwareVirt;
     
    62516293
    62526294        data.strVersion = mHWData->mHWVersion;
     6295        data.uuid = mHWData->mHardwareUUID;
    62536296
    62546297        // CPU
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r24075 r24136  
    40594059  <interface
    40604060     name="IMachine" extends="$unknown"
    4061      uuid="db35f17a-179f-4332-91b2-a49d5cfb678c"
     4061     uuid="37642E74-969A-4590-BD52-390E541F904D"
    40624062     wsmap="managed"
    40634063     >
     
    42364236    </attribute>
    42374237
     4238    <attribute name="hardwareUUID" type="uuid" mod="string">
     4239      <desc>
     4240        The UUID presented to the guest via memory tables, hardware and guest
     4241        properties.  For most VMs this is the same as the @a id, but for VMs
     4242        which have been cloned or teleported it may be the same as the source
     4243        VM.  This latter is because the guest shouldn't notice that it was
     4244        cloned or teleported.
     4245      </desc>
     4246    </attribute>
     4247
    42384248    <attribute name="CPUCount" type="unsigned long">
    42394249      <desc>Number of virtual CPUs in the VM.</desc>
     
    1194711957    <attribute name="ports" type="wstring">
    1194811958      <desc>
    11949         VRDP server port numbers. The server will try to bind to one of free ports from the list. 
     11959        VRDP server port numbers. The server will try to bind to one of free ports from the list.
    1195011960        <note>
    1195111961          This is a string of comma separated TCP port numbers or port number ranges.
  • trunk/src/VBox/Main/include/MachineImpl.h

    r23928 r24136  
    282282
    283283        Bstr           mHWVersion;
     284        Guid           mHardwareUUID;   /**< If Null, use mData.mUuid. */
    284285        ULONG          mMemorySize;
    285286        ULONG          mMemoryBalloonSize;
     
    521522    STDMETHOD(COMGETTER(HardwareVersion))(BSTR *aVersion);
    522523    STDMETHOD(COMSETTER(HardwareVersion))(IN_BSTR aVersion);
     524    STDMETHOD(COMGETTER(HardwareUUID))(BSTR *aUUID);
     525    STDMETHOD(COMSETTER(HardwareUUID))(IN_BSTR aUUID);
    523526    STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize);
    524527    STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize);
  • trunk/src/VBox/Main/xml/Settings.cpp

    r23808 r24136  
    14471447            // defaults to 2 and is only written if != 2
    14481448
     1449    Utf8Str strUUID;
     1450    if (elmHardware.getAttributeValue("uuid", strUUID))
     1451        parseUUID(hw.uuid, strUUID);
     1452    else
     1453        hw.uuid.clear();
     1454
    14491455    xml::NodesLoop nl1(elmHardware);
    14501456    const xml::ElementNode *pelmHwChild;
     
    23302336    if (hw.strVersion != "2")
    23312337        pelmHardware->setAttribute("version", hw.strVersion);
     2338    if (!hw.uuid.isEmpty())
     2339        pelmHardware->setAttribute("uuid", makeString(hw.uuid));
    23322340
    23332341    xml::ElementNode *pelmCPU      = pelmHardware->createChild("CPU");
     
    28962904            )
    28972905       )
     2906        m->sv = SettingsVersion_v1_9;
     2907
     2908    if (    m->sv < SettingsVersion_v1_9
     2909        &&  !hardwareMachine.uuid.isEmpty())
    28982910        m->sv = SettingsVersion_v1_9;
    28992911}
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