Changeset 23963 in vbox
- Timestamp:
- Oct 22, 2009 9:52:34 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53786
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r23934 r23963 187 187 } 188 188 189 190 189 /* get the mutable session machine */ 191 190 a->session->COMGETTER(Machine)(machine.asOutParam()); … … 254 253 else 255 254 { 255 { 256 /** 257 * try to determine the type of the drive from the 258 * storage controller chipset, the attachment and 259 * the medium being attached 260 */ 261 ULONG ctlType = StorageControllerType_Null; 262 CHECK_ERROR(storageCtl, COMGETTER(ControllerType)(&ctlType)); 263 if (ctlType == StorageControllerType_I82078) 264 { 265 /** 266 * floppy controller found so lets assume the medium 267 * given by the user is also a floppy image or floppy 268 * host drive 269 */ 270 pszType = "fdd"; 271 } 272 else 273 { 274 /** 275 * for SATA/SCSI/IDE it is hard to tell if it is a harddisk or 276 * a dvd being attached so lets check if the medium attachment 277 * and the mediumi, both are of same type. if yes then we are 278 * sure of its type and don't need the user to enter it manually 279 * else ask the user for the type. 280 */ 281 ComPtr<IMediumAttachment> mediumAttachement; 282 rc = machine->GetMediumAttachment(Bstr(pszCtl), port, device, mediumAttachement.asOutParam()); 283 if (SUCCEEDED(rc)) 284 { 285 DeviceType_T deviceType; 286 mediumAttachement->COMGETTER(Type)(&deviceType); 287 288 if (deviceType == DeviceType_DVD) 289 { 290 Bstr uuid(pszMedium); 291 ComPtr<IMedium> dvdMedium; 292 /* first assume it's a UUID */ 293 rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam()); 294 if (FAILED(rc) || !dvdMedium) 295 { 296 /* must be a filename, check if it's in the collection */ 297 a->virtualBox->FindDVDImage(Bstr(pszMedium), dvdMedium.asOutParam()); 298 } 299 if (dvdMedium) 300 { 301 /** 302 * ok so the medium and attachment both are DVD's so it is 303 * safe to assume that we are dealing with a DVD here 304 */ 305 pszType = "dvddrive"; 306 } 307 } 308 else if (deviceType == DeviceType_HardDisk) 309 { 310 Bstr uuid(pszMedium); 311 ComPtr<IMedium> hardDisk; 312 /* first assume it's a UUID */ 313 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); 314 if (FAILED(rc) || !hardDisk) 315 { 316 /* must be a filename, check if it's in the collection */ 317 a->virtualBox->FindHardDisk(Bstr(pszMedium), hardDisk.asOutParam()); 318 } 319 if (hardDisk) 320 { 321 /** 322 * ok so the medium and attachment both are hdd's so it is 323 * safe to assume that we are dealing with a hdd here 324 */ 325 pszType = "hdd"; 326 } 327 } 328 } 329 } 330 /* for all other cases lets ask the user what type of drive it is */ 331 } 332 256 333 if (!pszType) 257 334 { … … 353 430 ComPtr<IMediumAttachment> mediumAttachement; 354 431 355 /* if there is a dvd drive at the given location, remove it */ 356 rc = machine->GetMediumAttachment(Bstr(pszCtl), port, device, mediumAttachement.asOutParam()); 357 if (SUCCEEDED(rc)) 358 { 359 DeviceType_T deviceType; 360 mediumAttachement->COMGETTER(Type)(&deviceType); 361 362 if (deviceType != DeviceType_HardDisk) 363 machine->DetachDevice(Bstr(pszCtl), port, device); 364 } 432 /* if there is anything attached at the given location, remove it */ 433 machine->DetachDevice(Bstr(pszCtl), port, device); 365 434 366 435 /* first guess is that it's a UUID */
Note:
See TracChangeset
for help on using the changeset viewer.