提交 593d20d4 编写于 作者: M Mark McLoughlin

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().
上级 6ecd4045
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/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))
return -1;
int ret = qemudDomainDestroy(server, in->data.domainDestroyRequest.id);
if (ret < 0) {
if (qemudDomainDestroy(server, in->data.domainDestroyRequest.id) < 0) {
if (qemudDispatchFailure(server, client, out) < 0)
return -1;
} 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,
struct qemud_packet *in, struct qemud_packet *out) {
struct qemud_vm *vm;
if (in->header.dataSize != sizeof(in->data.domainStartRequest))
return -1;
struct qemud_vm *vm = qemudFindVMByUUID(server, in->data.domainStartRequest.uuid);
if (!vm || qemudDomainStart(server, vm) < 0) {
if (!(vm = qemudDomainStart(server, in->data.domainStartRequest.uuid))) {
if (qemudDispatchFailure(server, client, out) < 0)
return -1;
} 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,
struct qemud_packet *in, struct qemud_packet *out) {
struct qemud_network *network;
if (in->header.dataSize != sizeof(in->data.networkStartRequest))
return -1;
struct qemud_network *network = qemudFindNetworkByUUID(server, in->data.networkStartRequest.uuid);
if (!network || qemudNetworkStart(server, network) < 0) {
if (!(network = qemudNetworkStart(server, in->data.networkStartRequest.uuid))) {
if (qemudDispatchFailure(server, client, out) < 0)
return -1;
} else {
......@@ -670,8 +671,7 @@ static int qemudDispatchNetworkDestroy(struct qemud_server *server, struct qemud
if (in->header.dataSize != sizeof(in->data.networkDestroyRequest))
return -1;
int ret = qemudNetworkDestroy(server, in->data.networkDestroyRequest.uuid);
if (ret < 0) {
if (qemudNetworkDestroy(server, in->data.networkDestroyRequest.uuid) < 0) {
if (qemudDispatchFailure(server, client, out) < 0)
return -1;
} else {
......
......@@ -285,7 +285,7 @@ struct qemud_vm *qemudDomainCreate(struct qemud_server *server, const char *xml)
return NULL;
}
if (qemudDomainStart(server, vm) < 0) {
if (qemudStartVMDaemon(server, vm) < 0) {
qemudFreeVM(vm);
return NULL;
}
......@@ -339,13 +339,14 @@ int qemudDomainResume(struct qemud_server *server, int id) {
int qemudDomainDestroy(struct qemud_server *server, int id) {
struct qemud_vm *vm = qemudFindVMByID(server, id);
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;
}
if (qemudShutdownVMDaemon(server, vm) < 0)
return -1;
return 0;
return qemudShutdownVMDaemon(server, vm);
}
......@@ -446,8 +447,16 @@ int qemudNumDefinedDomains(struct qemud_server *server) {
}
int qemudDomainStart(struct qemud_server *server, struct qemud_vm *vm) {
return qemudStartVMDaemon(server, vm);
struct qemud_vm *qemudDomainStart(struct qemud_server *server, const unsigned char *uuid) {
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;
}
if (qemudNetworkStart(server, network) < 0) {
if (qemudStartNetworkDaemon(server, network) < 0) {
qemudFreeNetwork(network);
return NULL;
}
......@@ -609,21 +618,28 @@ int qemudNetworkUndefine(struct qemud_server *server, const unsigned char *uuid)
return 0;
}
int qemudNetworkStart(struct qemud_server *server, struct qemud_network *network) {
return qemudStartNetworkDaemon(server, network);
struct qemud_network *qemudNetworkStart(struct qemud_server *server, const unsigned char *uuid) {
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) {
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
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;
}
if (qemudShutdownNetworkDaemon(server, network) < 0)
return -1;
return 0;
return qemudShutdownNetworkDaemon(server, network);
}
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,
int nnames);
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);
struct qemud_vm *qemudDomainDefine(struct qemud_server *server,
const char *xml);
int qemudDomainUndefine(struct qemud_server *server,
......@@ -103,10 +103,10 @@ struct qemud_network *qemudNetworkCreate(struct qemud_server *server,
const char *xml);
struct qemud_network *qemudNetworkDefine(struct qemud_server *server,
const char *xml);
struct qemud_network *qemudNetworkStart(struct qemud_server *server,
const unsigned char *uuid);
int qemudNetworkUndefine(struct qemud_server *server,
const unsigned char *uuid);
int qemudNetworkStart(struct qemud_server *server,
struct qemud_network *network);
int qemudNetworkDestroy(struct qemud_server *server,
const unsigned char *uuid);
int qemudNetworkDumpXML(struct qemud_server *server,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册