mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
Ensure VirtualBox domain IDs start from 1 instead of 0
This commit is contained in:
parent
4c3f3b4d46
commit
7a367cca30
@ -1,3 +1,9 @@
|
|||||||
|
Tue Apr 21 14:39:03 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* po/POTFILES.in: Add vbox_tmpl.c file
|
||||||
|
* src/vbox/vbox_tmpl.c: Adjust domain IDs to start from 1
|
||||||
|
instead of 0, refuse domain ID 0.
|
||||||
|
|
||||||
Tue Apr 21 20:58:50 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
Tue Apr 21 20:58:50 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/network_conf.c src/network_conf.h: add dynamic bridge names
|
* src/network_conf.c src/network_conf.h: add dynamic bridge names
|
||||||
|
@ -38,6 +38,7 @@ src/uml_conf.c
|
|||||||
src/uml_driver.c
|
src/uml_driver.c
|
||||||
src/util.c
|
src/util.c
|
||||||
src/uuid.c
|
src/uuid.c
|
||||||
|
src/vbox/vbox_tmpl.c
|
||||||
src/virsh.c
|
src/virsh.c
|
||||||
src/virterror.c
|
src/virterror.c
|
||||||
src/xen_inotify.c
|
src/xen_inotify.c
|
||||||
|
@ -434,7 +434,7 @@ static int vboxListDomains(virConnectPtr conn, int *ids, int nids) {
|
|||||||
if ((state == MachineState_Running) ||
|
if ((state == MachineState_Running) ||
|
||||||
(state == MachineState_Paused) ) {
|
(state == MachineState_Paused) ) {
|
||||||
ret++;
|
ret++;
|
||||||
ids[j++] = i;
|
ids[j++] = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,6 +535,15 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
|
|||||||
PRUint32 state;
|
PRUint32 state;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Internal vbox IDs start from 0, the public libvirt ID
|
||||||
|
* starts from 1, so refuse id==0, and adjust the rest*/
|
||||||
|
if (id == 0) {
|
||||||
|
vboxError(conn, VIR_ERR_NO_DOMAIN,
|
||||||
|
_("no domain with matching id %d"), id);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
id = id - 1;
|
||||||
|
|
||||||
if(data->vboxObj) {
|
if(data->vboxObj) {
|
||||||
rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
|
rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
|
||||||
if (NS_FAILED(rc)) {
|
if (NS_FAILED(rc)) {
|
||||||
@ -568,7 +577,7 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
|
|||||||
|
|
||||||
dom = virGetDomain(conn, machineName, iidl);
|
dom = virGetDomain(conn, machineName, iidl);
|
||||||
if (dom)
|
if (dom)
|
||||||
dom->id = id;
|
dom->id = id + 1;
|
||||||
|
|
||||||
/* Cleanup all the XPCOM allocated stuff here */
|
/* Cleanup all the XPCOM allocated stuff here */
|
||||||
g_pVBoxFuncs->pfnComUnallocMem(iid);
|
g_pVBoxFuncs->pfnComUnallocMem(iid);
|
||||||
@ -645,7 +654,7 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch
|
|||||||
if (dom)
|
if (dom)
|
||||||
if ((state == MachineState_Running) ||
|
if ((state == MachineState_Running) ||
|
||||||
(state == MachineState_Paused) )
|
(state == MachineState_Paused) )
|
||||||
dom->id = i;
|
dom->id = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iid) {
|
if (iid) {
|
||||||
@ -725,7 +734,7 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
if (dom)
|
if (dom)
|
||||||
if ((state == MachineState_Running) ||
|
if ((state == MachineState_Running) ||
|
||||||
(state == MachineState_Paused) )
|
(state == MachineState_Paused) )
|
||||||
dom->id = i;
|
dom->id = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (machineName) {
|
if (machineName) {
|
||||||
@ -2311,7 +2320,7 @@ static int vboxDomainCreate(virDomainPtr dom) {
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
} else {
|
} else {
|
||||||
/* all ok set the domid */
|
/* all ok set the domid */
|
||||||
dom->id = i;
|
dom->id = i + 1;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user