Changeset 31595 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 12, 2010 11:44:47 AM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r31579 r31595 1180 1180 1181 1181 LogFlowThisFuncLeave(); 1182 1183 return rc;1184 }1185 1186 STDMETHODIMP VirtualBox::CreateLegacyMachine(IN_BSTR aName,1187 IN_BSTR aOsTypeId,1188 IN_BSTR aSettingsFile,1189 IN_BSTR aId,1190 IMachine **aMachine)1191 {1192 CheckComArgStrNotEmptyOrNull(aName);1193 CheckComArgStrNotEmptyOrNull(aSettingsFile);1194 /** @todo tighten checks on aId? */1195 CheckComArgOutPointerValid(aMachine);1196 1197 AutoCaller autoCaller(this);1198 if (FAILED(autoCaller.rc())) return autoCaller.rc();1199 1200 HRESULT rc = E_FAIL;1201 1202 Utf8Str settingsFile = aSettingsFile;1203 /* append the default extension if none */1204 if (!RTPathHaveExt(settingsFile.c_str()))1205 settingsFile = Utf8StrFmt("%s.xml", settingsFile.c_str());1206 1207 /* create a new object */1208 ComObjPtr<Machine> machine;1209 rc = machine.createObject();1210 if (FAILED(rc)) return rc;1211 1212 /* Create UUID if an empty one was specified. */1213 Guid id(aId);1214 if (id.isEmpty())1215 id.create();1216 1217 GuestOSType *osType = NULL;1218 rc = findGuestOSType(Bstr(aOsTypeId), osType);1219 if (FAILED(rc)) return rc;1220 1221 /* initialize the machine object */1222 rc = machine->init(this,1223 settingsFile,1224 Utf8Str(aName),1225 id,1226 osType,1227 FALSE /* aOverride */,1228 FALSE /* aNameSync */);1229 if (SUCCEEDED(rc))1230 {1231 /* set the return value */1232 rc = machine.queryInterfaceTo(aMachine);1233 AssertComRC(rc);1234 }1235 1182 1236 1183 return rc; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31577 r31595 1590 1590 </method> 1591 1591 1592 <method name="createLegacyMachine">1593 <desc>1594 Creates a new virtual machine in "legacy" mode, using the specified1595 settings file to store machine settings.1596 1597 As opposed to machines created by <link to="#createMachine"/>,1598 the settings file of the machine created in "legacy" mode is not1599 automatically renamed when the machine name is changed -- it will always1600 remain the same as specified in this method call.1601 1602 The specified settings file name can be absolute (full path) or relative1603 to the <link to="IVirtualBox::homeFolder">VirtualBox home1604 directory</link>. If the file name doesn't contain an extension, the1605 default extension (.xml) will be appended.1606 1607 Note that the configuration of the newly created machine is not1608 saved to disk (and therefore no settings file is created)1609 until <link to="IMachine::saveSettings"/> is called. If the1610 specified settings file already exists, this method1611 will fail with <link to="VBOX_E_FILE_ERROR"/>.1612 1613 See <link to="#createMachine"/> for more information.1614 1615 @deprecated This method may be removed later. Use <link1616 to="IVirtualBox::createMachine"/> instead.1617 1618 <note>1619 There is no way to change the name of the settings file1620 of the machine created in "legacy" mode.1621 </note>1622 1623 <result name="VBOX_E_OBJECT_NOT_FOUND">1624 @a osTypeId is invalid.1625 </result>1626 <result name="VBOX_E_FILE_ERROR">1627 @a settingsFile is invalid or the settings file already exists or1628 could not be created due to an I/O error.1629 </result>1630 <result name="E_INVALIDARG">1631 @a name or @a settingsFile is empty or @c null.1632 </result>1633 </desc>1634 1635 <param name="name" type="wstring" dir="in">1636 <desc>Machine name.</desc>1637 </param>1638 <param name="osTypeId" type="wstring" dir="in">1639 <desc>Machine OS Type ID.</desc>1640 </param>1641 <param name="settingsFile" type="wstring" dir="in">1642 <desc>Name of the machine settings file.</desc>1643 </param>1644 <param name="id" type="uuid" mod="string" dir="in">1645 <desc>Machine UUID (optional).</desc>1646 </param>1647 <param name="machine" type="IMachine" dir="return">1648 <desc>Created machine object.</desc>1649 </param>1650 </method>1651 1652 1592 <method name="openMachine"> 1653 1593 <desc> … … 1662 1602 will be used to construct the machine object. 1663 1603 1664 @deprecated Will be removed soon.1665 1604 <result name="VBOX_E_FILE_ERROR"> 1666 1605 Settings file name invalid, not found or sharing violation. … … 4293 4232 at the indicated port and device. 4294 4233 4295 This method is intended for managing storage devices in general (it works 4296 for both fixed and removable media) while a machine is powered off. 4234 This method is intended for managing storage devices in general while a 4235 machine is powered off. It can be used to attach and detach fixed 4236 and removeable media. 4237 4238 Starting with VirtualBox 3.3, media no longer have to be globally 4239 registered before they can be attached to a virtual machine. For 4240 compatibility with machines created by older versions of VirtualBox 4241 and for greater flexibility with managing removable media, media 4242 can still be registered globally. As a result, there are now 4243 several variants of attaching media: 4244 4245 <ul> 4246 <li>To directly attach a medium without first registering it 4247 globally, simply pass the file name of its storage unit in the 4248 @a medium string parameter. This works for all media formats 4249 supported by the <li to="VirtualBox::openMedium" /> method. 4250 The difference is that the medium will not be saved in the 4251 global media registry, but only with the machine settings 4252 XML file. For better portability of the machine as a whole, 4253 it is recommended to place the storage unit in the machine's 4254 folder as well. 4255 </li> 4256 4257 <li>To attach a medium that has been globally registered using 4258 <li to="VirtualBox::openMedium" />, call that method with the 4259 full path of a storage unit. Then, retrieve the UUID of that 4260 medium from its <link to="IMedium::id" /> attribute and pass 4261 that UUID into this method. This way, the medium will be 4262 saved in the global media registry in the VirtualBox.xml 4263 settings file. This is still the recommended way to manage 4264 removable media such as ISO and RAW files if they are to be 4265 used by several virtual machines and the storage unit is not 4266 located in the machine's directory. 4267 </li> 4268 4269 <li>Only for storage devices supporting removable media (such as 4270 DVDs and floppies), you can also specify an empty string to 4271 indicate an empty drive or the UUID of a host DVD or floppy 4272 drive; those UUIDs can be obtained from <link to="IHost::DVDDrives" /> 4273 and <link to="IHost::floppyDrives"/>. 4274 For removeable devices, you can also use <link to="IMachine::mountMedium"/> 4275 to change the media while the machine is running. 4276 </li> 4277 </ul> 4278 4297 4279 In a VM's default configuration of virtual machines, the secondary 4298 4280 master of the IDE controller is used for a CD/DVD drive. 4299 4300 For fixed media such as hard disks, the given medium identifier cannot4301 be a zero UUID.4302 4303 For storage devices supporting removable media (such as DVDs and floppies),4304 you can also use <link to="IMachine::mountMedium"/> for changing the media4305 while the machine is running. For those devices, you can also specify4306 a zero UUID to indicate an empty drive or the UUID of a host drive;4307 see <link to="IMediumAttachment" /> for details.4308 4281 4309 4282 After calling this returns successfully, a new instance of … … 4311 4284 attachments (see <link to="IMachine::mediumAttachments"/>). 4312 4285 4286 See <link to="IMedium"/> and <link to="IMediumAttachment"/> for more 4287 information about attaching media. 4288 4313 4289 The specified device slot must not have a device attached to it, 4314 4290 or this method will fail. 4315 4291 4316 See <link to="IMedium"/> and <link to="IMediumAttachment"/> for more4317 information about attaching media.4318 4319 4292 <note> 4320 You cannot attach a device to a running machine. Also, you cannot4321 attach a device to a newly created machine until this machine's4322 settings are saved to disk using<link to="#saveSettings"/>.4293 You cannot attach a device to a newly created machine until 4294 this machine's settings are saved to disk using 4295 <link to="#saveSettings"/>. 4323 4296 </note> 4324 4297 <note> … … 4332 4305 4333 4306 <result name="E_INVALIDARG"> 4334 SATA device, SATA port, IDE port or IDE slot out of range. 4307 SATA device, SATA port, IDE port or IDE slot out of range, or 4308 file or UUID not found. 4335 4309 </result> 4336 4310 <result name="VBOX_E_INVALID_OBJECT_STATE"> … … 4363 4337 <desc>Device type of the attached device.</desc> 4364 4338 </param> 4365 <param name="id" type="uuid" mod="string" dir="in"> 4366 <desc>UUID of the medium to mount. Can be a zero UUID or the UUID of 4367 a host drive for removeable media; see <link to="IMediumAttachment" /> 4368 for details.</desc> 4339 <param name="medium" type="wstring" dir="in"> 4340 <desc>Path of the storage unit or UUID of the medium or the UUID of a 4341 host drive to mount, or an empty string for an empty drive.</desc> 4369 4342 </param> 4370 4343 </method> … … 14225 14198 <desc>Type of the medium this event relates to.</desc> 14226 14199 </attribute> 14227 14200 14228 14201 <attribute name="registered" type="boolean" readonly="yes"> 14229 14202 <desc> -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r31568 r31595 119 119 120 120 /* IVirtualBox methods */ 121 122 121 STDMETHOD(CreateMachine) (IN_BSTR aName, IN_BSTR aOsTypeId, IN_BSTR aBaseFolder, 123 122 IN_BSTR aId, BOOL aOverride, IMachine **aMachine); 124 STDMETHOD(CreateLegacyMachine) (IN_BSTR aName, IN_BSTR aOsTypeId, IN_BSTR aSettingsFile,125 IN_BSTR aId, IMachine **aMachine);126 123 STDMETHOD(OpenMachine) (IN_BSTR aSettingsFile, IMachine **aMachine); 127 124 STDMETHOD(RegisterMachine) (IMachine *aMachine);
Note:
See TracChangeset
for help on using the changeset viewer.