const char *argv[] = {
"ip", "link", "add", NULL, "type", "veth", "peer", "name", NULL, NULL
};
- int cmdResult = 0;
int vethDev = 0;
bool veth1_alloc = false;
argv[8] = *veth2;
VIR_DEBUG("veth1: %s veth2: %s", *veth1, *veth2);
- rc = virRun(argv, &cmdResult);
-
- if (rc != 0 ||
- (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
- vethError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to create veth device pair '%s', '%s': %d"),
- *veth1, *veth2, WEXITSTATUS(cmdResult));
+ if (virRun(argv, NULL) < 0) {
if (veth1_alloc)
VIR_FREE(*veth1);
VIR_FREE(*veth2);
const char *argv[] = {
"ip", "link", "set", iface, "netns", NULL, NULL
};
- int cmdResult = 0;
if (virAsprintf(&pid, "%d", pidInNs) == -1) {
virReportOOMError();
}
argv[5] = pid;
- rc = virRun(argv, &cmdResult);
- if (rc != 0 ||
- (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
- vethError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to move '%s' into NS(pid=%d) (%d)"),
- iface, pidInNs, WEXITSTATUS(cmdResult));
- rc = -1;
- }
+ rc = virRun(argv, NULL);
VIR_FREE(pid);
return rc;
*/
int setMacAddr(const char* iface, const char* macaddr)
{
- int rc;
const char *argv[] = {
"ip", "link", "set", iface, "address", macaddr, NULL
};
- int cmdResult = 0;
- rc = virRun(argv, &cmdResult);
- if (rc != 0 ||
- (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
- vethError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set '%s' to '%s' (%d)"),
- macaddr, iface, WEXITSTATUS(cmdResult));
- rc = -1;
- }
-
- return rc;
+ return virRun(argv, NULL);
}
/**
*/
int setInterfaceName(const char* iface, const char* new)
{
- int rc;
const char *argv[] = {
"ip", "link", "set", iface, "name", new, NULL
};
- int cmdResult = 0;
- rc = virRun(argv, &cmdResult);
- if (rc != 0 ||
- (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
- vethError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set '%s' to '%s' (%d)"),
- new, iface, WEXITSTATUS(cmdResult));
- rc = -1;
- }
-
- return rc;
+ return virRun(argv, NULL);
}
}
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
}
if (vm->state != VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Suspend operation failed"));
goto cleanup;
}
vm->state = VIR_DOMAIN_PAUSED;
if (vm->state == VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Resume operation failed"));
goto cleanup;
}
vm->state = VIR_DOMAIN_RUNNING;
if (prog[0] != NULL) {
ADD_ARG_LIT("--save");
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
rc = -1;
goto exit;
}
openvzSetProgramSentinal(progstart, vm->def->name);
if (virRun(progstart, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
ret = 0;
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
return -1;
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
goto cleanup;
}
qemuimgarg[4] = vm->def->disks[i]->src;
if (virRun(qemuimgarg, NULL) < 0) {
- virReportSystemError(errno,
- _("Failed to run '%s' to create snapshot '%s' from disk '%s'"),
- qemuimgarg[0], snap->def->name,
- vm->def->disks[i]->src);
goto cleanup;
}
}
}
if (!filecreated) {
if (virRun(cmdargv, NULL) < 0) {
- virReportSystemError(errno,
- _("Cannot run %s to create %s"),
- cmdargv[0], vol->target.path);
return -1;
}
if (stat(vol->target.path, &st) < 0) {
pvargv[1] = pool->def->source.devices[i].path;
if (virRun(pvargv, NULL) < 0) {
error = -1;
- virReportSystemError(errno,
- _("cannot remove PV device '%s'"),
- pool->def->source.devices[i].path);
break;
}
}
vmwareSetSentinal(cmd, ((vmwareDomainPtr) vm->privateData)->vmxPath);
if (virRun(cmd, NULL) < 0) {
- vmwareError(VIR_ERR_INTERNAL_ERROR, _("Could not exec %s"), VMRUN);
return -1;
}
vmwareSetSentinal(cmd, NULL);
if (virRun(cmd, NULL) < 0) {
- vmwareError(VIR_ERR_INTERNAL_ERROR, _("Could not exec %s"), VMRUN);
return -1;
}