~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
// funcs
48
48
///////////////////////////////////////////////////////////////////////////////
49
49
 
50
 
void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const Bstr &prefix /* = ""*/, int level /*= 0*/)
 
50
void showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
 
51
                   ComPtr<ISnapshot> &currentSnapshot,
 
52
                   VMINFO_DETAILS details,
 
53
                   const Bstr &prefix /* = ""*/,
 
54
                   int level /*= 0*/)
51
55
{
52
56
    /* start with the root */
53
57
    Bstr name;
63
67
    else
64
68
    {
65
69
        /* print with indentation */
66
 
        RTPrintf("   %lSName: %lS (UUID: %s)\n", prefix.raw(), name.raw(), Utf8Str(uuid).raw());
 
70
        bool fCurrent = (rootSnapshot == currentSnapshot);
 
71
        RTPrintf("   %lSName: %lS (UUID: %s)%s\n",
 
72
                 prefix.raw(),
 
73
                 name.raw(),
 
74
                 Utf8Str(uuid).raw(),
 
75
                 (fCurrent) ? " *" : "");
67
76
    }
68
77
 
69
78
    /* get the children */
80
89
                if (details == VMINFO_MACHINEREADABLE)
81
90
                    newPrefix = Utf8StrFmt("%lS-%d", prefix.raw(), index + 1);
82
91
                else
 
92
                {
83
93
                    newPrefix = Utf8StrFmt("%lS   ", prefix.raw());
 
94
                }
 
95
 
84
96
                /* recursive call */
85
 
                showSnapshots(snapshot, details, newPrefix, level + 1);
 
97
                showSnapshots(snapshot, currentSnapshot, details, newPrefix, level + 1);
86
98
            }
87
99
        }
88
100
    }
133
145
    /** @todo error checking! */
134
146
 
135
147
    BOOL accessible = FALSE;
136
 
    CHECK_ERROR (machine, COMGETTER(Accessible) (&accessible));
137
 
    CheckComRCReturnRC (rc);
 
148
    CHECK_ERROR(machine, COMGETTER(Accessible)(&accessible));
 
149
    CheckComRCReturnRC(rc);
138
150
 
139
151
    Bstr uuid;
140
 
    rc = machine->COMGETTER(Id) (uuid.asOutParam());
 
152
    rc = machine->COMGETTER(Id)(uuid.asOutParam());
141
153
 
142
154
    if (!accessible)
143
155
    {
148
160
            if (details == VMINFO_MACHINEREADABLE)
149
161
                RTPrintf("name=\"<inaccessible>\"\n");
150
162
            else
151
 
                RTPrintf ("Name:            <inaccessible!>\n");
 
163
                RTPrintf("Name:            <inaccessible!>\n");
152
164
            if (details == VMINFO_MACHINEREADABLE)
153
 
                RTPrintf ("UUID=\"%s\"\n", Utf8Str(uuid).raw());
 
165
                RTPrintf("UUID=\"%s\"\n", Utf8Str(uuid).raw());
154
166
            else
155
 
                RTPrintf ("UUID:            %s\n", Utf8Str(uuid).raw());
 
167
                RTPrintf("UUID:            %s\n", Utf8Str(uuid).raw());
156
168
            if (details != VMINFO_MACHINEREADABLE)
157
169
            {
158
170
                Bstr settingsFilePath;
159
 
                rc = machine->COMGETTER(SettingsFilePath) (settingsFilePath.asOutParam());
160
 
                RTPrintf ("Config file:     %lS\n", settingsFilePath.raw());
 
171
                rc = machine->COMGETTER(SettingsFilePath)(settingsFilePath.asOutParam());
 
172
                RTPrintf("Config file:     %lS\n", settingsFilePath.raw());
161
173
                ComPtr<IVirtualBoxErrorInfo> accessError;
162
 
                rc = machine->COMGETTER(AccessError) (accessError.asOutParam());
163
 
                RTPrintf ("Access error details:\n");
164
 
                ErrorInfo ei (accessError);
 
174
                rc = machine->COMGETTER(AccessError)(accessError.asOutParam());
 
175
                RTPrintf("Access error details:\n");
 
176
                ErrorInfo ei(accessError);
165
177
                GluePrintErrorInfo(ei);
166
 
                RTPrintf ("\n");
 
178
                RTPrintf("\n");
167
179
            }
168
180
        }
169
181
        return S_OK;
206
218
    else
207
219
        RTPrintf("Config file:     %lS\n", settingsFilePath.raw());
208
220
 
 
221
    Bstr strHardwareUuid;
 
222
    rc = machine->COMGETTER(HardwareUUID)(strHardwareUuid.asOutParam());
 
223
    if (details == VMINFO_MACHINEREADABLE)
 
224
        RTPrintf("hardwareuuid=\"%lS\"\n", strHardwareUuid.raw());
 
