- Timestamp:
- Mar 10, 2009 3:01:07 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/string.h
r17566 r17634 508 508 509 509 /** 510 * Looks for pcszFind in "this" starting at "pos" and returns its position, 511 * counting from the beginning of "this" at 0. Returns npos if not found. 512 */ 513 size_t find(const char *pcszFind, size_t pos = 0) const; 514 515 /** 510 516 * Returns a substring of "this" as a new Utf8Str. Works exactly like 511 517 * its equivalent in std::string except that this interprets pos and n -
trunk/src/VBox/Main/ApplianceImpl.cpp
r17581 r17634 885 885 break; 886 886 887 // case OVFResourceType_ParallelScsiHba: /@todo which is the SATA controller? 888 // { 889 // } 890 887 891 case OVFResourceType_EthernetAdapter: // 10 888 892 { … … 2471 2475 pelmVirtualSystemType->addContent("virtualbox-2.2"); // instead of vmx-7? 2472 2476 2477 // loop thru all description entries twice; once to write out all 2478 // devices _except_ disk images, and a second time to assign the 2479 // disk images; this is because disk images need to reference 2480 // IDE controllers, and we can't know their instance IDs without 2481 // assigning them first 2482 2483 uint32_t idIDEController = 0; 2484 int32_t lIDEControllerIndex = 0; 2485 uint32_t idSATAController = 0; 2486 int32_t lSATAControllerIndex = 0; 2487 uint32_t idSCSIController = 0; 2488 int32_t lSCSIControllerIndex = 0; 2489 2473 2490 uint32_t ulInstanceID = 1; 2474 2475 list<VirtualSystemDescriptionEntry>::const_iterator itD; 2476 for ( itD = vsdescThis->m->llDescriptions.begin();2477 itD != vsdescThis->m->llDescriptions.end();2478 ++ itD)2491 uint32_t cDisks = 0; 2492 2493 for (size_t uLoop = 1; 2494 uLoop <= 2; 2495 ++uLoop) 2479 2496 { 2480 const VirtualSystemDescriptionEntry &desc = *itD; 2481 2482 OVFResourceType_T type = (OVFResourceType_T)0; // if this becomes != 0 then we do stuff 2483 Utf8Str strDescription; // results in <rasd:Description>...</rasd:Description> block 2484 Utf8Str strCaption; // results in <rasd:Caption>...</rasd:Caption> block 2485 2486 int32_t lVirtualQuantity = -1; 2487 Utf8Str strAllocationUnits; 2488 2489 bool fAutomaticAllocation = false; 2490 Utf8Str strConnection; // results in <rasd:Connection>...</rasd:Connection> block 2491 2492 uint64_t uTemp; 2493 2494 switch (desc.type) 2497 int32_t lIndexThis = 0; 2498 list<VirtualSystemDescriptionEntry>::const_iterator itD; 2499 for (itD = vsdescThis->m->llDescriptions.begin(); 2500 itD != vsdescThis->m->llDescriptions.end(); 2501 ++itD, ++lIndexThis) 2495 2502 { 2496 case VirtualSystemDescriptionType_CPU: 2497 /* <Item> 2498 <rasd:Caption>1 virtual CPU</rasd:Caption> 2499 <rasd:Description>Number of virtual CPUs</rasd:Description> 2500 <rasd:ElementName>virtual CPU</rasd:ElementName> 2501 <rasd:InstanceID>1</rasd:InstanceID> 2502 <rasd:ResourceType>3</rasd:ResourceType> 2503 <rasd:VirtualQuantity>1</rasd:VirtualQuantity> 2503 const VirtualSystemDescriptionEntry &desc = *itD; 2504 2505 OVFResourceType_T type = (OVFResourceType_T)0; // if this becomes != 0 then we do stuff 2506 Utf8Str strResourceSubType; 2507 2508 Utf8Str strDescription; // results in <rasd:Description>...</rasd:Description> block 2509 Utf8Str strCaption; // results in <rasd:Caption>...</rasd:Caption> block 2510 2511 uint32_t ulParent = 0; 2512 2513 int32_t lVirtualQuantity = -1; 2514 Utf8Str strAllocationUnits; 2515 2516 int32_t lAddress = -1; 2517 int32_t lBusNumber = -1; 2518 int32_t lAddressOnParent = -1; 2519 2520 int32_t lAutomaticAllocation = -1; // 0 means "false", 1 means "true" 2521 Utf8Str strConnection; // results in <rasd:Connection>...</rasd:Connection> block 2522 Utf8Str strHostResource; 2523 2524 uint64_t uTemp; 2525 2526 switch (desc.type) 2527 { 2528 case VirtualSystemDescriptionType_CPU: 2529 /* <Item> 2530 <rasd:Caption>1 virtual CPU</rasd:Caption> 2531 <rasd:Description>Number of virtual CPUs</rasd:Description> 2532 <rasd:ElementName>virtual CPU</rasd:ElementName> 2533 <rasd:InstanceID>1</rasd:InstanceID> 2534 <rasd:ResourceType>3</rasd:ResourceType> 2535 <rasd:VirtualQuantity>1</rasd:VirtualQuantity> 2536 </Item> */ 2537 if (uLoop == 1) 2538 { 2539 strDescription = "Number of virtual CPUs"; 2540 type = OVFResourceType_Processor; // 3 2541 lVirtualQuantity = 1; 2542 } 2543 break; 2544 2545 case VirtualSystemDescriptionType_Memory: 2546 /* <Item> 2547 <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits> 2548 <rasd:Caption>256 MB of memory</rasd:Caption> 2549 <rasd:Description>Memory Size</rasd:Description> 2550 <rasd:ElementName>Memory</rasd:ElementName> 2551 <rasd:InstanceID>2</rasd:InstanceID> 2552 <rasd:ResourceType>4</rasd:ResourceType> 2553 <rasd:VirtualQuantity>256</rasd:VirtualQuantity> 2554 </Item> */ 2555 if (uLoop == 1) 2556 { 2557 strDescription = "Memory Size"; 2558 type = OVFResourceType_Memory; // 4 2559 desc.strVbox.toInt(uTemp); 2560 lVirtualQuantity = (int32_t)(uTemp / _1M); 2561 strAllocationUnits = "MegaBytes"; 2562 } 2563 break; 2564 2565 case VirtualSystemDescriptionType_HardDiskControllerIDE: 2566 /* <Item> 2567 <rasd:Caption>ideController1</rasd:Caption> 2568 <rasd:Description>IDE Controller</rasd:Description> 2569 <rasd:InstanceId>5</rasd:InstanceId> 2570 <rasd:ResourceType>5</rasd:ResourceType> 2571 <rasd:Address>1</rasd:Address> 2572 <rasd:BusNumber>1</rasd:BusNumber> 2573 </Item> */ 2574 if (uLoop == 1) 2575 { 2576 strDescription = "IDE Controller"; 2577 type = OVFResourceType_IdeController; // 5 2578 // it seems that OVFTool always writes these two, and since we can only 2579 // have one IDE controller, we'll use this as well 2580 lAddress = 1; 2581 lBusNumber = 1; 2582 2583 // remember this ID 2584 idIDEController = ulInstanceID; 2585 lIDEControllerIndex = lIndexThis; 2586 } 2587 break; 2588 2589 // case VirtualSystemDescriptionType_HardDiskControllerSATA: // @todo 2590 // break; 2591 2592 case VirtualSystemDescriptionType_HardDiskControllerSCSI: 2593 /* <Item> 2594 <rasd:Caption>scsiController0</rasd:Caption> 2595 <rasd:Description>SCSI Controller</rasd:Description> 2596 <rasd:InstanceId>4</rasd:InstanceId> 2597 <rasd:ResourceType>6</rasd:ResourceType> 2598 <rasd:ResourceSubType>buslogic</rasd:ResourceSubType> 2599 <rasd:Address>0</rasd:Address> 2600 <rasd:BusNumber>0</rasd:BusNumber> 2601 </Item> 2602 */ 2603 if (uLoop == 1) 2604 { 2605 strDescription = "SCSI Controller"; 2606 strCaption = "scsiController0"; 2607 type = OVFResourceType_ParallelScsiHba; // 6 2608 // it seems that OVFTool always writes these two, and since we can only 2609 // have one SATA controller, we'll use this as well 2610 lAddress = 0; 2611 lBusNumber = 0; 2612 2613 if (!desc.strVbox.compareIgnoreCase("buslogic")) 2614 strResourceSubType = "buslogic"; 2615 else if (!desc.strVbox.compareIgnoreCase("lsilogic")) 2616 strResourceSubType = "lsilogic"; 2617 else 2618 throw setError(VBOX_E_NOT_SUPPORTED, 2619 tr("Invalid config string \"%s\" in SCSI controller"), desc.strVbox.c_str()); 2620 2621 // remember this ID 2622 idSCSIController = ulInstanceID; 2623 lSCSIControllerIndex = lIndexThis; 2624 } 2625 break; 2626 2627 case VirtualSystemDescriptionType_HardDiskImage: 2628 /* <Item> 2629 <rasd:Caption>disk1</rasd:Caption> 2630 <rasd:InstanceId>8</rasd:InstanceId> 2631 <rasd:ResourceType>17</rasd:ResourceType> 2632 <rasd:HostResource>/disk/vmdisk1</rasd:HostResource> 2633 <rasd:Parent>4</rasd:Parent> 2634 <rasd:AddressOnParent>0</rasd:AddressOnParent> 2635 </Item> */ 2636 if (uLoop == 2) 2637 { 2638 strDescription = "Disk Image"; 2639 strCaption = Utf8StrFmt("disk%d", ++cDisks); 2640 type = OVFResourceType_HardDisk; // 17 2641 strHostResource = desc.strOvf; 2642 // “controller=<index>;channel=<c>“ 2643 size_t pos1 = desc.strExtraConfig.find("controller="); 2644 size_t pos2 = desc.strExtraConfig.find("channel="); 2645 if (pos1 != Utf8Str::npos) 2646 { 2647 int32_t lControllerIndex = -1; 2648 RTStrToInt32Ex(desc.strExtraConfig.c_str() + pos1 + 11, NULL, 0, &lControllerIndex); 2649 if (lControllerIndex == lIDEControllerIndex) 2650 ulParent = idIDEController; 2651 else if (lControllerIndex == lSCSIControllerIndex) 2652 ulParent = idSCSIController; 2653 else if (lControllerIndex == lSATAControllerIndex) 2654 ulParent = idSATAController; 2655 } 2656 if (pos2 != Utf8Str::npos) 2657 RTStrToInt32Ex(desc.strExtraConfig.c_str() + pos2 + 8, NULL, 0, &lAddressOnParent); 2658 2659 if ( !ulParent 2660 || lAddressOnParent == -1 2661 ) 2662 throw setError(VBOX_E_NOT_SUPPORTED, 2663 tr("Missing or bad extra config string in hard disk image: \"%s\""), desc.strExtraConfig.c_str()); 2664 } 2665 break; 2666 2667 case VirtualSystemDescriptionType_Floppy: 2668 if (uLoop == 1) 2669 { 2670 strDescription = "Floppy Drive"; 2671 strCaption = "floppy0"; // this is what OVFTool writes 2672 type = OVFResourceType_FloppyDrive; // 14 2673 lAutomaticAllocation = 0; 2674 lAddressOnParent = 0; // this is what OVFTool writes 2675 } 2676 break; 2677 2678 case VirtualSystemDescriptionType_CDROM: 2679 if (uLoop == 2) 2680 { 2681 // we can't have a CD without an IDE controller 2682 if (!idIDEController) 2683 throw setError(VBOX_E_NOT_SUPPORTED, 2684 tr("Can't have CD-ROM without IDE controller")); 2685 2686 strDescription = "CD-ROM Drive"; 2687 strCaption = "cdrom1"; // this is what OVFTool writes 2688 type = OVFResourceType_CdDrive; // 15 2689 lAutomaticAllocation = 1; 2690 ulParent = idIDEController; 2691 lAddressOnParent = 0; // this is what OVFTool writes 2692 } 2693 break; 2694 2695 case VirtualSystemDescriptionType_NetworkAdapter: 2696 /* <Item> 2697 <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> 2698 <rasd:Caption>Ethernet adapter on 'VM Network'</rasd:Caption> 2699 <rasd:Connection>VM Network</rasd:Connection> 2700 <rasd:ElementName>VM network</rasd:ElementName> 2701 <rasd:InstanceID>3</rasd:InstanceID> 2702 <rasd:ResourceType>10</rasd:ResourceType> 2703 </Item> */ 2704 if (uLoop == 1) 2705 { 2706 lAutomaticAllocation = 1; 2707 strCaption = Utf8StrFmt("Ethernet adapter on '%s'", desc.strOvf.c_str()); 2708 type = OVFResourceType_EthernetAdapter; // 10 2709 strConnection = desc.strOvf; 2710 2711 mapNetworks[desc.strOvf] = true; 2712 } 2713 break; 2714 2715 case VirtualSystemDescriptionType_USBController: 2716 /* <Item ovf:required="false"> 2717 <rasd:Caption>usb</rasd:Caption> 2718 <rasd:Description>USB Controller</rasd:Description> 2719 <rasd:InstanceId>3</rasd:InstanceId> 2720 <rasd:ResourceType>23</rasd:ResourceType> 2721 <rasd:Address>0</rasd:Address> 2722 <rasd:BusNumber>0</rasd:BusNumber> 2723 </Item> */ 2724 strDescription = "USB Controller"; 2725 strCaption = "usb"; 2726 type = OVFResourceType_UsbController; // 23 2727 lAddress = 0; // this is what OVFTool writes 2728 lBusNumber = 0; // this is what OVFTool writes 2729 break; 2730 2731 case VirtualSystemDescriptionType_SoundCard: 2732 /* <Item ovf:required="false"> 2733 <rasd:Caption>sound</rasd:Caption> 2734 <rasd:Description>Sound Card</rasd:Description> 2735 <rasd:InstanceId>10</rasd:InstanceId> 2736 <rasd:ResourceType>35</rasd:ResourceType> 2737 <rasd:ResourceSubType>ensoniq1371</rasd:ResourceSubType> 2738 <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> 2739 <rasd:AddressOnParent>3</rasd:AddressOnParent> 2504 2740 </Item> */ 2505 strDescription = "Number of virtual CPUs"; 2506 type = OVFResourceType_Processor; // 3 2507 lVirtualQuantity = 1; 2508 break; 2509 2510 case VirtualSystemDescriptionType_Memory: 2511 /* <Item> 2512 <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits> 2513 <rasd:Caption>256 MB of memory</rasd:Caption> 2514 <rasd:Description>Memory Size</rasd:Description> 2515 <rasd:ElementName>Memory</rasd:ElementName> 2516 <rasd:InstanceID>2</rasd:InstanceID> 2517 <rasd:ResourceType>4</rasd:ResourceType> 2518 <rasd:VirtualQuantity>256</rasd:VirtualQuantity> 2519 </Item> */ 2520 strDescription = "Memory Size"; 2521 type = OVFResourceType_Memory; // 4 2522 desc.strVbox.toInt(uTemp); 2523 lVirtualQuantity = (int32_t)(uTemp / _1M); 2524 strAllocationUnits = "MegaBytes"; 2525 break; 2526 2527 // case VirtualSystemDescriptionType_HardDiskControllerIDE: 2528 // strDescription = "Memory Size"; 2529 // type = OVFResourceType_Memory; // 4 2530 // desc.strVbox.toInt(uTemp); 2531 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2532 // break; 2533 2534 // case VirtualSystemDescriptionType_HardDiskControllerSATA: 2535 // strDescription = "Memory Size"; 2536 // type = OVFResourceType_Memory; // 4 2537 // desc.strVbox.toInt(uTemp); 2538 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2539 // break; 2540 2541 // case VirtualSystemDescriptionType_HardDiskControllerSCSI: 2542 // strDescription = "Memory Size"; 2543 // type = OVFResourceType_Memory; // 4 2544 // desc.strVbox.toInt(uTemp); 2545 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2546 // break; 2547 2548 // case VirtualSystemDescriptionType_HardDiskImage: 2549 // strDescription = "Memory Size"; 2550 // type = OVFResourceType_Memory; // 4 2551 // desc.strVbox.toInt(uTemp); 2552 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2553 // break; 2554 2555 // case VirtualSystemDescriptionType_Floppy: 2556 // strDescription = "Memory Size"; 2557 // type = OVFResourceType_Memory; // 4 2558 // desc.strVbox.toInt(uTemp); 2559 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2560 // break; 2561 2562 // case VirtualSystemDescriptionType_CDROM: 2563 // strDescription = "Memory Size"; 2564 // type = OVFResourceType_Memory; // 4 2565 // desc.strVbox.toInt(uTemp); 2566 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2567 // break; 2568 2569 case VirtualSystemDescriptionType_NetworkAdapter: 2570 /* <Item> 2571 <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> 2572 <rasd:Caption>Ethernet adapter on 'VM Network'</rasd:Caption> 2573 <rasd:Connection>VM Network</rasd:Connection> 2574 <rasd:ElementName>VM network</rasd:ElementName> 2575 <rasd:InstanceID>3</rasd:InstanceID> 2576 <rasd:ResourceType>10</rasd:ResourceType> 2577 </Item> */ 2578 fAutomaticAllocation = true; 2579 strCaption = Utf8StrFmt("Ethernet adapter on '%s'", desc.strOvf.c_str()); 2580 type = OVFResourceType_EthernetAdapter; // 10 2581 strConnection = desc.strOvf; 2582 2583 mapNetworks[desc.strOvf] = true; 2584 break; 2585 2586 // case VirtualSystemDescriptionType_USBController: 2587 // strDescription = "Memory Size"; 2588 // type = OVFResourceType_Memory; // 4 2589 // desc.strVbox.toInt(uTemp); 2590 // lVirtualQuantity = (int32_t)(uTemp / _1M); 2591 // break; 2592 2593 /* case VirtualSystemDescriptionType_SoundCard: 2594 strDescription = "Memory Size"; 2595 type = OVFResourceType_Memory; // 4 2596 desc.strVbox.toInt(uTemp); 2597 lVirtualQuantity = (int32_t)(uTemp / _1M); 2598 break;*/ 2741 strDescription = "Sound Card"; 2742 strCaption = "sound"; 2743 type = OVFResourceType_SoundCard; // 35 2744 strResourceSubType = desc.strOvf; // e.g. ensoniq1371 2745 lAutomaticAllocation = 0; 2746 lAddressOnParent = 3; // what gives? this is what OVFTool writes 2747 break; 2748 } 2749 2750 if (type) 2751 { 2752 xml::ElementNode *pItem; 2753 2754 pItem = pelmVirtualHardwareSection->createChild("Item"); 2755 2756 if (!strDescription.isEmpty()) 2757 pItem->createChild("rasd:Description")->addContent(strDescription); 2758 if (!strCaption.isEmpty()) 2759 pItem->createChild("rasd:Caption")->addContent(strCaption); 2760 2761 if (!strAllocationUnits.isEmpty()) 2762 pItem->createChild("rasd:AllocationUnits")->addContent(strAllocationUnits); 2763 2764 if (lAutomaticAllocation != -1) 2765 pItem->createChild("rasd:AutomaticAllocation")->addContent( (lAutomaticAllocation) ? "true" : "false" ); 2766 2767 if (!strConnection.isEmpty()) 2768 pItem->createChild("rasd:Connection")->addContent(strConnection); 2769 2770 // <rasd:InstanceID>1</rasd:InstanceID> 2771 pItem->createChild("rasd:InstanceID")->addContent(Utf8StrFmt("%d", ulInstanceID)); 2772 ++ulInstanceID; 2773 2774 // <rasd:ResourceType>3</rasd:ResourceType> 2775 pItem->createChild("rasd:ResourceType")->addContent(Utf8StrFmt("%d", type)); 2776 if (!strResourceSubType.isEmpty()) 2777 pItem->createChild("rasd:ResourceSubType")->addContent(strResourceSubType); 2778 2779 // <rasd:VirtualQuantity>1</rasd:VirtualQuantity> 2780 if (lVirtualQuantity != -1) 2781 pItem->createChild("rasd:VirtualQuantity")->addContent(Utf8StrFmt("%d", lVirtualQuantity)); 2782 2783 if (lAddress != -1) 2784 pItem->createChild("rasd:Address")->addContent(Utf8StrFmt("%d", lAddress)); 2785 2786 if (lBusNumber != -1) 2787 pItem->createChild("rasd:BusNumber")->addContent(Utf8StrFmt("%d", lBusNumber)); 2788 2789 if (ulParent) 2790 pItem->createChild("rasd:Parent")->addContent(Utf8StrFmt("%d", ulParent)); 2791 if (lAddressOnParent != -1) 2792 pItem->createChild("rasd:AddressOnParent")->addContent(Utf8StrFmt("%d", lAddressOnParent)); 2793 2794 if (!strHostResource.isEmpty()) 2795 pItem->createChild("rasd:HostResource")->addContent(strHostResource); 2796 } 2599 2797 } 2600 2601 if (type) 2602 { 2603 xml::ElementNode *pItem; 2604 pItem = pelmVirtualHardwareSection->createChild("Item"); 2605 2606 if (!strAllocationUnits.isEmpty()) 2607 pItem->createChild("rasd:AllocationUnits")->addContent(strAllocationUnits); 2608 2609 if (fAutomaticAllocation) 2610 pItem->createChild("rasd:AutomaticAllocation")->addContent("true"); 2611 2612 if (!strDescription.isEmpty()) 2613 pItem->createChild("rasd:Description")->addContent(strDescription); 2614 if (!strCaption.isEmpty()) 2615 pItem->createChild("rasd:Caption")->addContent(strCaption); 2616 2617 if (!strConnection.isEmpty()) 2618 pItem->createChild("rasd:Connection")->addContent(strConnection); 2619 2620 // <rasd:InstanceID>1</rasd:InstanceID> 2621 pItem->createChild("rasd:InstanceID")->addContent(Utf8StrFmt("%d", ulInstanceID)); 2622 ++ulInstanceID; 2623 2624 // <rasd:ResourceType>3</rasd:ResourceType> 2625 pItem->createChild("rasd:ResourceType")->addContent(Utf8StrFmt("%d", type)); 2626 2627 // <rasd:VirtualQuantity>1</rasd:VirtualQuantity> 2628 if (lVirtualQuantity != -1) 2629 pItem->createChild("rasd:VirtualQuantity")->addContent(Utf8StrFmt("%d", lVirtualQuantity)); 2630 2631 } 2632 } 2798 } // for (size_t uLoop = 0; ... 2633 2799 } 2634 2800 … … 2993 3159 BOOL fDVDEnabled; 2994 3160 BOOL fFloppyEnabled; 3161 BOOL fUSBEnabled; 3162 BOOL fAudioEnabled; 3163 AudioControllerType_T audioController; 3164 2995 3165 ComPtr<IUSBController> pUsbController; 2996 3166 ComPtr<IAudioAdapter> pAudioAdapter; … … 3027 3197 rc = COMGETTER(USBController)(pUsbController.asOutParam()); 3028 3198 if (FAILED(rc)) throw rc; 3199 rc = pUsbController->COMGETTER(Enabled)(&fUSBEnabled); 3029 3200 3030 3201 pAudioAdapter = mAudioAdapter; 3202 rc = pAudioAdapter->COMGETTER(Enabled)(&fAudioEnabled); 3203 if (FAILED(rc)) throw rc; 3204 rc = pAudioAdapter->COMGETTER(AudioController)(&audioController); 3205 if (FAILED(rc)) throw rc; 3031 3206 3032 3207 // create a new virtual system … … 3065 3240 strMemory); 3066 3241 3067 uint32_t uControllerId = 1; 3068 uint32_t uidIdeController; 3069 uint32_t uidSataController; 3242 int32_t lIDEControllerIndex = 0; 3243 int32_t lSATAControllerIndex = 0; 3070 3244 3071 3245 // <const name="HardDiskControllerIDE" value="6" /> … … 3085 3259 if (strVbox.length()) 3086 3260 { 3087 uidIdeController = uControllerId++;3088 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE, Utf8StrFmt("%d", uidIdeController), strVbox, "");3261 lIDEControllerIndex = pNewDesc->m->llDescriptions.size(); 3262 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE, Utf8StrFmt("%d", lIDEControllerIndex), strVbox, ""); 3089 3263 } 3090 3264 … … 3098 3272 if (fSataEnabled) 3099 3273 { 3100 uidSataController = uControllerId++;3101 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA, Utf8StrFmt("%d", uidSataController), strVbox, "");3274 lSATAControllerIndex = pNewDesc->m->llDescriptions.size(); 3275 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA, Utf8StrFmt("%d", lSATAControllerIndex), strVbox, ""); 3102 3276 } 3103 3277 #endif // VBOX_WITH_AHCI … … 3107 3281 3108 3282 // <const name="HardDiskImage" value="9" /> 3109 // hardDiskAttachments3110 // mHDData->mAttachments @todo3111 3283 HDData::AttachmentList::iterator itA; 3112 3284 for (itA = mHDData->mAttachments.begin(); … … 3122 3294 LONG lDevice; 3123 3295 3124 // and how this translates to the virtual system3125 LONG lChannelVsys;3126 3127 3296 rc = pHDA->COMGETTER(HardDisk)(pHardDisk.asOutParam()); 3128 3297 if (FAILED(rc)) throw rc; … … 3142 3311 rc = pHardDisk->COMGETTER(Name)(bstrName.asOutParam()); 3143 3312 3144 uint32_t uidControllerVsys; 3313 // and how this translates to the virtual system 3314 int32_t lControllerVsys = 0; 3315 LONG lChannelVsys; 3145 3316 3146 3317 switch (storageBus) 3147 3318 { 3148 case HardDiskController::IDE:3319 case StorageBus::IDE: 3149 3320 // this is the exact reverse to what we're doing in Appliance::taskThreadImportMachines, 3150 3321 // and it must be updated when that is changed! … … 3159 3330 throw setError(VBOX_E_NOT_SUPPORTED, 3160 3331 tr("Cannot handle hard disk attachment: channel is %d, device is %d"), lChannel, lDevice); 3161 break; 3162 3163 uidControllerVsys = uidIdeController; 3332 3333 lControllerVsys = lIDEControllerIndex; 3164 3334 break; 3165 3335 3166 case HardDiskController::SATA:3336 case StorageBus::SATA: 3167 3337 lChannelVsys = lChannel; // should be between 0 and 29 3168 uidControllerVsys = uidSataController;3338 lControllerVsys = lSATAControllerIndex; 3169 3339 break; 3170 3340 3171 case HardDiskController::SCSI: 3172 // mhda.busType = StorageBus_SCSI; 3341 // case StorageBus::SCSI: 3342 // // mhda.busType = StorageBus_SCSI; 3343 // throw setError(VBOX_E_NOT_SUPPORTED, 3344 // tr("SCSI controller support is not available yet in VirtualBox")); 3345 // // @todo 3346 // break; 3347 3348 default: 3173 3349 throw setError(VBOX_E_NOT_SUPPORTED, 3174 tr("SCSI controller support is not available yet in VirtualBox")); 3175 // @todo 3350 tr("Cannot handle hard disk attachment: storageBus is %d, channel is %d, device is %d"), storageBus, lChannel, lDevice); 3176 3351 break; 3177 3178 default: break;3179 3352 } 3180 3353 … … 3183 3356 "", // OVF value: unknown as of now 3184 3357 Utf8Str(bstrLocation), // vbox value: media path 3185 Utf8StrFmt("controller=% d;channel=%d", uidControllerVsys, lChannelVsys));3358 Utf8StrFmt("controller=%RI32;channel=%RI32", lControllerVsys, lChannelVsys)); 3186 3359 } 3187 3360 … … 3194 3367 pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM, "", "", ""); 3195 3368 3196 // <const name="LogicalNetwork" value="12" /> 3197 3198 // <const name="NetworkAdapter" value="13" /> 3369 // <const name="NetworkAdapter" /> 3199 3370 size_t a; 3200 3371 for (a = 0; … … 3254 3425 } 3255 3426 3256 // <const name="USBController" value="14" /> 3257 3258 // <const name="SoundCard" value="15" /> 3427 // <const name="USBController" /> 3428 #ifdef VBOX_WITH_USB 3429 if (fUSBEnabled) 3430 pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", ""); 3431 #endif /* VBOX_WITH_USB */ 3432 3433 // <const name="SoundCard" /> 3434 if (fAudioEnabled) 3435 { 3436 pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard, 3437 "", 3438 "ensoniq1371", // this is what OVFTool writes and VMware supports 3439 Utf8StrFmt("%RI32", audioController)); 3440 } 3259 3441 3260 3442 // finally, add the virtual system to the appliance -
trunk/src/VBox/Main/glue/string.cpp
r17054 r17634 38 38 const size_t Utf8Str::npos = (size_t)-1; 39 39 40 Utf8Str Utf8Str::substr(size_t pos /*= 0*/, size_t n /*= npos*/) const 40 size_t Utf8Str::find(const char *pcszFind, 41 size_t pos /*= 0*/) 42 const 43 { 44 const char *pszThis, *p; 45 46 if ( ((pszThis = c_str())) 47 && (pos < length()) 48 && ((p = strstr(pszThis + pos, pcszFind))) 49 ) 50 return p - pszThis; 51 52 return npos; 53 } 54 55 Utf8Str Utf8Str::substr(size_t pos /*= 0*/, size_t n /*= npos*/) 56 const 41 57 { 42 58 Utf8Str ret; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17613 r17634 3170 3170 </li> 3171 3171 <li> 3172 "SoundCard": a sound card. There can be at most one such item. If and only if such an item is 3173 present, sound support will be enabled for the new virtual machine. Note that the virtual 3174 machine in VirtualBox will always be presented with the standard VirtualBox soundcard, which 3175 may be different from the virtual soundcard expected by the appliance. 3172 "USBController": a USB controller. There can be at most one such item. If and only if such an 3173 item ispresent, USB support will be enabled for the new virtual machine. 3174 </li> 3175 <li> 3176 "SoundCard": a sound card. There can be at most one such item. If and only if such an item is 3177 present, sound support will be enabled for the new virtual machine. Note that the virtual 3178 machine in VirtualBox will always be presented with the standard VirtualBox soundcard, which 3179 may be different from the virtual soundcard expected by the appliance. 3176 3180 </li> 3177 3181 </ul> -
trunk/src/VBox/Main/include/ApplianceImpl.h
r17573 r17634 183 183 struct Data; 184 184 Data *m; 185 186 friend class Machine; 185 187 }; 186 188
Note:
See TracChangeset
for help on using the changeset viewer.