提交 c4ce8333 编写于 作者: M Matthias Bolte

Fix misuse of VIR_ERR_INVALID_DOMAIN

VIR_ERR_INVALID_DOMAIN is meant for invalid domain pointers.
VIR_ERR_NO_DOMAIN is meant for non-existing domains.
上级 30a13736
......@@ -285,7 +285,7 @@ static int oneDomainUndefine(virDomainPtr dom)
oneDriverLock(driver);
vm =virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
oneError(VIR_ERR_INVALID_DOMAIN, "%s",
oneError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto return_point;
}
......@@ -316,7 +316,7 @@ static int oneDomainGetInfo(virDomainPtr dom,
oneDriverUnlock(driver);
if (!vm) {
oneError(VIR_ERR_INVALID_DOMAIN, "%s",
oneError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
return -1;
}
......@@ -391,7 +391,7 @@ static char *oneGetOSType(virDomainPtr dom)
vm =virDomainFindByUUID(&driver->domains, dom->uuid);
oneDriverUnlock(driver);
if (!vm) {
oneError(VIR_ERR_INVALID_DOMAIN, "%s",
oneError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -420,7 +420,7 @@ static int oneDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
vm = virDomainFindByName(&driver->domains, dom->name);
if (!vm) {
oneError(VIR_ERR_INVALID_DOMAIN,
oneError(VIR_ERR_NO_DOMAIN,
_("no domain named %s"), dom->name);
goto return_point;
}
......@@ -507,7 +507,7 @@ static int oneDomainShutdown(virDomainPtr dom)
oneDriverLock(driver);
if (!(vm=virDomainFindByID(&driver->domains, dom->id))) {
oneError(VIR_ERR_INVALID_DOMAIN,
oneError(VIR_ERR_NO_DOMAIN,
_("no domain with id %d"), dom->id);
goto return_point;
}
......@@ -542,7 +542,7 @@ static int oneDomainDestroy(virDomainPtr dom)
oneDriverLock(driver);
vm= virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
oneError(VIR_ERR_INVALID_DOMAIN,
oneError(VIR_ERR_NO_DOMAIN,
_("no domain with id %d"), dom->id);
goto return_point;
}
......@@ -591,7 +591,7 @@ static int oneDomainSuspend(virDomainPtr dom)
oneError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain is not running"));
} else {
oneError(VIR_ERR_INVALID_DOMAIN,
oneError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
}
......@@ -624,7 +624,7 @@ static int oneDomainResume(virDomainPtr dom)
oneError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain is not paused"));
} else {
oneError(VIR_ERR_INVALID_DOMAIN,
oneError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
}
......
......@@ -350,7 +350,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -437,7 +437,7 @@ static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -481,7 +481,7 @@ static int openvzDomainSuspend(virDomainPtr dom) {
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -521,7 +521,7 @@ static int openvzDomainResume(virDomainPtr dom) {
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -561,7 +561,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -599,7 +599,7 @@ static int openvzDomainReboot(virDomainPtr dom,
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1026,7 +1026,7 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching id"));
goto cleanup;
}
......@@ -1073,7 +1073,7 @@ openvzDomainUndefine(virDomainPtr dom)
openvzDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1117,7 +1117,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1149,7 +1149,7 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart)
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1242,7 +1242,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
openvzDriverUnlock(driver);
if (!vm) {
openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
openvzError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......
......@@ -1310,7 +1310,7 @@ static int umlDomainShutdown(virDomainPtr dom) {
vm = virDomainFindByID(&driver->domains, dom->id);
umlDriverUnlock(driver);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN,
umlReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1340,7 +1340,7 @@ static int umlDomainDestroy(virDomainPtr dom) {
umlDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN,
umlReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1370,7 +1370,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1398,7 +1398,7 @@ static unsigned long umlDomainGetMaxMemory(virDomainPtr dom) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_INVALID_DOMAIN,
umlReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
......@@ -1423,7 +1423,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_INVALID_DOMAIN,
umlReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
......@@ -1456,7 +1456,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_INVALID_DOMAIN,
umlReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
......@@ -1493,7 +1493,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
umlDriverUnlock(driver);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1533,7 +1533,7 @@ static char *umlDomainDumpXML(virDomainPtr dom,
umlDriverUnlock(driver);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1584,7 +1584,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int flags) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1650,7 +1650,7 @@ static int umlDomainUndefine(virDomainPtr dom) {
umlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1922,7 +1922,7 @@ static int umlDomainGetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -1948,7 +1948,7 @@ static int umlDomainSetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -2022,7 +2022,7 @@ umlDomainBlockPeek(virDomainPtr dom,
umlDriverUnlock(driver);
if (!vm) {
umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
umlReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......
......@@ -1453,7 +1453,7 @@ static int vboxDomainSuspend(virDomainPtr dom) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1505,7 +1505,7 @@ static int vboxDomainResume(virDomainPtr dom) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1556,7 +1556,7 @@ static int vboxDomainShutdown(virDomainPtr dom) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1606,7 +1606,7 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSE
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1652,7 +1652,7 @@ static int vboxDomainDestroy(virDomainPtr dom) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1722,7 +1722,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
goto cleanup;
}
......@@ -1950,11 +1950,11 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
}
VBOX_RELEASE(machine);
} else {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
}
} else {
vboxError(VIR_ERR_INVALID_DOMAIN,
vboxError(VIR_ERR_NO_DOMAIN,
_("can't open session to the domain with id %d"), dom->id);
}
data->vboxSession->vtbl->Close(data->vboxSession);
......@@ -4863,7 +4863,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -5068,7 +5068,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
goto cleanup;
}
......@@ -5340,7 +5340,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
vboxIIDFromUUID(&domiid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, domiid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5445,7 +5445,7 @@ vboxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
vboxIIDFromUUID(&domiid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, domiid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5549,7 +5549,7 @@ vboxDomainSnapshotNum(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5589,7 +5589,7 @@ vboxDomainSnapshotListNames(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5652,7 +5652,7 @@ vboxDomainSnapshotLookupByName(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5684,7 +5684,7 @@ vboxDomainHasCurrentSnapshot(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5724,7 +5724,7 @@ vboxDomainSnapshotCurrent(virDomainPtr dom,
vboxIIDFromUUID(&iid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -5893,7 +5893,7 @@ vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
vboxIIDFromUUID(&domiid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, domiid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......@@ -6050,7 +6050,7 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
vboxIIDFromUUID(&domiid, dom->uuid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, domiid.value, &machine);
if (NS_FAILED(rc)) {
vboxError(VIR_ERR_INVALID_DOMAIN, "%s",
vboxError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching UUID"));
goto cleanup;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册