225
    else
 
226
        RTPrintf("Hardware UUID:   %lS\n", strHardwareUuid.raw());
 
227
 
209
228
    ULONG memorySize;
210
229
    rc = machine->COMGETTER(MemorySize)(&memorySize);
211
230
    if (details == VMINFO_MACHINEREADABLE)
227
246
    else
228
247
        RTPrintf("Number of CPUs:  %u\n", numCpus);
229
248
 
 
249
    BOOL fSyntheticCpu;
 
250
    machine->GetCpuProperty(CpuPropertyType_Synthetic, &fSyntheticCpu);
 
251
    if (details == VMINFO_MACHINEREADABLE)
 
252
        RTPrintf("synthcpu=\"%s\"\n", fSyntheticCpu ? "on" : "off");
 
253
    else
 
254
        RTPrintf("Synthetic Cpu:   %s\n", fSyntheticCpu ? "on" : "off");
 
255
 
 
256
    if (details != VMINFO_MACHINEREADABLE)
 
257
        RTPrintf("CPUID overrides: ");
 
258
    ULONG cFound = 0;
 
259
    static uint32_t const s_auCpuIdRanges[] =
 
260
    {
 
261
        UINT32_C(0x00000000), UINT32_C(0x0000000a),
 
262
        UINT32_C(0x80000000), UINT32_C(0x8000000a)
 
263
    };
 
264
    for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
 
265
        for (uint32_t uLeaf = s_auCpuIdRanges[i]; uLeaf < s_auCpuIdRanges[i + 1]; uLeaf++)
 
266
        {
 
267
            ULONG uEAX, uEBX, uECX, uEDX;
 
268
            rc = machine->GetCpuIdLeaf(uLeaf, &uEAX, &uEBX, &uECX, &uEDX);
 
269
            if (SUCCEEDED(rc))
 
270
            {
 
271
                if (details == VMINFO_MACHINEREADABLE)
 
272
                    RTPrintf("cpuid=%08x,%08x,%08x,%08x,%08x", uLeaf, uEAX, uEBX, uECX, uEDX);
 
273
                else
 
274
                {
 
275
                    if (!cFound)
 
276
                        RTPrintf("Leaf no.  EAX      EBX      ECX      EDX\n");
 
277
                    RTPrintf("                 %08x  %08x %08x %08x %08x\n", uLeaf, uEAX, uEBX, uECX, uEDX);
 
278
                }
 
279
                cFound++;
 
280
            }
 
281
        }
 
282
    if (!cFound && details != VMINFO_MACHINEREADABLE)
 
283
        RTPrintf("None\n");
 
284
 
230
285
    ComPtr <IBIOSSettings> biosSettings;
231
286
    machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
232
287
 
329
384
        RTPrintf("IOAPIC:          %s\n", ioapicEnabled ? "on" : "off");
330
385
 
331
386
    BOOL PAEEnabled;
332
 
    machine->COMGETTER(PAEEnabled)(&PAEEnabled);
 
387
    machine->GetCpuProperty(CpuPropertyType_PAE, &PAEEnabled);
333
388
    if (details == VMINFO_MACHINEREADABLE)
334
389
        RTPrintf("pae=\"%s\"\n", PAEEnabled ? "on" : "off");
335
390
    else
343
398
        RTPrintf("Time offset:     %lld ms\n", timeOffset);
344
399
 
345
400
    BOOL hwVirtExEnabled;
346
 
    machine->COMGETTER(HWVirtExEnabled)(&hwVirtExEnabled);
 
401
    machine->GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &hwVirtExEnabled);
347
402
    if (details == VMINFO_MACHINEREADABLE)
348
403
        RTPrintf("hwvirtex=\"%s\"\n", hwVirtExEnabled ? "on" : "off");
349
404
    else
350
405
        RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled ? "on" : "off");
 
406
 
 
407
    BOOL hwVirtExExclusive;
 
408
    machine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &hwVirtExExclusive);
 
409
    if (details == VMINFO_MACHINEREADABLE)
 
410
        RTPrintf("hwvirtexexcl=\"%s\"\n", hwVirtExExclusive ? "on" : "off");
 
411
    else
 
412
        RTPrintf("Hardw. virt.ext exclusive: %s\n", hwVirtExExclusive ? "on" : "off");
 
413
 
351
414
    BOOL HWVirtExNestedPagingEnabled;
352
 
    machine->COMGETTER(HWVirtExNestedPagingEnabled)(&HWVirtExNestedPagingEnabled);
 
415
    machine->GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &HWVirtExNestedPagingEnabled);
353
416
    if (details == VMINFO_MACHINEREADABLE)
354
417
        RTPrintf("nestedpaging=\"%s\"\n", HWVirtExNestedPagingEnabled ? "on" : "off");
355
418
    else
