VirtualBox

Changeset 23932 in vbox for trunk/src


Ignore:
Timestamp:
Oct 21, 2009 1:08:35 PM (15 years ago)
Author:
vboxsync
Message:

VBoxManage: fixed bug which caused changing media during runtime to fail

File:
1 edited

Legend:

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

    r23928 r23932  
    173173    }
    174174
    175     if (fRunTime)
    176     {
    177         if (   !RTStrICmp(pszMedium, "none")
    178             || !RTStrICmp(pszType, "hdd"))
    179             errorArgument("DVD/HardDisk Drives can't be changed while the VM is still running\n");
    180         if (pszPassThrough)
    181             errorArgument("Drive passthrough state can't be changed while the VM is still running\n");
    182 
     175    if (   fRunTime
     176        && (   !RTStrICmp(pszMedium, "none")
     177            || !RTStrICmp(pszType, "hdd")))
     178    {
     179        errorArgument("DVD/HardDisk Drives can't be changed while the VM is still running\n");
    183180        goto leave;
    184181    }
     182
     183    if (fRunTime && pszPassThrough)
     184    {
     185        errorArgument("Drive passthrough state can't be changed while the VM is still running\n");
     186        goto leave;
     187    }
     188
    185189
    186190    /* get the mutable session machine */
     
    214218                {
    215219                    /* just unmount the floppy/dvd */
    216                     CHECK_ERROR (machine, MountMedium(Bstr(pszCtl), port, device, NULL));
     220                    CHECK_ERROR (machine, MountMedium(Bstr(pszCtl), port, device, Bstr("")));
     221                }
     222                else
     223                {
     224                    errorArgument("No DVD/Floppy Drive attached to the controller '%s'"
     225                                  "at the port: %u, device: %u", pszCtl, port, device);
     226                    goto leave;
    217227                }
    218228            }
     
    239249            /* attach a empty floppy/dvd drive after removing previous attachment */
    240250            machine->DetachDevice(Bstr(pszCtl), port, device);
    241             CHECK_ERROR (machine, AttachDevice(Bstr(pszCtl), port, device, deviceType, NULL));
     251            CHECK_ERROR (machine, AttachDevice(Bstr(pszCtl), port, device, deviceType, Bstr("")));
    242252        }
    243253    }
     
    269279                    {
    270280                        machine->DetachDevice(Bstr(pszCtl), port, device);
    271                         rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, NULL);
     281                        rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, Bstr(""));
    272282                    }
    273283                }
    274284                else
    275285                {
    276                     rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, NULL);
     286                    rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, Bstr(""));
    277287                }
    278288            }
     
    393403            if (   !fRunTime
    394404                && !floppyAttachment)
    395                 CHECK_ERROR (machine, AttachDevice(Bstr(pszCtl), port, device, DeviceType_Floppy, NULL));
     405                CHECK_ERROR (machine, AttachDevice(Bstr(pszCtl), port, device, DeviceType_Floppy, Bstr("")));
    396406
    397407            /* host drive? */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette