您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ virResetError函数代码示例

51自学网 2021-06-03 09:42:34
  C++
这篇教程C++ virResetError函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中virResetError函数的典型用法代码示例。如果您正苦于以下问题:C++ virResetError函数的具体用法?C++ virResetError怎么用?C++ virResetError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了virResetError函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qemuDomainReAttachHostdevDevices

void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,                                      const char *name,                                      virDomainHostdevDefPtr *hostdevs,                                      int nhostdevs){    pciDeviceList *pcidevs;    int i;    if (!(pcidevs = qemuGetActivePciHostDeviceList(driver,                                                   hostdevs,                                                   nhostdevs))) {        virErrorPtr err = virGetLastError();        VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),                  err ? err->message : _("unknown error"));        virResetError(err);        return;    }    /* Again 3 loops; mark all devices as inactive before reset     * them and reset all the devices before re-attach */    for (i = 0; i < pciDeviceListCount(pcidevs); i++) {        pciDevice *dev = pciDeviceListGet(pcidevs, i);        pciDevice *activeDev = NULL;        /* Never delete the dev from list driver->activePciHostdevs         * if it's used by other domain.         */        activeDev = pciDeviceListFind(driver->activePciHostdevs, dev);        if (activeDev &&            STRNEQ_NULLABLE(name, pciDeviceGetUsedBy(activeDev))) {            pciDeviceListSteal(pcidevs, dev);            continue;        }        /* pciDeviceListFree() will take care of freeing the dev. */        pciDeviceListSteal(driver->activePciHostdevs, dev);    }    for (i = 0; i < pciDeviceListCount(pcidevs); i++) {        pciDevice *dev = pciDeviceListGet(pcidevs, i);        if (pciResetDevice(dev, driver->activePciHostdevs,                           driver->inactivePciHostdevs) < 0) {            virErrorPtr err = virGetLastError();            VIR_ERROR(_("Failed to reset PCI device: %s"),                      err ? err->message : _("unknown error"));            virResetError(err);        }    }    for (i = 0; i < pciDeviceListCount(pcidevs); i++) {        pciDevice *dev = pciDeviceListGet(pcidevs, i);        qemuReattachPciDevice(dev, driver);    }    pciDeviceListFree(pcidevs);}
开发者ID:ansisatteka,项目名称:libvirt-ovs,代码行数:56,


示例2: virReleaseConnect

/** * virReleaseConnect: * @conn: the hypervisor connection to release * * Unconditionally release all memory associated with a connection. * The conn.lock mutex must be held prior to calling this, and will * be released prior to this returning. The connection obj must not * be used once this method returns. */static voidvirReleaseConnect(virConnectPtr conn) {    VIR_DEBUG("release connection %p", conn);    /* make sure to release the connection lock before we call the     * close callbacks, otherwise we will deadlock if an error     * is raised by any of the callbacks */    virMutexUnlock(&conn->lock);    if (conn->networkDriver)        conn->networkDriver->close(conn);    if (conn->interfaceDriver)        conn->interfaceDriver->close(conn);    if (conn->storageDriver)        conn->storageDriver->close(conn);    if (conn->deviceMonitor)        conn->deviceMonitor->close(conn);    if (conn->secretDriver)        conn->secretDriver->close(conn);    if (conn->nwfilterDriver)        conn->nwfilterDriver->close(conn);    if (conn->driver)        conn->driver->close(conn);    virMutexLock(&conn->lock);    virResetError(&conn->err);    virURIFree(conn->uri);    virMutexUnlock(&conn->lock);    virMutexDestroy(&conn->lock);    VIR_FREE(conn);}
开发者ID:intgr,项目名称:libvirt,代码行数:43,


示例3: qemuReattachPciDevice

void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver){    int retries = 100;    /* If the device is not managed and was attached to guest     * successfully, it must have been inactive.     */    if (!pciDeviceGetManaged(dev)) {        if (pciDeviceListAdd(driver->inactivePciHostdevs, dev) < 0)            pciFreeDevice(dev);        return;    }    while (pciWaitForDeviceCleanup(dev, "kvm_assigned_device")           && retries) {        usleep(100*1000);        retries--;    }    if (pciReAttachDevice(dev, driver->activePciHostdevs,                          driver->inactivePciHostdevs) < 0) {        virErrorPtr err = virGetLastError();        VIR_ERROR(_("Failed to re-attach PCI device: %s"),                  err ? err->message : _("unknown error"));        virResetError(err);    }    pciFreeDevice(dev);}
开发者ID:mithleshvrts,项目名称:libvirt-0.10.2,代码行数:28,


