Exemple #1
0
int
vmwareRegister(void)
{
    if (virRegisterDriver(&vmwareDriver) < 0)
        return -1;
    return 0;
}
Exemple #2
0
int vboxRegister(void) {
    virDriverPtr        driver;
    virNetworkDriverPtr networkDriver;
    virStorageDriverPtr storageDriver;
    uint32_t            uVersion;

    /*
     * If the glue layer does not initialize, we register a driver
     * with a dummy open method, so we can report nicer errors
     * if the user requests a vbox:// URI which we know will
     * never work
     */
    driver        = &vboxDriverDummy;
    networkDriver = &vbox22NetworkDriver;
    storageDriver = &vbox22StorageDriver;

    /* Init the glue and get the API version. */
    if (VBoxCGlueInit() == 0) {
        uVersion = g_pVBoxFuncs->pfnGetVersion();
        DEBUG("VBoxCGlueInit found API version: %d.%d.%d (%u)",
              uVersion / 1000000,
              uVersion % 1000000 / 1000,
              uVersion % 1000,
              uVersion);

        /* Select driver implementation based on version.
         * Note that the VirtualBox development usually happens at build
         * number 51, thus the version ranges in the if statements below.
         */
        if (uVersion >= 2001052 && uVersion < 2002051) {
            DEBUG0("VirtualBox API version: 2.2");
            driver        = &vbox22Driver;
            networkDriver = &vbox22NetworkDriver;
            storageDriver = &vbox22StorageDriver;
        } else if (uVersion >= 2002051 && uVersion < 3000051) {
            DEBUG0("VirtualBox API version: 3.0");
            driver        = &vbox30Driver;
            networkDriver = &vbox30NetworkDriver;
            storageDriver = &vbox30StorageDriver;
        } else if (uVersion >= 3000051 && uVersion < 3001051) {
            DEBUG0("VirtualBox API version: 3.1");
            driver        = &vbox31Driver;
            networkDriver = &vbox31NetworkDriver;
            storageDriver = &vbox31StorageDriver;
        } else if (uVersion >= 3001051 && uVersion < 3002051) {
            DEBUG0("VirtualBox API version: 3.2");
            driver        = &vbox32Driver;
            networkDriver = &vbox32NetworkDriver;
            storageDriver = &vbox32StorageDriver;
        } else {
            DEBUG0("Unsupport VirtualBox API version");
        }

    } else {
        DEBUG0("VBoxCGlueInit failed, using dummy driver");
    }

    if (virRegisterDriver(driver) < 0)
        return -1;
    if (virRegisterNetworkDriver(networkDriver) < 0)
        return -1;
    if (virRegisterStorageDriver(storageDriver) < 0)
        return -1;

    return 0;
}
Exemple #3
0
int openvzRegister(void) {
    virRegisterDriver(&openvzDriver);
    return 0;
}