mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Fri Feb 23 08:40:52 IST 2007 Mark McLoughlin <markmc@redhat.com>
* qemud/driver.[ch], qemud/dispatch.c: fix the fact that qemudDispatchDomainStart() doesn't report an error if the uuid lookup fails and also move the uuid lookup into the driver so that it matches the way we do Destroy().
This commit is contained in:
parent
6ecd4045aa
commit
593d20d400
@ -1,4 +1,11 @@
|
|||||||
Fri Feb 22 08:37:23 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
Fri Feb 23 08:40:52 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
|
* qemud/driver.[ch], qemud/dispatch.c: fix the fact that
|
||||||
|
qemudDispatchDomainStart() doesn't report an error if the uuid
|
||||||
|
lookup fails and also move the uuid lookup into the driver
|
||||||
|
so that it matches the way we do Destroy().
|
||||||
|
|
||||||
|
Fri Feb 23 08:37:23 IST 2007 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
* qemud/conf.c, qemud/driver.c, qemud/internal.h,
|
* qemud/conf.c, qemud/driver.c, qemud/internal.h,
|
||||||
qemud/qemud.c: Merge the ->activevms and ->inactivevms
|
qemud/qemud.c: Merge the ->activevms and ->inactivevms
|
||||||
|
@ -257,8 +257,7 @@ static int qemudDispatchDomainDestroy(struct qemud_server *server, struct qemud_
|
|||||||
if (in->header.dataSize != sizeof(in->data.domainDestroyRequest))
|
if (in->header.dataSize != sizeof(in->data.domainDestroyRequest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int ret = qemudDomainDestroy(server, in->data.domainDestroyRequest.id);
|
if (qemudDomainDestroy(server, in->data.domainDestroyRequest.id) < 0) {
|
||||||
if (ret < 0) {
|
|
||||||
if (qemudDispatchFailure(server, client, out) < 0)
|
if (qemudDispatchFailure(server, client, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@ -410,11 +409,12 @@ static int qemudDispatchNumDefinedDomains(struct qemud_server *server, struct qe
|
|||||||
|
|
||||||
static int qemudDispatchDomainStart(struct qemud_server *server, struct qemud_client *client,
|
static int qemudDispatchDomainStart(struct qemud_server *server, struct qemud_client *client,
|
||||||
struct qemud_packet *in, struct qemud_packet *out) {
|
struct qemud_packet *in, struct qemud_packet *out) {
|
||||||
|
struct qemud_vm *vm;
|
||||||
|
|
||||||
if (in->header.dataSize != sizeof(in->data.domainStartRequest))
|
if (in->header.dataSize != sizeof(in->data.domainStartRequest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
struct qemud_vm *vm = qemudFindVMByUUID(server, in->data.domainStartRequest.uuid);
|
if (!(vm = qemudDomainStart(server, in->data.domainStartRequest.uuid))) {
|
||||||
if (!vm || qemudDomainStart(server, vm) < 0) {
|
|
||||||
if (qemudDispatchFailure(server, client, out) < 0)
|
if (qemudDispatchFailure(server, client, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@ -651,11 +651,12 @@ static int qemudDispatchNetworkUndefine(struct qemud_server *server, struct qemu
|
|||||||
|
|
||||||
static int qemudDispatchNetworkStart(struct qemud_server *server, struct qemud_client *client,
|
static int qemudDispatchNetworkStart(struct qemud_server *server, struct qemud_client *client,
|
||||||
struct qemud_packet *in, struct qemud_packet *out) {
|
struct qemud_packet *in, struct qemud_packet *out) {
|
||||||
|
struct qemud_network *network;
|
||||||
|
|
||||||
if (in->header.dataSize != sizeof(in->data.networkStartRequest))
|
if (in->header.dataSize != sizeof(in->data.networkStartRequest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
struct qemud_network *network = qemudFindNetworkByUUID(server, in->data.networkStartRequest.uuid);
|
if (!(network = qemudNetworkStart(server, in->data.networkStartRequest.uuid))) {
|
||||||
if (!network || qemudNetworkStart(server, network) < 0) {
|
|
||||||
if (qemudDispatchFailure(server, client, out) < 0)
|
if (qemudDispatchFailure(server, client, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@ -670,8 +671,7 @@ static int qemudDispatchNetworkDestroy(struct qemud_server *server, struct qemud
|
|||||||
if (in->header.dataSize != sizeof(in->data.networkDestroyRequest))
|
if (in->header.dataSize != sizeof(in->data.networkDestroyRequest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int ret = qemudNetworkDestroy(server, in->data.networkDestroyRequest.uuid);
|
if (qemudNetworkDestroy(server, in->data.networkDestroyRequest.uuid) < 0) {
|
||||||
if (ret < 0) {
|
|
||||||
if (qemudDispatchFailure(server, client, out) < 0)
|
if (qemudDispatchFailure(server, client, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -285,7 +285,7 @@ struct qemud_vm *qemudDomainCreate(struct qemud_server *server, const char *xml)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemudDomainStart(server, vm) < 0) {
|
if (qemudStartVMDaemon(server, vm) < 0) {
|
||||||
qemudFreeVM(vm);
|
qemudFreeVM(vm);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -339,13 +339,14 @@ int qemudDomainResume(struct qemud_server *server, int id) {
|
|||||||
|
|
||||||
int qemudDomainDestroy(struct qemud_server *server, int id) {
|
int qemudDomainDestroy(struct qemud_server *server, int id) {
|
||||||
struct qemud_vm *vm = qemudFindVMByID(server, id);
|
struct qemud_vm *vm = qemudFindVMByID(server, id);
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
|
qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
|
||||||
|
"no domain with matching id %d", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (qemudShutdownVMDaemon(server, vm) < 0)
|
|
||||||
return -1;
|
return qemudShutdownVMDaemon(server, vm);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -446,8 +447,16 @@ int qemudNumDefinedDomains(struct qemud_server *server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int qemudDomainStart(struct qemud_server *server, struct qemud_vm *vm) {
|
struct qemud_vm *qemudDomainStart(struct qemud_server *server, const unsigned char *uuid) {
|
||||||
return qemudStartVMDaemon(server, vm);
|
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
|
||||||
|
|
||||||
|
if (!vm) {
|
||||||
|
qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
|
||||||
|
"no domain with matching uuid");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return qemudStartVMDaemon(server, vm) < 0 ? NULL : vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -563,7 +572,7 @@ struct qemud_network *qemudNetworkCreate(struct qemud_server *server, const char
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemudNetworkStart(server, network) < 0) {
|
if (qemudStartNetworkDaemon(server, network) < 0) {
|
||||||
qemudFreeNetwork(network);
|
qemudFreeNetwork(network);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -609,21 +618,28 @@ int qemudNetworkUndefine(struct qemud_server *server, const unsigned char *uuid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemudNetworkStart(struct qemud_server *server, struct qemud_network *network) {
|
struct qemud_network *qemudNetworkStart(struct qemud_server *server, const unsigned char *uuid) {
|
||||||
return qemudStartNetworkDaemon(server, network);
|
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
|
||||||
|
|
||||||
|
if (!network) {
|
||||||
|
qemudReportError(server, VIR_ERR_INVALID_NETWORK,
|
||||||
|
"no network with matching uuid");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return qemudStartNetworkDaemon(server, network) < 0 ? NULL : network;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemudNetworkDestroy(struct qemud_server *server, const unsigned char *uuid) {
|
int qemudNetworkDestroy(struct qemud_server *server, const unsigned char *uuid) {
|
||||||
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
|
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
|
||||||
|
|
||||||
if (!network) {
|
if (!network) {
|
||||||
qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
|
qemudReportError(server, VIR_ERR_INVALID_NETWORK,
|
||||||
|
"no network with matching uuid");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemudShutdownNetworkDaemon(server, network) < 0)
|
return qemudShutdownNetworkDaemon(server, network);
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemudNetworkDumpXML(struct qemud_server *server, const unsigned char *uuid, char *xml, int xmllen) {
|
int qemudNetworkDumpXML(struct qemud_server *server, const unsigned char *uuid, char *xml, int xmllen) {
|
||||||
|
@ -79,8 +79,8 @@ int qemudListDefinedDomains(struct qemud_server *server,
|
|||||||
char *const*names,
|
char *const*names,
|
||||||
int nnames);
|
int nnames);
|
||||||
int qemudNumDefinedDomains(struct qemud_server *server);
|
int qemudNumDefinedDomains(struct qemud_server *server);
|
||||||
int qemudDomainStart(struct qemud_server *server,
|
struct qemud_vm *qemudDomainStart(struct qemud_server *server,
|
||||||
struct qemud_vm *vm);
|
const unsigned char *uuid);
|
||||||
struct qemud_vm *qemudDomainDefine(struct qemud_server *server,
|
struct qemud_vm *qemudDomainDefine(struct qemud_server *server,
|
||||||
const char *xml);
|
const char *xml);
|
||||||
int qemudDomainUndefine(struct qemud_server *server,
|
int qemudDomainUndefine(struct qemud_server *server,
|
||||||
@ -103,10 +103,10 @@ struct qemud_network *qemudNetworkCreate(struct qemud_server *server,
|
|||||||
const char *xml);
|
const char *xml);
|
||||||
struct qemud_network *qemudNetworkDefine(struct qemud_server *server,
|
struct qemud_network *qemudNetworkDefine(struct qemud_server *server,
|
||||||
const char *xml);
|
const char *xml);
|
||||||
|
struct qemud_network *qemudNetworkStart(struct qemud_server *server,
|
||||||
|
const unsigned char *uuid);
|
||||||
int qemudNetworkUndefine(struct qemud_server *server,
|
int qemudNetworkUndefine(struct qemud_server *server,
|
||||||
const unsigned char *uuid);
|
const unsigned char *uuid);
|
||||||
int qemudNetworkStart(struct qemud_server *server,
|
|
||||||
struct qemud_network *network);
|
|
||||||
int qemudNetworkDestroy(struct qemud_server *server,
|
int qemudNetworkDestroy(struct qemud_server *server,
|
||||||
const unsigned char *uuid);
|
const unsigned char *uuid);
|
||||||
int qemudNetworkDumpXML(struct qemud_server *server,
|
int qemudNetworkDumpXML(struct qemud_server *server,
|
||||||
|
Loading…
Reference in New Issue
Block a user