356
419
        RTPrintf("Nested Paging:   %s\n", HWVirtExNestedPagingEnabled ? "on" : "off");
357
420
 
358
421
    BOOL HWVirtExVPIDEnabled;
359
 
    machine->COMGETTER(HWVirtExVPIDEnabled)(&HWVirtExVPIDEnabled);
 
422
    machine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &HWVirtExVPIDEnabled);
360
423
    if (details == VMINFO_MACHINEREADABLE)
361
424
        RTPrintf("vtxvpid=\"%s\"\n", HWVirtExVPIDEnabled ? "on" : "off");
362
425
    else
368
431
    switch (machineState)
369
432
    {
370
433
        case MachineState_PoweredOff:
371
 
            if (details == VMINFO_MACHINEREADABLE)
372
 
                pszState = "poweroff";
373
 
            else
374
 
                pszState = "powered off";
 
434
            pszState = details == VMINFO_MACHINEREADABLE ? "poweroff"            : "powered off";
375
435
            break;
376
436
        case MachineState_Saved:
377
437
            pszState = "saved";
379
439
        case MachineState_Aborted:
380
440
            pszState = "aborted";
381
441
            break;
 
442
        case MachineState_Teleported:
 
443
            pszState = "teleported";
 
444
            break;
382
445
        case MachineState_Running:
383
446
            pszState = "running";
384
447
            break;
385
448
        case MachineState_Paused:
386
449
            pszState = "paused";
387
450
            break;
 
451
        case MachineState_Stuck:
 
452
            pszState = details == VMINFO_MACHINEREADABLE ? "gurumeditation"      : "guru meditation";
 
453
            break;
 
454
        case MachineState_LiveSnapshotting:
 
455
            pszState = details == VMINFO_MACHINEREADABLE ? "livesnapshotting"    : "live snapshotting";
 
456
            break;
 
457
        case MachineState_Teleporting:
 
458
            pszState = "teleporting";
 
459
            break;
388
460
        case MachineState_Starting:
389
461
            pszState = "starting";
390
462
            break;
397
469
        case MachineState_Restoring:
398
470
            pszState = "restoring";
399
471
            break;
 
472
        case MachineState_TeleportingPausedVM:
 
473
            pszState = details == VMINFO_MACHINEREADABLE ? "teleportingpausedvm" : "teleporting paused vm";
 
474
            break;
 
475
        case MachineState_TeleportingIn:
 
476
            pszState = details == VMINFO_MACHINEREADABLE ? "teleportingin"       : "teleporting (incoming)";
 
477
            break;
 
478
        case MachineState_RestoringSnapshot:
 
479
            pszState = details == VMINFO_MACHINEREADABLE ? "restoringsnapshot"   : "restoring snapshot";
 
480
        case MachineState_DeletingSnapshot:
 
481
            pszState = details == VMINFO_MACHINEREADABLE ? "deletingsnapshot"    : "deleting snapshot";
 
482
        case MachineState_SettingUp:
 
483
            pszState = details == VMINFO_MACHINEREADABLE ? "settingup"           : "setting up";
 
484
            break;
400
485
        default:
401
486
            pszState = "unknown";
402
487
            break;
433
518
    else
434
519
        RTPrintf("3D Acceleration: %s\n", accelerate3d ? "on" : "off");
435
520
 
436
 
    ComPtr<IFloppyDrive> floppyDrive;
437
 
    rc = machine->COMGETTER(FloppyDrive)(floppyDrive.asOutParam());
438
 
    if (SUCCEEDED(rc) && floppyDrive)
 
521
#ifdef VBOX_WITH_VIDEOHWACCEL
 
522
    BOOL accelerate2dVideo;
 
523
    machine->COMGETTER(Accelerate2DVideoEnabled)(&accelerate2dVideo);
 
524
    if (details == VMINFO_MACHINEREADABLE)
 
525
        RTPrintf("accelerate2dvideo=\"%s\"\n", accelerate2dVideo ? "on" : "off");
 
526
    else
 
527
        RTPrintf("2D Video Acceleration: %s\n", accelerate2dVideo ? "on" : "off");
 
528
#endif
 
529
 
 
530
    BOOL teleporterEnabled;
 
531
    machine->COMGETTER(TeleporterEnabled)(&teleporterEnabled);
 
532
    if (details == VMINFO_MACHINEREADABLE)
 
533
        RTPrintf("teleporterenabled=\"%s\"\n", teleporterEnabled ? "on" : "off");
 
534
    else
 
535
        RTPrintf("Teleporter Enabled: %s\n", teleporterEnabled ? "on" : "off");
 
536
 
 
537
    ULONG teleporterPort;
 
538
    machine->COMGETTER(TeleporterPort)(&teleporterPort);
 
539
    if (details == VMINFO_MACHINEREADABLE)
 
540
        RTPrintf("teleporterport=%u\n", teleporterPort);
 
541
    else
 
542
        RTPrintf("Teleporter Port: %u\n", teleporterPort);
 
543
 
 
544
    Bstr teleporterAddress;
 
545
    machine->COMGETTER(TeleporterAddress)(teleporterAddress.asOutParam());
 
546
    if (details == VMINFO_MACHINEREADABLE)
 
547
        RTPrintf("teleporteraddress=\"%lS\"\n", teleporterAddress.raw());
 
548
    else
 
549
        RTPrintf("Teleporter Address: %lS\n", teleporterAddress.raw());
 
550
 
 
551
    Bstr teleporterPassword;
 
552
    machine->COMGETTER(TeleporterPassword)(teleporterPassword.asOutParam());
 
553
    if (details == VMINFO_MACHINEREADABLE)
 
554
        RTPrintf("teleporterpassword=\"%lS\"\n", teleporterPassword.raw());
 
555
    else
 
556
        RTPrintf("Teleporter Password: %lS\n", teleporterPassword.raw());
 
557
 
 
558
    /*
 
559
     * Storage Controllers and their attached Mediums.
 
560
     */
 
561
    com::SafeIfaceArray<IStorageController> storageCtls;
 
562
    CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam (storageCtls)));
 
563
    for (size_t i = 0; i < storageCtls.size(); ++ i)
439
564
    {
440
 
        BOOL fFloppyEnabled;
441
 
        floppyDrive->COMGETTER(Enabled)(&fFloppyEnabled);
442
 
        Utf8Str pszFloppy = "invalid";
443
 
        if (fFloppyEnabled)
444
 
        {
445
 
            DriveState_T floppyState;
446
 
            floppyDrive->COMGETTER(State)(&floppyState);
447
 
            switch (floppyState)
448
 
            {
449
 
                case DriveState_ImageMounted:
450
 
                {
451
 
                    ComPtr<IFloppyImage> floppyImage;
452
 
                    rc = floppyDrive->GetImage(floppyImage.asOutParam());
453
 
                    if (SUCCEEDED(rc) && floppyImage)
454
 
                    {
455
 
                        Bstr imagePath;
456
 
                        floppyImage->COMGETTER(Location)(imagePath.asOutParam());
457
 
                        Bstr imageGuid;
458
 
                        floppyImage->COMGETTER(Id)(imageGuid.asOutParam());
459
 
                        if (details == VMINFO_MACHINEREADABLE)
460
 
                        {
461
 
                            RTPrintf("FloppyImageUUID=\"%s\"\n", Utf8Str(imageGuid).raw());
462
 
                            pszFloppy = Utf8StrFmt("%lS", imagePath.raw());
463
 
                        }
464
 
                        else
465
 
                            pszFloppy = Utf8StrFmt("%lS (UUID: %s)", imagePath.raw(), Utf8Str(imageGuid).raw());
466
 
                    }
467
 
                    break;
468
 
                }
469
 
 
470
 
                case DriveState_HostDriveCaptured:
471
 
                {
472
 
                    ComPtr<IHostFloppyDrive> hostFloppyDrive;
473
 
                    rc = floppyDrive->GetHostDrive(hostFloppyDrive.asOutParam());
474
 
                    if (SUCCEEDED(rc) && floppyDrive)
475
 
                    {
476
 
                        Bstr driveName;
477
 
                        hostFloppyDrive->COMGETTER(Name)(driveName.asOutParam());
478
 
                        if (details == VMINFO_MACHINEREADABLE)
479
 
                            pszFloppy = Utf8StrFmt("host:%lS", driveName.raw());
480
 
                        else
481
 
                            pszFloppy = Utf8StrFmt("Host drive %lS", driveName.raw());
482
 
                    }
483
 
                    break;
484
 
                }
485
 
 
486
 
                case DriveState_NotMounted:
487
 
                {
488
 
                    pszFloppy = "empty";
489
 
                    break;
490
 
                }
491
 
            }
492
 
        }
493
 
        else
494
 
        {
495
 
            pszFloppy = "disabled";
496
 
        }
 
565
        ComPtr<IStorageController> storageCtl = storageCtls[i];
 
566
        StorageControllerType_T    enmCtlType = StorageControllerType_Null;
 
567
        const char *pszCtl = NULL;
 
568
        ULONG ulValue = 0;
 
569
        Bstr storageCtlName;
 
570
 
 
571
        storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
497
572
        if (details == VMINFO_MACHINEREADABLE)
498
 
            RTPrintf("floppy=\"%s\"\n", pszFloppy.raw());
 
573
            RTPrintf("storagecontrollername%u=\"%lS\"\n", i, storageCtlName.raw());
499
574
        else
500
 
            RTPrintf("Floppy:          %s\n", pszFloppy.raw());
501
 
    }
502
 
 
503
 
    /*
504
 
     * SATA.
505
 
     *
506
 
     * Contributed by: James Lucas
507
 
     */
508
 
#ifdef VBOX_WITH_AHCI
509
 
    ComPtr<IStorageController> SataCtl;
510
 
    bool                       fSataEnabled = false;
511
 
 
512
 
    rc = machine->GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam());
513
 
    if (SUCCEEDED(rc))
514
 
        fSataEnabled = true;
515
 
 
516
 
    if (details == VMINFO_MACHINEREADABLE)
517
 
        RTPrintf("sata=\"%s\"\n", fSataEnabled ? "on" : "off");
518
 
    else
519
 
        RTPrintf("SATA:            %s\n", fSataEnabled ? "enabled" : "disabled");
520
 
 
521
 
    /*
522
 
     * SATA Hard disks
523
 
     */
524
 
    if (fSataEnabled)
525
 
    {
526
 
        ComPtr<IHardDisk> hardDisk;
527
 
        Bstr  filePath;
528
 
        ULONG cSataPorts;
529
 
 
530
 
        SataCtl->COMGETTER(PortCount)(&cSataPorts);
531
 
        for (ULONG i = 0; i < cSataPorts; ++ i)
532
 
        {
533
 
            rc = machine->GetHardDisk(Bstr("SATA"), i, 0, hardDisk.asOutParam());
534
 
            if (SUCCEEDED(rc) && hardDisk)
535
 
            {
536
 
                hardDisk->COMGETTER(Location)(filePath.asOutParam());
537
 
                hardDisk->COMGETTER(Id)(uuid.asOutParam());
538
 
                if (details == VMINFO_MACHINEREADABLE)
539
 
                {
540
 
                    RTPrintf("sataport%d=\"%lS\"\n", i, filePath.raw());
541
 
                    RTPrintf("SataPortImageUUID%d=\"%s\"\n", i, Utf8Str(uuid).raw());
542
 
                }
543
 
                else
544
 
                    RTPrintf("SATA %d:          %lS (UUID: %s)\n", i, filePath.raw(), Utf8Str(uuid).raw());
545
 
            }
546
 
            else
547
 
            {
548
 
                if (details == VMINFO_MACHINEREADABLE)
549
 
                    RTPrintf("sata%d=\"none\"\n",i);
550
 
            }
551
 
        }
552
 
    }
553
 
#endif
554
 
 
555
 
    /*
556
 
     * IDE Hard disks
557
 
     */
558
 
    ComPtr<IStorageController> ideController;
559
 
 
560
 
    rc = machine->GetStorageControllerByName(Bstr("IDE"), ideController.asOutParam());
561
 
    if (SUCCEEDED(rc) && ideController)