示例4: showError

static voidshowError(virConnectPtr conn){    int ret;    virErrorPtr err;    err = malloc(sizeof(*err));    if (!err) {        printf("Could not allocate memory for error data/n");        goto out;    }    ret = virConnCopyLastError(conn, err);    switch (ret) {    case 0:        printf("No error found/n");        break;    case -1:        printf("Parameter error when attempting to get last error/n");        break;    default:        printf("libvirt reported: /"%s/"/n", err->message);        break;    }    virResetError(err);    free(err);out:    return;}
开发者ID:avdv,项目名称:libvirt,代码行数:34,


示例5: virCopyError

/* * Internal helper to perform a deep copy of an error */static intvirCopyError(virErrorPtr from,             virErrorPtr to){    int ret = 0;    if (!to)        return 0;    virResetError(to);    if (!from)        return 0;    to->code = from->code;    to->domain = from->domain;    to->level = from->level;    if (VIR_STRDUP_QUIET(to->message, from->message) < 0)        ret = -1;    if (VIR_STRDUP_QUIET(to->str1, from->str1) < 0)        ret = -1;    if (VIR_STRDUP_QUIET(to->str2, from->str2) < 0)        ret = -1;    if (VIR_STRDUP_QUIET(to->str3, from->str3) < 0)        ret = -1;    to->int1 = from->int1;    to->int2 = from->int2;    /*     * Deliberately not setting 'conn', 'dom', 'net' references     */    return ret;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:31,


示例6: virResetLastError

/** * virResetLastError: * * Reset the last error caught at the library level. * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently, only resetting * their own error object. */voidvirResetLastError(void){    virErrorPtr err = virLastErrorObject();    if (err)        virResetError(err);}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:16,


示例7: virCopyError

/* * Internal helper to perform a deep copy of the an error */static intvirCopyError(virErrorPtr from,             virErrorPtr to){    int ret = 0;    if (!to)        return 0;    virResetError(to);    if (!from)        return 0;    to->code = from->code;    to->domain = from->domain;    to->level = from->level;    if (from->message && !(to->message = strdup(from->message)))        ret = -1;    if (from->str1 && !(to->str1 = strdup(from->str1)))        ret = -1;    if (from->str2 && !(to->str2 = strdup(from->str2)))        ret = -1;    if (from->str3 && !(to->str3 = strdup(from->str3)))        ret = -1;    to->int1 = from->int1;    to->int2 = from->int2;    /*     * Deliberately not setting 'conn', 'dom', 'net' references     */    return ret;}
开发者ID:ansisatteka,项目名称:libvirt-ovs,代码行数:31,


示例8: virNetClientStreamDispose

void virNetClientStreamDispose(void *obj){    virNetClientStreamPtr st = obj;    virResetError(&st->err);    VIR_FREE(st->incoming);    virObjectUnref(st->prog);}
开发者ID:6WIND,项目名称:libvirt,代码行数:8,


示例9: virConnResetLastError

/** * virConnResetLastError: * @conn: pointer to the hypervisor connection * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * Reset the last error caught on that connection */voidvirConnResetLastError(virConnectPtr conn){    if (conn == NULL)        return;    virObjectLock(conn);    virResetError(&conn->err);    virObjectUnlock(conn);}
开发者ID:Archer-sys,项目名称:libvirt,代码行数:18,


示例10: virConnGetLastError

void StoragePoolControlThread::sendConnErrors(){    virtErrors = virConnGetLastError(currWorkConnect);    if ( virtErrors!=NULL && virtErrors->code>0 ) {        emit errorMsg( QString("VirtError(%1) : %2").arg(virtErrors->code)                       .arg(QString().fromUtf8(virtErrors->message)) );        virResetError(virtErrors);    } else sendGlobalErrors();}
开发者ID:benklop,项目名称:qt-virt-manager,代码行数:9,


示例11: virLastErrFreeData

/* * Internal helper that is called when a thread exits, to * release the error object stored in the thread local */static voidvirLastErrFreeData(void *data){    virErrorPtr err = data;    if (!err)        return;    virResetError(err);    VIR_FREE(err);}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:13,


示例12: virConnResetLastError

/** * virConnResetLastError: * @conn: pointer to the hypervisor connection * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * Reset the last error caught on that connection */voidvirConnResetLastError(virConnectPtr conn){    if (conn == NULL)        return;    virMutexLock(&conn->lock);    virResetError(&conn->err);    virMutexUnlock(&conn->lock);}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:18,


示例13: virNetClientStreamSetError

int virNetClientStreamSetError(virNetClientStreamPtr st,                               virNetMessagePtr msg){    virNetMessageError err;    int ret = -1;    virObjectLock(st);    if (st->err.code != VIR_ERR_OK)        VIR_DEBUG("Overwriting existing stream error %s", NULLSTR(st->err.message));    virResetError(&st->err);    memset(&err, 0, sizeof(err));    if (virNetMessageDecodePayload(msg, (xdrproc_t)xdr_virNetMessageError, &err) < 0)        goto cleanup;    if (err.domain == VIR_FROM_REMOTE &&        err.code == VIR_ERR_RPC &&        err.level == VIR_ERR_ERROR &&        err.message &&        STRPREFIX(*err.message, "unknown procedure")) {        st->err.code = VIR_ERR_NO_SUPPORT;    } else {        st->err.code = err.code;    }    if (err.message) {        st->err.message = *err.message;        *err.message = NULL;    }    st->err.domain = err.domain;    st->err.level = err.level;    if (err.str1) {        st->err.str1 = *err.str1;        *err.str1 = NULL;    }    if (err.str2) {        st->err.str2 = *err.str2;        *err.str2 = NULL;    }    if (err.str3) {        st->err.str3 = *err.str3;        *err.str3 = NULL;    }    st->err.int1 = err.int1;    st->err.int2 = err.int2;    st->incomingEOF = true;    virNetClientStreamEventTimerUpdate(st);    ret = 0; cleanup:    xdr_free((xdrproc_t)xdr_virNetMessageError, (void*)&err);    virObjectUnlock(st);    return ret;}
开发者ID:6WIND,项目名称:libvirt,代码行数:57,


示例14: qemuAgentDispose

static void qemuAgentDispose(void *obj){    qemuAgentPtr mon = obj;    VIR_DEBUG("mon=%p", mon);    if (mon->cb && mon->cb->destroy)        (mon->cb->destroy)(mon, mon->vm);    virCondDestroy(&mon->notify);    VIR_FREE(mon->buffer);    virResetError(&mon->lastError);}
开发者ID:carriercomm,项目名称:libvirt-1,代码行数:10,


示例15: virSystemdTerminateMachine

int virSystemdTerminateMachine(const char *name){    int ret;    DBusConnection *conn;    virError error;    if (!name)        return 0;    memset(&error, 0, sizeof(error));    if ((ret = virSystemdHasMachined()) < 0)        goto cleanup;    ret = -1;    if (!(conn = virDBusGetSystemBus()))        goto cleanup;    /*     * The systemd DBus API we're invoking has the     * following signature     *     * TerminateMachine(in  s name);     *     * @name a host unique name for the machine. shows up     * in 'ps' listing & similar     */    VIR_DEBUG("Attempting to terminate machine via systemd");    if (virDBusCallMethod(conn,                          NULL,                          &error,                          "org.freedesktop.machine1",                          "/org/freedesktop/machine1",                          "org.freedesktop.machine1.Manager",                          "TerminateMachine",                          "s",                          name) < 0)        goto cleanup;    if (error.level == VIR_ERR_ERROR &&        STRNEQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine",                        error.str1)) {        virReportErrorObject(&error);        goto cleanup;    }    ret = 0; cleanup:    virResetError(&error);    return ret;}
开发者ID:libvirt,项目名称:libvirt,代码行数:55,


示例16: virConnGetLastError

void VM_Viewer::sendConnErrors(){    virtErrors = (NULL!=ptr_ConnPtr && *ptr_ConnPtr)?                virConnGetLastError(*ptr_ConnPtr):NULL;    if ( virtErrors!=NULL && virtErrors->code>0 ) {        QString msg = QString("VirtError(%1) : %2").arg(virtErrors->code)                .arg(QString().fromUtf8(virtErrors->message));        emit errorMsg( msg );        virResetError(virtErrors);    } else sendGlobalErrors();}
开发者ID:Dravigon,项目名称:qt-virt-manager,代码行数:11,


示例17: virConsoleDispose

static voidvirConsoleDispose(void *obj){    virConsolePtr con = obj;    if (con->st)        virStreamFree(con->st);    virCondDestroy(&con->cond);    virResetError(&con->error);}
开发者ID:libvirt,项目名称:libvirt,代码行数:11,


示例18: virConnectDispose

/** * virConnectDispose: * @obj: the hypervisor connection to release * * Unconditionally release all memory associated with a connection. * The connection object must not be used once this method returns. */static voidvirConnectDispose(void *obj){    virConnectPtr conn = obj;    if (conn->driver)        conn->driver->connectClose(conn);    virResetError(&conn->err);    virURIFree(conn->uri);}
开发者ID:Antique,项目名称:libvirt,代码行数:19,


示例19: virCopyLastError

/** * virCopyLastError: * @to: target to receive the copy * * Copy the content of the last error caught at the library level * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * One will need to free the result with virResetError() * * Returns 0 if no error was found and the error code otherwise and -1 in case *         of parameter error. */intvirCopyLastError(virErrorPtr to){    virErrorPtr err = virLastErrorObject();    /* We can't guarantee caller has initialized it to zero */    memset(to, 0, sizeof(*to));    if (err)        virCopyError(err, to);    else        virResetError(to);    return to->code;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:26,


示例20: virConnGetLastError

QString _VirtThread::sendConnErrors(){    QString msg;    virtErrors = (nullptr!=ptr_ConnPtr && *ptr_ConnPtr)?                virConnGetLastError(*ptr_ConnPtr):nullptr;    if ( virtErrors!=nullptr && virtErrors->code>0 ) {        msg = QString("VirtError(%1) : %2").arg(virtErrors->code)                .arg(QString().fromUtf8(virtErrors->message));        emit errorMsg( msg, number );        virResetError(virtErrors);    } else        msg = sendGlobalErrors();    return msg;}
开发者ID:cheliequan,项目名称:qt-virt-manager,代码行数:14,


示例21: virConnCopyLastError

/** * virConnCopyLastError: * @conn: pointer to the hypervisor connection * @to: target to receive the copy * * Copy the content of the last error caught on that connection * * This method is not protected against access from multiple * threads. In a multi-threaded application, always use the * global virGetLastError() API which is backed by thread * local storage. * * If the connection object was discovered to be invalid by * an API call, then the error will be reported against the * global error object. * * Since 0.6.0, all errors reported in the per-connection object * are also duplicated in the global error object. As such an * application can always use virGetLastError(). This method * remains for backwards compatibility. * * One will need to free the result with virResetError() * * Returns 0 if no error was found and the error code otherwise and -1 in case *         of parameter error. */intvirConnCopyLastError(virConnectPtr conn, virErrorPtr to){    /* We can't guarantee caller has initialized it to zero */    memset(to, 0, sizeof(*to));    if (conn == NULL)        return -1;    virMutexLock(&conn->lock);    if (conn->err.code == VIR_ERR_OK)        virResetError(to);    else        virCopyError(&conn->err, to);    virMutexUnlock(&conn->lock);    return to->code;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:42,


示例22: virSetError

/** * virSetError: * @newerr: previously saved error object * * Set the current error from a previously saved error object * * Can be used to re-set an old error, which may have been squashed by * other functions (like cleanup routines). * * Returns 0 on success, -1 on failure.  Leaves errno unchanged. */intvirSetError(virErrorPtr newerr){    virErrorPtr err;    int saved_errno = errno;    int ret = -1;    err = virLastErrorObject();    if (!err)        goto cleanup;    virResetError(err);    ret = virCopyError(newerr, err);cleanup:    errno = saved_errno;    return ret;}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:28,


示例23: virNetClientStreamFree

void virNetClientStreamFree(virNetClientStreamPtr st){    virMutexLock(&st->lock);    st->refs--;    if (st->refs > 0) {        virMutexUnlock(&st->lock);        return;    }    virMutexUnlock(&st->lock);    virResetError(&st->err);    VIR_FREE(st->incoming);    virMutexDestroy(&st->lock);    virNetClientProgramFree(st->prog);    VIR_FREE(st);}
开发者ID:syndicut,项目名称:libvirt,代码行数:17,


示例24: virCopyLastError

/** * virCopyLastError: * @to: target to receive the copy * * Copy the content of the last error caught at the library level * * The error object is kept in thread local storage, so separate * threads can safely access this concurrently. * * One will need to free the result with virResetError() * * Returns error code or -1 in case of parameter error. */intvirCopyLastError(virErrorPtr to){    virErrorPtr err = virLastErrorObject();    if (!to)        return -1;    /* We can't guarantee caller has initialized it to zero */    memset(to, 0, sizeof(*to));    if (err) {        virCopyError(err, to);    } else {        virResetError(to);        to->code = VIR_ERR_NO_MEMORY;        to->domain = VIR_FROM_NONE;        to->level = VIR_ERR_ERROR;    }    return to->code;}
开发者ID:libvirt,项目名称:libvirt,代码行数:33,


示例25: virConnectDispose

/** * virConnectDispose: * @conn: the hypervisor connection to release * * Unconditionally release all memory associated with a connection. * The conn.lock mutex must be held prior to calling this, and will * be released prior to this returning. The connection obj must not * be used once this method returns. */static voidvirConnectDispose(void *obj){    virConnectPtr conn = obj;    if (conn->networkDriver)        conn->networkDriver->networkClose(conn);    if (conn->interfaceDriver)        conn->interfaceDriver->interfaceClose(conn);    if (conn->storageDriver)        conn->storageDriver->storageClose(conn);    if (conn->nodeDeviceDriver)        conn->nodeDeviceDriver->nodeDeviceClose(conn);    if (conn->secretDriver)        conn->secretDriver->secretClose(conn);    if (conn->nwfilterDriver)        conn->nwfilterDriver->nwfilterClose(conn);    if (conn->driver)        conn->driver->connectClose(conn);    virMutexLock(&conn->lock);    virResetError(&conn->err);    virURIFree(conn->uri);    if (conn->closeCallback) {        virObjectLock(conn->closeCallback);        conn->closeCallback->callback = NULL;        virObjectUnlock(conn->closeCallback);        virObjectUnref(conn->closeCallback);    }    virMutexUnlock(&conn->lock);    virMutexDestroy(&conn->lock);}
开发者ID:cardoe,项目名称:libvirt,代码行数:46,


示例26: virSystemdTerminateMachine

int virSystemdTerminateMachine(const char *name,                               const char *drivername,                               bool privileged){    int ret;    DBusConnection *conn;    char *machinename = NULL;    virError error;    memset(&error, 0, sizeof(error));    ret = virDBusIsServiceEnabled("org.freedesktop.machine1");    if (ret < 0)        goto cleanup;    if ((ret = virDBusIsServiceRegistered("org.freedesktop.systemd1")) < 0)        goto cleanup;    ret = -1;    if (!(conn = virDBusGetSystemBus()))        goto cleanup;    if (!(machinename = virSystemdMakeMachineName(name, drivername, privileged)))        goto cleanup;    /*     * The systemd DBus API we're invoking has the     * following signature     *     * TerminateMachine(in  s name);     *     * @name a host unique name for the machine. shows up     * in 'ps' listing & similar     */    VIR_DEBUG("Attempting to terminate machine via systemd");    if (virDBusCallMethod(conn,                          NULL,                          &error,                          "org.freedesktop.machine1",                          "/org/freedesktop/machine1",                          "org.freedesktop.machine1.Manager",                          "TerminateMachine",                          "s",                          machinename) < 0)        goto cleanup;    if (error.code == VIR_ERR_ERROR &&        !STREQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine",                        error.str1)) {        virReportErrorObject(&error);        goto cleanup;    }    ret = 0; cleanup:    virResetError(&error);    VIR_FREE(machinename);    return ret;}
开发者ID:candhare,项目名称:libvirt,代码行数:63,


示例27: virSystemdCreateMachine

//.........这里部分代码省略.........     * on the type of machine     *     * @leader: main PID of the machine, either the host emulator     * process, or the 'init' PID of the container     *     * @root_directory: the root directory of the container, if     * this is known & visible in the host filesystem, or empty string     *     * @nicindexes: list of network interface indexes for the     * host end of the VETH device pairs.     *     * @scope_properties:an array (not a dict!) of properties that are     * passed on to PID 1 when creating a scope unit for your machine.     * Will allow initial settings for the cgroup & similar.     *     * @path: a bus path returned for the machine object created, to     * allow further API calls to be made against the object.     *     */    VIR_DEBUG("Attempting to create machine via systemd");    if (virAtomicIntGet(&hasCreateWithNetwork)) {        virError error;        memset(&error, 0, sizeof(error));        if (virDBusCallMethod(conn,                              NULL,                              &error,                              "org.freedesktop.machine1",                              "/org/freedesktop/machine1",                              "org.freedesktop.machine1.Manager",                              "CreateMachineWithNetwork",                              "sayssusa&ia(sv)",                              machinename,                              16,                              uuid[0], uuid[1], uuid[2], uuid[3],                              uuid[4], uuid[5], uuid[6], uuid[7],                              uuid[8], uuid[9], uuid[10], uuid[11],                              uuid[12], uuid[13], uuid[14], uuid[15],                              creatorname,                              iscontainer ? "container" : "vm",                              (unsigned int)pidleader,                              rootdir ? rootdir : "",                              nnicindexes, nicindexes,                              3,                              "Slice", "s", slicename,                              "After", "as", 1, "libvirtd.service",                              "Before", "as", 1, "libvirt-guests.service") < 0)            goto cleanup;        if (error.level == VIR_ERR_ERROR) {            if (virDBusErrorIsUnknownMethod(&error)) {                VIR_INFO("CreateMachineWithNetwork isn't supported, switching "                         "to legacy CreateMachine method for systemd-machined");                virResetError(&error);                virAtomicIntSet(&hasCreateWithNetwork, 0);                /* Could re-structure without Using goto, but this                 * avoids another atomic read which would trigger                 * another memory barrier */                goto fallback;            }            virReportErrorObject(&error);            virResetError(&error);            goto cleanup;        }    } else {    fallback:        if (virDBusCallMethod(conn,                              NULL,                              NULL,                              "org.freedesktop.machine1",                              "/org/freedesktop/machine1",                              "org.freedesktop.machine1.Manager",                              "CreateMachine",                              "sayssusa(sv)",                              machinename,                              16,                              uuid[0], uuid[1], uuid[2], uuid[3],                              uuid[4], uuid[5], uuid[6], uuid[7],                              uuid[8], uuid[9], uuid[10], uuid[11],                              uuid[12], uuid[13], uuid[14], uuid[15],                              creatorname,                              iscontainer ? "container" : "vm",                              (unsigned int)pidleader,                              rootdir ? rootdir : "",                              3,                              "Slice", "s", slicename,                              "After", "as", 1, "libvirtd.service",                              "Before", "as", 1, "libvirt-guests.service") < 0)            goto cleanup;    }    ret = 0; cleanup:    VIR_FREE(creatorname);    VIR_FREE(machinename);    VIR_FREE(slicename);    return ret;}
开发者ID:candhare,项目名称:libvirt,代码行数:101,


示例28: qemuDomainReAttachHostdevDevices

void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,                                      const char *name,                                      virDomainHostdevDefPtr *hostdevs,                                      int nhostdevs){    pciDeviceList *pcidevs;    int i;    if (!(pcidevs = qemuGetActivePciHostDeviceList(driver,                                                   hostdevs,                                                   nhostdevs))) {        virErrorPtr err = virGetLastError();        VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),                  err ? err->message : _("unknown error"));        virResetError(err);        return;    }    /* Again 4 loops; mark all devices as inactive before reset     * them and reset all the devices before re-attach.     * Attach mac and port profile parameters to devices     */    for (i = 0; i < pciDeviceListCount(pcidevs); i++) {        pciDevice *dev = pciDeviceListGet(pcidevs, i);        pciDevice *activeDev = NULL;        /* Never delete the dev from list driver->activePciHostdevs         * if it's used by other domain.         */        activeDev = pciDeviceListFind(driver->activePciHostdevs, dev);        if (activeDev &&            STRNEQ_NULLABLE(name, pciDeviceGetUsedBy(activeDev))) {            pciDeviceListSteal(pcidevs, dev);            continue;        }        /* pciDeviceListFree() will take care of freeing the dev. */        pciDeviceListSteal(driver->activePciHostdevs, dev);    }    /*     * For SRIOV net host devices, unset mac and port profile before     * reset and reattach device     */    for (i = 0; i < nhostdevs; i++) {         virDomainHostdevDefPtr hostdev = hostdevs[i];         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)             continue;         if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)             continue;         if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&             hostdev->parent.data.net) {             qemuDomainHostdevNetConfigRestore(hostdev, driver->stateDir);         }    }    for (i = 0; i < pciDeviceListCount(pcidevs); i++) {        pciDevice *dev = pciDeviceListGet(pcidevs, i);        if (pciResetDevice(dev, driver->activePciHostdevs,                           driver->inactivePciHostdevs) < 0) {            virErrorPtr err = virGetLastError();            VIR_ERROR(_("Failed to reset PCI device: %s"),                      err ? err->message : _("unknown error"));            virResetError(err);        }    }    while (pciDeviceListCount(pcidevs) > 0) {        pciDevice *dev = pciDeviceListStealIndex(pcidevs, 0);        qemuReattachPciDevice(dev, driver);    }    pciDeviceListFree(pcidevs);}
开发者ID:mithleshvrts,项目名称:libvirt-0.10.2,代码行数:74,


示例29: qemuDomainReAttachHostdevDevices

voidqemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,                                 const char *name,                                 virDomainHostdevDefPtr *hostdevs,                                 int nhostdevs){    virPCIDeviceListPtr pcidevs;    size_t i;    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);    virObjectLock(driver->activePciHostdevs);    virObjectLock(driver->inactivePciHostdevs);    if (!(pcidevs = qemuGetActivePciHostDeviceList(driver,                                                   hostdevs,                                                   nhostdevs))) {        virErrorPtr err = virGetLastError();        VIR_ERROR(_("Failed to allocate PCI device list: %s"),                  err ? err->message : _("unknown error"));        virResetError(err);        goto cleanup;    }    /* Again 4 loops; mark all devices as inactive before reset     * them and reset all the devices before re-attach.     * Attach mac and port profile parameters to devices     */    for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {        virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);        virPCIDevicePtr activeDev = NULL;        /* delete the copy of the dev from pcidevs if it's used by         * other domain. Or delete it from activePciHostDevs if it had         * been used by this domain.         */        activeDev = virPCIDeviceListFind(driver->activePciHostdevs, dev);        if (activeDev &&            STRNEQ_NULLABLE(name, virPCIDeviceGetUsedBy(activeDev))) {            virPCIDeviceListDel(pcidevs, dev);            continue;        }        virPCIDeviceListDel(driver->activePciHostdevs, dev);    }    /* At this point, any device that had been used by the guest is in     * pcidevs, but has been removed from activePciHostdevs.     */    /*     * For SRIOV net host devices, unset mac and port profile before     * reset and reattach device     */    for (i = 0; i < nhostdevs; i++) {         virDomainHostdevDefPtr hostdev = hostdevs[i];         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)             continue;         if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)             continue;         if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&             hostdev->parent.data.net) {             qemuDomainHostdevNetConfigRestore(hostdev, cfg->stateDir);         }    }    for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {        virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);        if (virPCIDeviceReset(dev, driver->activePciHostdevs,                              driver->inactivePciHostdevs) < 0) {            virErrorPtr err = virGetLastError();            VIR_ERROR(_("Failed to reset PCI device: %s"),                      err ? err->message : _("unknown error"));            virResetError(err);        }    }    while (virPCIDeviceListCount(pcidevs) > 0) {        virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);        qemuReattachPciDevice(dev, driver);    }    virObjectUnref(pcidevs);cleanup:    virObjectUnlock(driver->activePciHostdevs);    virObjectUnlock(driver->inactivePciHostdevs);    virObjectUnref(cfg);}
开发者ID:ryu25ish,项目名称:libvirt,代码行数:88,


示例30: virFreeError

/** * virFreeError: * @err: error to free * * Resets and frees the given error. */voidvirFreeError(virErrorPtr err){    virResetError(err);    VIR_FREE(err);}
开发者ID:ISI-apex,项目名称:libvirt-ARM,代码行数:12,



注:本文中的virResetError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ virResetLastError函数代码示例
C++ virReportUnsupportedError函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。