[PATCH 04/12] vbox: remove _vboxAttachDrivesOld

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



and fold vboxAttachDrivesNew into vboxAttachDrives
---
 src/vbox/vbox_common.c        |  45 +---
 src/vbox/vbox_tmpl.c          | 487 ------------------------------------------
 src/vbox/vbox_uniformed_api.h |   1 -
 3 files changed, 1 insertion(+), 532 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index af8a9f7..17a8024 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1039,9 +1039,8 @@ vboxSetBootDeviceOrder(virDomainDefPtr def, vboxDriverPtr data,
 }
 
 static void
-vboxAttachDrivesNew(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
+vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
 {
-    /* AttachDrives for 3.0 and later */
     size_t i;
     nsresult rc = 0;
     PRUint32 maxPortPerInst[StorageBus_Floppy + 1] = {};
@@ -1049,9 +1048,6 @@ vboxAttachDrivesNew(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
     PRUnichar *storageCtlName = NULL;
     bool error = false;
 
-    if (gVBoxAPI.vboxAttachDrivesUseOld)
-        VIR_WARN("This function may not work in current vbox version");
-
     /* get the max port/slots/etc for the given storage bus */
     error = !vboxGetMaxPortSlotValues(data->vboxObj, maxPortPerInst,
                                       maxSlotPerPort);
@@ -1248,45 +1244,6 @@ vboxAttachDrivesNew(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
 }
 
 static void
-vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
-{
-    /* Here, About the vboxAttachDrives. In fact,there is
-     * three different implementations. We name it as
-     * v1, v2 and v3.
-     *
-     * The first version(v1) is only used in vbox 2.2 and 3.0,
-     * v2 is used by 3.1 and 3.2, and v3 is used for later
-     * vbox versions. In sight of implementation, the v1 is
-     * totally different with v2 and v3. The v2 shares the same
-     * outline with v3, meanwhile the API they used has much
-     * difference.
-     *
-     * It seems we have no thing to do with old versions such as
-     * v1 and v2 when developing new vbox drivers. What's more,
-     * most of the vbox APIs used in v1 and v2 is incompatible with
-     * new vbox versions. It is a burden to put these APIs into
-     * vboxUniformedAPI, I prefer not to do that.
-     *
-     * After balancing the code size and the complied code size,
-     * I put my solution here. The v1 and v2 is a version specified
-     * code, which only be generated for first four version. The v3
-     * will be put in vbox_common.c, it be complied only once, then
-     * be used by all next vbox drivers.
-     *
-     * Check the flag vboxAttachDrivesUseOld can tell you which
-     * implementation to use. When the flag is set, we need use
-     * the old version though gVBoxAPI.vboxAttachDrivesOld. It
-     * will automatically point to v1 or v2 deponds on you version.
-     * If the flag is clear, just call vboxAttachDrivesNew, which
-     * is the v3 implementation.
-     */
-    if (gVBoxAPI.vboxAttachDrivesUseOld)
-        gVBoxAPI.vboxAttachDrivesOld(def, data, machine);
-    else
-        vboxAttachDrivesNew(def, data, machine);
-}
-
-static void
 vboxAttachSound(virDomainDefPtr def, IMachine *machine)
 {
     nsresult rc;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 7fcf213..c9c946c 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -324,490 +324,6 @@ static virDomainState _vboxConvertState(PRUint32 state)
     }
 }
 
-#if VBOX_API_VERSION < 3001000
-
-static void
-_vboxAttachDrivesOld(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
-{
-    size_t i;
-    nsresult rc;
-
-    if (def->ndisks == 0)
-        return;
-
-    for (i = 0; i < def->ndisks; i++) {
-        const char *src = virDomainDiskGetSource(def->disks[i]);
-        int type = virDomainDiskGetType(def->disks[i]);
-        int format = virDomainDiskGetFormat(def->disks[i]);
-
-        VIR_DEBUG("disk(%zu) type:       %d", i, type);
-        VIR_DEBUG("disk(%zu) device:     %d", i, def->disks[i]->device);
-        VIR_DEBUG("disk(%zu) bus:        %d", i, def->disks[i]->bus);
-        VIR_DEBUG("disk(%zu) src:        %s", i, src);
-        VIR_DEBUG("disk(%zu) dst:        %s", i, def->disks[i]->dst);
-        VIR_DEBUG("disk(%zu) driverName: %s", i,
-                  virDomainDiskGetDriver(def->disks[i]));
-        VIR_DEBUG("disk(%zu) driverType: %s", i,
-                  virStorageFileFormatTypeToString(format));
-        VIR_DEBUG("disk(%zu) cachemode:  %d", i, def->disks[i]->cachemode);
-        VIR_DEBUG("disk(%zu) readonly:   %s", i, (def->disks[i]->src->readonly
-                                             ? "True" : "False"));
-        VIR_DEBUG("disk(%zu) shared:     %s", i, (def->disks[i]->src->shared
-                                             ? "True" : "False"));
-
-        if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
-            if (type == VIR_STORAGE_TYPE_FILE && src) {
-                IDVDDrive *dvdDrive = NULL;
-                /* Currently CDROM/DVD Drive is always IDE
-                 * Secondary Master so neglecting the following
-                 * parameters:
-                 *      def->disks[i]->bus
-                 *      def->disks[i]->dst
-                 */
-
-                machine->vtbl->GetDVDDrive(machine, &dvdDrive);
-                if (dvdDrive) {
-                    IDVDImage *dvdImage = NULL;
-                    PRUnichar *dvdfileUtf16 = NULL;
-                    vboxIID dvduuid = VBOX_IID_INITIALIZER;
-                    vboxIID dvdemptyuuid = VBOX_IID_INITIALIZER;
-
-                    VBOX_UTF8_TO_UTF16(src, &dvdfileUtf16);
-
-                    data->vboxObj->vtbl->FindDVDImage(data->vboxObj,
-                                                      dvdfileUtf16, &dvdImage);
-                    if (!dvdImage) {
-                        data->vboxObj->vtbl->OpenDVDImage(data->vboxObj,
-                                                          dvdfileUtf16,
-                                                          dvdemptyuuid.value,
-                                                          &dvdImage);
-                    }
-                    if (dvdImage) {
-                        rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage,
-                                                           &dvduuid.value);
-                        if (NS_FAILED(rc)) {
-                            virReportError(VIR_ERR_INTERNAL_ERROR,
-                                           _("can't get the uuid of the file to "
-                                             "be attached to cdrom: %s, rc=%08x"),
-                                           src, (unsigned)rc);
-                        } else {
-                            rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value);
-                            if (NS_FAILED(rc)) {
-                                virReportError(VIR_ERR_INTERNAL_ERROR,
-                                               _("could not attach the file to cdrom: %s, rc=%08x"),
-                                               src, (unsigned)rc);
-                            } else {
-                                DEBUGIID("CD/DVDImage UUID:", dvduuid.value);
-                            }
-                        }
-
-                        VBOX_MEDIUM_RELEASE(dvdImage);
-                    }
-                    vboxIIDUnalloc(&dvduuid);
-                    VBOX_UTF16_FREE(dvdfileUtf16);
-                    VBOX_RELEASE(dvdDrive);
-                }
-            } else if (type == VIR_STORAGE_TYPE_BLOCK) {
-            }
-        } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-            if (type == VIR_STORAGE_TYPE_FILE && src) {
-                IHardDisk *hardDisk = NULL;
-                PRUnichar *hddfileUtf16 = NULL;
-                vboxIID hdduuid = VBOX_IID_INITIALIZER;
-                PRUnichar *hddEmpty = NULL;
-                /* Current Limitation: Harddisk can't be connected to
-                 * Secondary Master as Secondary Master is always used
-                 * for CD/DVD Drive, so don't connect the harddisk if it
-                 * is requested to be connected to Secondary master
-                 */
-
-                VBOX_UTF8_TO_UTF16(src, &hddfileUtf16);
-                VBOX_UTF8_TO_UTF16("", &hddEmpty);
-
-                data->vboxObj->vtbl->FindHardDisk(data->vboxObj, hddfileUtf16,
-                                                  &hardDisk);
-
-                if (!hardDisk) {
-# if VBOX_API_VERSION == 2002000
-                    data->vboxObj->vtbl->OpenHardDisk(data->vboxObj,
-                                                      hddfileUtf16,
-                                                      AccessMode_ReadWrite,
-                                                      &hardDisk);
-# else
-                    data->vboxObj->vtbl->OpenHardDisk(data->vboxObj,
-                                                      hddfileUtf16,
-                                                      AccessMode_ReadWrite,
-                                                      0,
-                                                      hddEmpty,
-                                                      0,
-                                                      hddEmpty,
-                                                      &hardDisk);
-# endif
-                }
-
-                if (hardDisk) {
-                    rc = hardDisk->vtbl->imedium.GetId((IMedium *)hardDisk,
-                                                       &hdduuid.value);
-                    if (NS_FAILED(rc)) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
-                                       _("can't get the uuid of the file to be "
-                                         "attached as harddisk: %s, rc=%08x"),
-                                       src, (unsigned)rc);
-                    } else {
-                        if (def->disks[i]->src->readonly) {
-                            hardDisk->vtbl->SetType(hardDisk,
-                                                    HardDiskType_Immutable);
-                            VIR_DEBUG("setting harddisk to readonly");
-                        } else if (!def->disks[i]->src->readonly) {
-                            hardDisk->vtbl->SetType(hardDisk,
-                                                    HardDiskType_Normal);
-                            VIR_DEBUG("setting harddisk type to normal");
-                        }
-                        if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) {
-                            if (STREQ(def->disks[i]->dst, "hdc")) {
-                                VIR_DEBUG("Not connecting harddisk to hdc as hdc"
-                                       " is taken by CD/DVD Drive");
-                            } else {
-                                PRInt32 channel = 0;
-                                PRInt32 device = 0;
-                                PRUnichar *hddcnameUtf16 = NULL;
-
-                                char *hddcname;
-                                ignore_value(VIR_STRDUP(hddcname, "IDE"));
-                                VBOX_UTF8_TO_UTF16(hddcname, &hddcnameUtf16);
-                                VIR_FREE(hddcname);
-
-                                if (STREQ(def->disks[i]->dst, "hda")) {
-                                    channel = 0;
-                                    device = 0;
-                                } else if (STREQ(def->disks[i]->dst, "hdb")) {
-                                    channel = 0;
-                                    device = 1;
-                                } else if (STREQ(def->disks[i]->dst, "hdd")) {
-                                    channel = 1;
-                                    device = 1;
-                                }
-
-                                rc = machine->vtbl->AttachHardDisk(machine,
-                                                                   hdduuid.value,
-                                                                   hddcnameUtf16,
-                                                                   channel,
-                                                                   device);
-                                VBOX_UTF16_FREE(hddcnameUtf16);
-
-                                if (NS_FAILED(rc)) {
-                                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                                   _("could not attach the file as "
-                                                     "harddisk: %s, rc=%08x"),
-                                                   src, (unsigned)rc);
-                                } else {
-                                    DEBUGIID("Attached HDD with UUID", hdduuid.value);
-                                }
-                            }
-                        }
-                    }
-                    VBOX_MEDIUM_RELEASE(hardDisk);
-                }
-                vboxIIDUnalloc(&hdduuid);
-                VBOX_UTF16_FREE(hddEmpty);
-                VBOX_UTF16_FREE(hddfileUtf16);
-            } else if (type == VIR_STORAGE_TYPE_BLOCK) {
-            }
-        } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
-            if (type == VIR_STORAGE_TYPE_FILE && src) {
-                IFloppyDrive *floppyDrive;
-                machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
-                if (floppyDrive) {
-                    rc = floppyDrive->vtbl->SetEnabled(floppyDrive, 1);
-                    if (NS_SUCCEEDED(rc)) {
-                        IFloppyImage *floppyImage = NULL;
-                        PRUnichar *fdfileUtf16 = NULL;
-                        vboxIID fduuid = VBOX_IID_INITIALIZER;
-                        vboxIID fdemptyuuid = VBOX_IID_INITIALIZER;
-
-                        VBOX_UTF8_TO_UTF16(src, &fdfileUtf16);
-                        rc = data->vboxObj->vtbl->FindFloppyImage(data->vboxObj,
-                                                                  fdfileUtf16,
-                                                                  &floppyImage);
-
-                        if (!floppyImage) {
-                            data->vboxObj->vtbl->OpenFloppyImage(data->vboxObj,
-                                                                 fdfileUtf16,
-                                                                 fdemptyuuid.value,
-                                                                 &floppyImage);
-                        }
-
-                        if (floppyImage) {
-                            rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage,
-                                                                  &fduuid.value);
-                            if (NS_FAILED(rc)) {
-                                virReportError(VIR_ERR_INTERNAL_ERROR,
-                                               _("can't get the uuid of the file to "
-                                                 "be attached to floppy drive: %s, rc=%08x"),
-                                               src, (unsigned)rc);
-                            } else {
-                                rc = floppyDrive->vtbl->MountImage(floppyDrive,
-                                                                   fduuid.value);
-                                if (NS_FAILED(rc)) {
-                                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                                   _("could not attach the file to "
-                                                     "floppy drive: %s, rc=%08x"),
-                                                   src, (unsigned)rc);
-                                } else {
-                                    DEBUGIID("floppyImage UUID", fduuid.value);
-                                }
-                            }
-                            VBOX_MEDIUM_RELEASE(floppyImage);
-                        }
-                        vboxIIDUnalloc(&fduuid);
-                        VBOX_UTF16_FREE(fdfileUtf16);
-                    }
-                    VBOX_RELEASE(floppyDrive);
-                }
-            } else if (type == VIR_STORAGE_TYPE_BLOCK) {
-            }
-        }
-    }
-}
-
-#elif VBOX_API_VERSION < 4000000
-
-static void
-_vboxAttachDrivesOld(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
-{
-    size_t i;
-    nsresult rc = 0;
-
-    PRUint32 maxPortPerInst[StorageBus_Floppy + 1] = {};
-    PRUint32 maxSlotPerPort[StorageBus_Floppy + 1] = {};
-    PRUnichar *storageCtlName = NULL;
-    bool error = false;
-
-    /* get the max port/slots/etc for the given storage bus */
-    error = !vboxGetMaxPortSlotValues(data->vboxObj, maxPortPerInst,
-                                      maxSlotPerPort);
-
-    /* add a storage controller for the mediums to be attached */
-    /* this needs to change when multiple controller are supported for
-     * ver > 3.1 */
-    {
-        IStorageController *storageCtl = NULL;
-        PRUnichar *sName = NULL;
-
-        VBOX_UTF8_TO_UTF16("IDE Controller", &sName);
-        machine->vtbl->AddStorageController(machine,
-                                            sName,
-                                            StorageBus_IDE,
-                                            &storageCtl);
-        VBOX_UTF16_FREE(sName);
-        VBOX_RELEASE(storageCtl);
-
-        VBOX_UTF8_TO_UTF16("SATA Controller", &sName);
-        machine->vtbl->AddStorageController(machine,
-                                            sName,
-                                            StorageBus_SATA,
-                                            &storageCtl);
-        VBOX_UTF16_FREE(sName);
-        VBOX_RELEASE(storageCtl);
-
-        VBOX_UTF8_TO_UTF16("SCSI Controller", &sName);
-        machine->vtbl->AddStorageController(machine,
-                                            sName,
-                                            StorageBus_SCSI,
-                                            &storageCtl);
-        VBOX_UTF16_FREE(sName);
-        VBOX_RELEASE(storageCtl);
-
-        VBOX_UTF8_TO_UTF16("Floppy Controller", &sName);
-        machine->vtbl->AddStorageController(machine,
-                                            sName,
-                                            StorageBus_Floppy,
-                                            &storageCtl);
-        VBOX_UTF16_FREE(sName);
-        VBOX_RELEASE(storageCtl);
-    }
-
-    for (i = 0; i < def->ndisks && !error; i++) {
-        const char *src = virDomainDiskGetSource(def->disks[i]);
-        int type = virDomainDiskGetType(def->disks[i]);
-        int format = virDomainDiskGetFormat(def->disks[i]);
-
-        VIR_DEBUG("disk(%zu) type:       %d", i, type);
-        VIR_DEBUG("disk(%zu) device:     %d", i, def->disks[i]->device);
-        VIR_DEBUG("disk(%zu) bus:        %d", i, def->disks[i]->bus);
-        VIR_DEBUG("disk(%zu) src:        %s", i, src);
-        VIR_DEBUG("disk(%zu) dst:        %s", i, def->disks[i]->dst);
-        VIR_DEBUG("disk(%zu) driverName: %s", i,
-                  virDomainDiskGetDriver(def->disks[i]));
-        VIR_DEBUG("disk(%zu) driverType: %s", i,
-                  virStorageFileFormatTypeToString(format));
-        VIR_DEBUG("disk(%zu) cachemode:  %d", i, def->disks[i]->cachemode);
-        VIR_DEBUG("disk(%zu) readonly:   %s", i, (def->disks[i]->src->readonly
-                                             ? "True" : "False"));
-        VIR_DEBUG("disk(%zu) shared:     %s", i, (def->disks[i]->src->shared
-                                             ? "True" : "False"));
-
-        if (type == VIR_STORAGE_TYPE_FILE && src) {
-            IMedium *medium = NULL;
-            PRUnichar *mediumUUID = NULL;
-            PRUnichar *mediumFileUtf16 = NULL;
-            PRUint32 storageBus = StorageBus_Null;
-            PRUint32 deviceType = DeviceType_Null;
-            PRInt32 deviceInst = 0;
-            PRInt32 devicePort = 0;
-            PRInt32 deviceSlot = 0;
-
-            VBOX_UTF8_TO_UTF16(src, &mediumFileUtf16);
-
-            if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-                deviceType = DeviceType_HardDisk;
-                data->vboxObj->vtbl->FindHardDisk(data->vboxObj,
-                                                  mediumFileUtf16, &medium);
-            } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
-                deviceType = DeviceType_DVD;
-                data->vboxObj->vtbl->FindDVDImage(data->vboxObj,
-                                                  mediumFileUtf16, &medium);
-            } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
-                deviceType = DeviceType_Floppy;
-                data->vboxObj->vtbl->FindFloppyImage(data->vboxObj,
-                                                     mediumFileUtf16, &medium);
-            } else {
-                VBOX_UTF16_FREE(mediumFileUtf16);
-                continue;
-            }
-
-            if (!medium) {
-                PRUnichar *mediumEmpty = NULL;
-
-                VBOX_UTF8_TO_UTF16("", &mediumEmpty);
-
-                if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-                    rc = data->vboxObj->vtbl->OpenHardDisk(data->vboxObj,
-                                                           mediumFileUtf16,
-                                                           AccessMode_ReadWrite,
-                                                           false,
-                                                           mediumEmpty,
-                                                           false,
-                                                           mediumEmpty,
-                                                           &medium);
-                } else if (def->disks[i]->device ==
-                           VIR_DOMAIN_DISK_DEVICE_CDROM) {
-                    rc = data->vboxObj->vtbl->OpenDVDImage(data->vboxObj,
-                                                           mediumFileUtf16,
-                                                           mediumEmpty,
-                                                           &medium);
-                } else if (def->disks[i]->device ==
-                           VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
-                    rc = data->vboxObj->vtbl->OpenFloppyImage(data->vboxObj,
-                                                              mediumFileUtf16,
-                                                              mediumEmpty,
-                                                              &medium);
-                } else {
-                    rc = 0;
-                }
-                VBOX_UTF16_FREE(mediumEmpty);
-            }
-
-            if (!medium) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Failed to attach the following disk/dvd/floppy "
-                                 "to the machine: %s, rc=%08x"),
-                               src, (unsigned)rc);
-                VBOX_UTF16_FREE(mediumFileUtf16);
-                continue;
-            }
-
-            rc = medium->vtbl->GetId(medium, &mediumUUID);
-            if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("can't get the uuid of the file to be attached "
-                                 "as harddisk/dvd/floppy: %s, rc=%08x"),
-                               src, (unsigned)rc);
-                VBOX_RELEASE(medium);
-                VBOX_UTF16_FREE(mediumFileUtf16);
-                continue;
-            }
-
-            if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-                if (def->disks[i]->src->readonly) {
-                    medium->vtbl->SetType(medium, MediumType_Immutable);
-                    VIR_DEBUG("setting harddisk to immutable");
-                } else if (!def->disks[i]->src->readonly) {
-                    medium->vtbl->SetType(medium, MediumType_Normal);
-                    VIR_DEBUG("setting harddisk type to normal");
-                }
-            }
-
-            if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) {
-                VBOX_UTF8_TO_UTF16("IDE Controller", &storageCtlName);
-                storageBus = StorageBus_IDE;
-            } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_SATA) {
-                VBOX_UTF8_TO_UTF16("SATA Controller", &storageCtlName);
-                storageBus = StorageBus_SATA;
-            } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
-                VBOX_UTF8_TO_UTF16("SCSI Controller", &storageCtlName);
-                storageBus = StorageBus_SCSI;
-            } else if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_FDC) {
-                VBOX_UTF8_TO_UTF16("Floppy Controller", &storageCtlName);
-                storageBus = StorageBus_Floppy;
-            }
-
-            /* get the device details i.e instance, port and slot */
-            if (!vboxGetDeviceDetails(def->disks[i]->dst,
-                                      maxPortPerInst,
-                                      maxSlotPerPort,
-                                      storageBus,
-                                      &deviceInst,
-                                      &devicePort,
-                                      &deviceSlot)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("can't get the port/slot number of "
-                                 "harddisk/dvd/floppy to be attached: "
-                                 "%s, rc=%08x"),
-                               src, (unsigned)rc);
-                VBOX_RELEASE(medium);
-                VBOX_UTF16_FREE(mediumUUID);
-                VBOX_UTF16_FREE(mediumFileUtf16);
-                continue;
-            }
-
-            /* attach the harddisk/dvd/Floppy to the storage controller */
-            rc = machine->vtbl->AttachDevice(machine,
-                                             storageCtlName,
-                                             devicePort,
-                                             deviceSlot,
-                                             deviceType,
-                                             mediumUUID);
-
-            if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("could not attach the file as "
-                                 "harddisk/dvd/floppy: %s, rc=%08x"),
-                               src, (unsigned)rc);
-            } else {
-                DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID);
-            }
-
-            VBOX_RELEASE(medium);
-            VBOX_UTF16_FREE(mediumUUID);
-            VBOX_UTF16_FREE(mediumFileUtf16);
-            VBOX_UTF16_FREE(storageCtlName);
-        }
-    }
-}
-
-#else /* VBOX_API_VERSION >= 4000000 */
-
-static void
-_vboxAttachDrivesOld(virDomainDefPtr def ATTRIBUTE_UNUSED,
-                     vboxDriverPtr data ATTRIBUTE_UNUSED,
-                     IMachine *machine ATTRIBUTE_UNUSED)
-{
-    vboxUnsupported();
-}
-
-#endif /* VBOX_API_VERSION >= 4000000 */
-
 static int
 _vboxDomainSnapshotRestore(virDomainPtr dom,
                           IMachine *machine,
@@ -3808,7 +3324,6 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
     pVBoxAPI->detachDevices = _detachDevices;
     pVBoxAPI->unregisterMachine = _unregisterMachine;
     pVBoxAPI->deleteConfig = _deleteConfig;
-    pVBoxAPI->vboxAttachDrivesOld = _vboxAttachDrivesOld;
     pVBoxAPI->vboxConvertState = _vboxConvertState;
     pVBoxAPI->dumpIDEHDDsOld = _dumpIDEHDDsOld;
     pVBoxAPI->dumpDVD = _dumpDVD;
@@ -3860,12 +3375,10 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
     /* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */
     pVBoxAPI->getMachineForSession = 1;
     pVBoxAPI->detachDevicesExplicitly = 0;
-    pVBoxAPI->vboxAttachDrivesUseOld = 0;
     pVBoxAPI->supportScreenshot = 1;
 #else /* VBOX_API_VERSION < 4000000 */
     pVBoxAPI->getMachineForSession = 0;
     pVBoxAPI->detachDevicesExplicitly = 1;
-    pVBoxAPI->vboxAttachDrivesUseOld = 1;
     pVBoxAPI->supportScreenshot = 0;
 #endif /* VBOX_API_VERSION < 4000000 */
 
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 3b2b7a8..6c4cf3d 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -605,7 +605,6 @@ typedef struct {
     bool detachDevicesExplicitly;
     bool chipsetType;
     bool accelerate2DVideo;
-    bool vboxAttachDrivesUseOld;
     bool oldMediumInterface;
     bool vboxSnapshotRedefine;
     bool supportScreenshot;
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux