mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
diagnostic fixes on OpenVZ failures
* src/openvz_conf.c src/openvz_conf.h src/openvz_driver.c: applied patch from Evgeniy Sokolov fixing error diagnostic when exec'ing OpenVZ commands. Daniel
This commit is contained in:
parent
c207f75890
commit
db9bcc9bd4
@ -1,3 +1,9 @@
|
|||||||
|
Wed Jul 9 13:53:25 CEST 2008 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/openvz_conf.c src/openvz_conf.h src/openvz_driver.c: applied
|
||||||
|
patch from Evgeniy Sokolov fixing error diagnostic when exec'ing
|
||||||
|
OpenVZ commands.
|
||||||
|
|
||||||
Wed Jul 9 11:25:44 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
Wed Jul 9 11:25:44 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* tests/testutils.c: Ensure VIR_TEST_DEBUG is used even when
|
* tests/testutils.c: Ensure VIR_TEST_DEBUG is used even when
|
||||||
|
@ -57,21 +57,29 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
static char *openvzLocateConfDir(void);
|
static char *openvzLocateConfDir(void);
|
||||||
static void error (virConnectPtr conn, virErrorNumber code, const char *info);
|
|
||||||
static struct openvz_vm_def *openvzParseXML(virConnectPtr conn, xmlDocPtr xml);
|
static struct openvz_vm_def *openvzParseXML(virConnectPtr conn, xmlDocPtr xml);
|
||||||
static int openvzGetVPSUUID(int vpsid, char *uuidstr);
|
static int openvzGetVPSUUID(int vpsid, char *uuidstr);
|
||||||
static int openvzSetUUID(int vpsid);
|
static int openvzSetUUID(int vpsid);
|
||||||
|
|
||||||
/* For errors internal to this library. */
|
void
|
||||||
static void
|
error (virConnectPtr conn, virErrorNumber code, const char *fmt, ...)
|
||||||
error (virConnectPtr conn, virErrorNumber code, const char *info)
|
|
||||||
{
|
{
|
||||||
|
va_list args;
|
||||||
|
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||||
const char *errmsg;
|
const char *errmsg;
|
||||||
|
|
||||||
errmsg = __virErrorMsg (code, info);
|
if (fmt) {
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(errorMessage, OPENVZ_MAX_ERROR_LEN-1, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
} else {
|
||||||
|
errorMessage[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
errmsg = __virErrorMsg(code, (errorMessage[0] ? errorMessage : NULL));
|
||||||
__virRaiseError (conn, NULL, NULL, VIR_FROM_OPENVZ,
|
__virRaiseError (conn, NULL, NULL, VIR_FROM_OPENVZ,
|
||||||
code, VIR_ERR_ERROR, errmsg, info, NULL, 0, 0,
|
code, VIR_ERR_ERROR, errmsg, errorMessage, NULL, 0, 0,
|
||||||
errmsg, info);
|
errmsg, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct openvz_vm
|
struct openvz_vm
|
||||||
|
@ -110,6 +110,7 @@ openvzIsActiveVM(struct openvz_vm *vm)
|
|||||||
return vm->vpsid != -1;
|
return vm->vpsid != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void error (virConnectPtr conn, virErrorNumber code, const char *fmt, ...);
|
||||||
int openvz_readline(int fd, char *ptr, int maxlen);
|
int openvz_readline(int fd, char *ptr, int maxlen);
|
||||||
struct openvz_vm *openvzFindVMByID(const struct openvz_driver *driver, int id);
|
struct openvz_vm *openvzFindVMByID(const struct openvz_driver *driver, int id);
|
||||||
struct openvz_vm *openvzFindVMByUUID(const struct openvz_driver *driver,
|
struct openvz_vm *openvzFindVMByUUID(const struct openvz_driver *driver,
|
||||||
|
@ -125,18 +125,6 @@ static void cmdExecFree(char *cmdExec[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For errors internal to this library. */
|
|
||||||
static void
|
|
||||||
error (virConnectPtr conn, virErrorNumber code, const char *info)
|
|
||||||
{
|
|
||||||
const char *errmsg;
|
|
||||||
|
|
||||||
errmsg = __virErrorMsg (code, info);
|
|
||||||
__virRaiseError (conn, NULL, NULL, VIR_FROM_OPENVZ,
|
|
||||||
code, VIR_ERR_ERROR, errmsg, info, NULL, 0, 0,
|
|
||||||
errmsg, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
|
static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
|
||||||
int id) {
|
int id) {
|
||||||
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
||||||
@ -257,7 +245,8 @@ static int openvzDomainShutdown(virDomainPtr dom) {
|
|||||||
|
|
||||||
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +290,8 @@ static int openvzDomainReboot(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +350,8 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
}
|
}
|
||||||
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
goto bail_out2;
|
goto bail_out2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +419,8 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
|
|||||||
}
|
}
|
||||||
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +436,8 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
|
|||||||
}
|
}
|
||||||
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +491,8 @@ openvzDomainCreate(virDomainPtr dom)
|
|||||||
}
|
}
|
||||||
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +535,8 @@ openvzDomainUndefine(virDomainPtr dom)
|
|||||||
}
|
}
|
||||||
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZCTL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,7 +628,8 @@ static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
|
|||||||
|
|
||||||
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZLIST);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,7 +660,8 @@ static int openvzListDefinedDomains(virConnectPtr conn,
|
|||||||
/* the -S options lists only stopped domains */
|
/* the -S options lists only stopped domains */
|
||||||
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not exec %s"), VZLIST);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user