mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
lookup by ID function and error report fix for OpenVZ
* src/openvz_driver.c: fix the lookup by ID function and error reporting in OpenVZ, fix by Evgeniy Sokolov Daniel
This commit is contained in:
parent
5553b0cd16
commit
07601749e8
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jul 16 17:25:02 CEST 2008 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/openvz_driver.c: fix the lookup by ID function and error
|
||||||
|
reporting in OpenVZ, fix by Evgeniy Sokolov
|
||||||
|
|
||||||
Wed Jul 16 16:44:27 CEST 2008 Daniel Veillard <veillard@redhat.com>
|
Wed Jul 16 16:44:27 CEST 2008 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/openvz_driver.c: another cleanup patch from Evgeniy Sokolov
|
* src/openvz_driver.c: another cleanup patch from Evgeniy Sokolov
|
||||||
|
@ -197,11 +197,22 @@ static int openvzDomainDefineCmd(virConnectPtr conn,
|
|||||||
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;
|
||||||
struct openvz_vm *vm = openvzFindVMByID(driver, id);
|
struct openvz_vm *vm;
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
|
|
||||||
|
vm = openvzFindVMByID(driver, id);
|
||||||
|
|
||||||
|
if (!vm) { /*try to find by name*/
|
||||||
|
char name[OPENVZ_NAME_MAX];
|
||||||
|
if (snprintf(name, OPENVZ_NAME_MAX, "%d",id) >= OPENVZ_NAME_MAX) {
|
||||||
|
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Too long domain name"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
vm = openvzFindVMByName(driver, name);
|
||||||
|
}
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching id"));
|
openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +240,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
|
|||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
openvzError(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
|
openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +261,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
|
|||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching name"));
|
openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user