562
 
    {
563
 
        StorageControllerType_T enmIdeController;
564
 
        const char *pszIdeController = NULL;
565
 
 
566
 
        rc = ideController->COMGETTER(ControllerType)(&enmIdeController);
567
 
 
568
 
        switch (enmIdeController)
569
 
        {
 
575
            RTPrintf("Storage Controller Name (%u):            %lS\n", i, storageCtlName.raw());
 
576
 
 
577
        storageCtl->COMGETTER(ControllerType)(&enmCtlType);
 
578
        switch (enmCtlType)
 
579
        {
 
580
            case StorageControllerType_LsiLogic:
 
581
                pszCtl = "LsiLogic";
 
582
                break;
 
583
            case StorageControllerType_BusLogic:
 
584
                pszCtl = "BusLogic";
 
585
                break;
 
586
            case StorageControllerType_IntelAhci:
 
587
                pszCtl = "IntelAhci";
 
588
                break;
570
589
            case StorageControllerType_PIIX3:
571
 
                pszIdeController = "PIIX3";
 
590
                pszCtl = "PIIX3";
572
591
                break;
573
592
            case StorageControllerType_PIIX4:
574
 
                pszIdeController = "PIIX4";
 
593
                pszCtl = "PIIX4";
575
594
                break;
576
595
            case StorageControllerType_ICH6:
577
 
                pszIdeController = "ICH6";
578
 
                break;
 
596
                pszCtl = "ICH6";
 
597
                break;
 
598
            case StorageControllerType_I82078:
 
599
                pszCtl = "I82078";
 
600
                break;
 
601
 
579
602
            default:
580
 
                pszIdeController = "unknown";
581
 
        }
582
 
        if (details == VMINFO_MACHINEREADABLE)
583
 
            RTPrintf("idecontroller=\"%s\"\n", pszIdeController);
584
 
        else
585
 
            RTPrintf("IDE Controller:  %s\n", pszIdeController);
586
 
    }
587
 
 
588
 
    ComPtr<IHardDisk> hardDisk;
589
 
    Bstr filePath;
590
 
    rc = machine->GetHardDisk(Bstr("IDE"), 0, 0, hardDisk.asOutParam());
591
 
    if (SUCCEEDED(rc) && hardDisk)
592
 
    {
593
 
        hardDisk->COMGETTER(Location)(filePath.asOutParam());
594
 
        hardDisk->COMGETTER(Id)(uuid.asOutParam());
595
 
        if (details == VMINFO_MACHINEREADABLE)
596
 
        {
597
 
            RTPrintf("hda=\"%lS\"\n", filePath.raw());
598
 
            RTPrintf("HdaImageUUID=\"%s\"\n", Utf8Str(uuid).raw());
599
 
        }
600
 
        else
601
 
            RTPrintf("Primary master:  %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw());
602
 
    }
603
 
    else
604
 
    {
605
 
        if (details == VMINFO_MACHINEREADABLE)
606
 
            RTPrintf("hda=\"none\"\n");
607
 
    }
608
 
    rc = machine->GetHardDisk(Bstr("IDE"), 0, 1, hardDisk.asOutParam());
609
 
    if (SUCCEEDED(rc) && hardDisk)
610
 
    {
611
 
        hardDisk->COMGETTER(Location)(filePath.asOutParam());
612
 
        hardDisk->COMGETTER(Id)(uuid.asOutParam());
613
 
        if (details == VMINFO_MACHINEREADABLE)
614
 
        {
615
 
            RTPrintf("hdb=\"%lS\"\n", filePath.raw());
616
 
            RTPrintf("HdbImageUUID=\"%s\"\n", Utf8Str(uuid).raw());
617
 
        }
618
 
        else
619
 
            RTPrintf("Primary slave:   %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw());
620
 
    }
621
 
    else
622
 
    {
623
 
        if (details == VMINFO_MACHINEREADABLE)
624
 
            RTPrintf("hdb=\"none\"\n");
625
 
    }
626
 
    rc = machine->GetHardDisk(Bstr("IDE"), 1, 1, hardDisk.asOutParam());
627
 
    if (SUCCEEDED(rc) && hardDisk)
628
 
    {
629
 
        hardDisk->COMGETTER(Location)(filePath.asOutParam());
630
 
        hardDisk->COMGETTER(Id)(uuid.asOutParam());
631
 
        if (details == VMINFO_MACHINEREADABLE)
632
 
        {
633
 
            RTPrintf("hdd=\"%lS\"\n", filePath.raw());
634
 
            RTPrintf("HddImageUUID=\"%s\"\n", Utf8Str(uuid).raw());
635
 
        }
636
 
        else
637
 
            RTPrintf("Secondary slave: %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw());
638
 
    }
639
 
    else
640
 
    {
641
 
        if (details == VMINFO_MACHINEREADABLE)
642
 
            RTPrintf("hdd=\"none\"\n");
643
 
    }
644
 
    ComPtr<IDVDDrive> dvdDrive;
645
 
    rc = machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
646
 
    if (SUCCEEDED(rc) && dvdDrive)
647
 
    {
648
 
        ComPtr<IDVDImage> dvdImage;
649
 
        rc = dvdDrive->GetImage(dvdImage.asOutParam());
650
 
        if (SUCCEEDED(rc) && dvdImage)
651
 
        {
652
 
            rc = dvdImage->COMGETTER(Location)(filePath.asOutParam());
653
 
            if (SUCCEEDED(rc) && filePath)
654
 
            {
655
 
                rc = dvdImage->COMGETTER(Id)(uuid.asOutParam());
656
 
                if (details == VMINFO_MACHINEREADABLE)
657
 
                {
658
 
                    RTPrintf("dvd=\"%lS\"\n", filePath.raw());
659
 
                    RTPrintf("DvdImageUUID=\"%s\"\n", Utf8Str(uuid).raw());
660
 
                }
661
 
                else
662
 
                    RTPrintf("DVD:             %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw());
663
 
            }
664
 
        }
665
 
        else
666
 
        {
667
 
            ComPtr<IHostDVDDrive> hostDVDDrive;
668
 
            rc = dvdDrive->GetHostDrive(hostDVDDrive.asOutParam());
669
 
            if (SUCCEEDED(rc) && hostDVDDrive)
670
 
            {
671
 
                Bstr name;
672
 
                hostDVDDrive->COMGETTER(Name)(name.asOutParam());
673
 
                if (details == VMINFO_MACHINEREADABLE)
674
 
                    RTPrintf("dvd=\"host:%lS\"\n", name.raw());
675
 
                else
676
 
                    RTPrintf("DVD:             Host drive %lS", name.raw());
677
 
            }
678
 
            else
679
 
            {
680
 
                if (details == VMINFO_MACHINEREADABLE)
681
 
                    RTPrintf("dvd=\"none\"\n");
682
 
                else
683
 
                    RTPrintf("DVD:             empty");
684
 
            }
685
 
            BOOL fPassthrough;
686
 
            dvdDrive->COMGETTER(Passthrough)(&fPassthrough);
687
 
            if (details == VMINFO_MACHINEREADABLE)
688
 
            {
689
 
                RTPrintf("dvdpassthrough=\"%s\"\n", fPassthrough ? "on" : "off");
690
 
            }
691
 
            else
692
 
            {
693
 
                if (fPassthrough)
694
 
                    RTPrintf(" (passthrough enabled)");
695
 
                RTPrintf("\n");
 
603
                pszCtl = "unknown";
 
604
        }
 
605
        if (details == VMINFO_MACHINEREADABLE)
 
606
            RTPrintf("storagecontrollertype%u=\"%s\"\n", i, pszCtl);
 
607
        else
 
608
            RTPrintf("Storage Controller Type (%u):            %s\n", i, pszCtl);
 
609
 
 
610
        storageCtl->COMGETTER(Instance)(&ulValue);
 
611
        if (details == VMINFO_MACHINEREADABLE)
 
612
            RTPrintf("storagecontrollerinstance%u=\"%lu\"\n", i, ulValue);
 
613
        else
 
614
            RTPrintf("Storage Controller Instance Number (%u): %lu\n", i, ulValue);
 
615
 
 
616
        storageCtl->COMGETTER(MaxPortCount)(&ulValue);
 
617
        if (details == VMINFO_MACHINEREADABLE)
 
618
            RTPrintf("storagecontrollermaxportcount%u=\"%lu\"\n", i, ulValue);
 
619
        else
 
620
            RTPrintf("Storage Controller Max Port Count (%u):  %lu\n", i, ulValue);
 
621
 
 
622
        storageCtl->COMGETTER(PortCount)(&ulValue);
 
623
        if (details == VMINFO_MACHINEREADABLE)
 
624
            RTPrintf("storagecontrollerportcount%u=\"%lu\"\n", i, ulValue);
 
625
        else
 
626
            RTPrintf("Storage Controller Port Count (%u):      %lu\n", i, ulValue);
 
627
    }
 
628
 
 
629
    for (size_t j = 0; j < storageCtls.size(); ++ j)
 
630
    {
 
631
        ComPtr<IStorageController> storageCtl = storageCtls[j];
 
632
        ComPtr<IMedium> medium;
 
633
        Bstr storageCtlName;
 
634
        Bstr filePath;
 
635
        ULONG cDevices;
 
636
        ULONG cPorts;
 
637
 
 
638
        storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
 
639
        storageCtl->COMGETTER(MaxDevicesPerPortCount)(&cDevices);
 
640
        storageCtl->COMGETTER(PortCount)(&cPorts);
 
641
 
 
642
        for (ULONG i = 0; i < cPorts; ++ i)
 
643
        {
 
644
            for (ULONG k = 0; k < cDevices; ++ k)
 
645
            {
 
646
                rc = machine->GetMedium(storageCtlName, i, k, medium.asOutParam());
 
647
                if (SUCCEEDED(rc) && medium)
 
648
                {
 
649
                    BOOL fPassthrough;
 
650
                    ComPtr<IMediumAttachment> mediumAttach;
 
651
 
 
652
                    rc = machine->GetMediumAttachment(storageCtlName, i, k, mediumAttach.asOutParam());
 
653
                    if (SUCCEEDED(rc) && mediumAttach)
 
654
                        mediumAttach->COMGETTER(Passthrough)(&fPassthrough);
 
655
 
 
656
                    medium->COMGETTER(Location)(filePath.asOutParam());
 
657
                    medium->COMGETTER(Id)(uuid.asOutParam());
 
658
 
 
659
                    if (details == VMINFO_MACHINEREADABLE)
 
660
                    {
 
661
                        RTPrintf("\"%lS-%d-%d\"=\"%lS\"\n", storageCtlName.raw(),
 
662
                                 i, k, filePath.raw());
 
663
                        RTPrintf("\"%lS-ImageUUID-%d-%d\"=\"%s\"\n",
 
664
                                 storageCtlName.raw(), i, k, Utf8Str(uuid).raw());
 
665
                        if (fPassthrough)
 
666
                            RTPrintf("\"%lS-dvdpassthrough\"=\"%s\"\n", storageCtlName.raw(),
 
667
                                     fPassthrough ? "on" : "off");
 
668
                    }
 
669
                    else
 
670
                    {
 
671
                        RTPrintf("%lS (%d, %d): %lS (UUID: %s)",
 
672
                                 storageCtlName.raw(), i, k, filePath.raw(),
 
673
                                 Utf8Str(uuid).raw());
 
674
                        if (fPassthrough)
 
675
                            RTPrintf(" (passthrough enabled)");
 
676
                        RTPrintf("\n");
 
677
                    }
 
678
                }
 
679
                else if (SUCCEEDED(rc))
 
680
                {
 
681
                    if (details == VMINFO_MACHINEREADABLE)
 
682
                        RTPrintf("\"%lS-%d-%d\"=\"emptydrive\"\n", storageCtlName.raw(), i, k);
 
683
                    else
 
684
                        RTPrintf("%lS (%d, %d): Empty\n", storageCtlName.raw(), i, k);
 
685
                }
 
686
                else
 
687
                {
 
688
                    if (details == VMINFO_MACHINEREADABLE)
 
689
                        RTPrintf("\"%lS-%d-%d\"=\"none\"\n", storageCtlName.raw(), i, k);
 
690
                }
696
691
            }
697
692
        }
698
693
    }
825
820
                    strNICType = "82545EM";
826
821
                    break;
827
822
#endif
 
823
#ifdef VBOX_WITH_VIRTIO
 
824
                case NetworkAdapterType_Virtio:
 
825
                    strNICType = "virtio";
 
826
                    break;
 
827
#endif /* VBOX_WITH_VIRTIO */
828
828
                default:
829
829
                    strNICType = "unknown";
830
830
                    break;
1125
1125
        vrdpServer->COMGETTER(Enabled)(&fEnabled);
1126
1126
        if (fEnabled)
1127
1127
        {
1128
 
            ULONG port;
1129
 
            vrdpServer->COMGETTER(Port)(&port);
 
1128
            LONG vrdpPort = -1;
 
1129
            Bstr ports;
 
1130
            vrdpServer->COMGETTER(Ports)(ports.asOutParam());
1130
1131
            Bstr address;
1131
1132
            vrdpServer->COMGETTER(NetAddress)(address.asOutParam());
1132
1133
            BOOL fMultiCon;
1151
1152
                    strAuthType = "unknown";
1152
1153
                    break;
1153
1154
            }
 
1155
            if (console)
 
1156
            {
 
1157
                ComPtr<IRemoteDisplayInfo> remoteDisplayInfo;
 
1158
                CHECK_ERROR_RET(console, COMGETTER(RemoteDisplayInfo)(remoteDisplayInfo.asOutParam()), rc);
 
1159
                rc = remoteDisplayInfo->COMGETTER(Port)(&vrdpPort);
 
1160
                if (rc == E_ACCESSDENIED)
 
1161
                {
 
1162
                    vrdpPort = -1; /* VM not powered up */
 
1163
                }
 
1164
                if (FAILED(rc))
 
1165
                {
 
1166
                    com::ErrorInfo info (remoteDisplayInfo);
 
1167
                    GluePrintErrorInfo(info);
 
1168
                    return rc;
 
1169
                }
 
1170
            }
1154
1171
            if (details == VMINFO_MACHINEREADABLE)
1155
1172
            {
1156
1173
                RTPrintf("vrdp=\"on\"\n");
1157
 
                RTPrintf("vrdpport=%d\n", port);
 
1174
                RTPrintf("vrdpport=%d\n", vrdpPort);
 
1175
                RTPrintf("vrdpports=\"%lS\"\n", ports.raw());
1158
1176
                RTPrintf("vrdpaddress=\"%lS\"\n", address.raw());
1159
1177
                RTPrintf("vrdpauthtype=\"%s\"\n", strAuthType);
1160
1178
                RTPrintf("vrdpmulticon=\"%s\"\n", fMultiCon ? "on" : "off");
1164
1182
            {
1165
1183
                if (address.isEmpty())
1166
1184
                    address = "0.0.0.0";
1167
 
                RTPrintf("VRDP:            enabled (Address %lS, Port %d, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), port, fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
 
1185
                RTPrintf("VRDP:            enabled (Address %lS, Ports %lS, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
 
1186
                if (console && vrdpPort != -1 && vrdpPort != 0)
 
1187
                   RTPrintf("VRDP port:       %d\n", vrdpPort);
1168
1188
            }
1169
1189
        }
1170
1190
        else
1899
1919
    rc = machine->GetSnapshot(Bstr(), snapshot.asOutParam());
1900
1920
    if (SUCCEEDED(rc) && snapshot)
1901
1921
    {
1902
 
        if (details != VMINFO_MACHINEREADABLE)
1903
 
            RTPrintf("Snapshots:\n\n");
1904
 
        showSnapshots(snapshot, details);
 
1922
        ComPtr<ISnapshot> currentSnapshot;
 
1923
        rc = machine->COMGETTER(CurrentSnapshot)(currentSnapshot.asOutParam());
 
1924
        if (SUCCEEDED(rc))
 
1925
        {
 
1926
            if (details != VMINFO_MACHINEREADABLE)
 
1927
                RTPrintf("Snapshots:\n\n");
 
1928
            showSnapshots(snapshot, currentSnapshot, details);
 
1929
        }
1905
1930
    }
1906
1931
 
1907
1932
    if (details != VMINFO_MACHINEREADABLE)