mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virGetDomain: Set domain ID too
So far our code is full of the following pattern:
dom = virGetDomain(conn, name, uuid)
if (dom)
dom->id = 42;
There is no reasong why it couldn't be just:
dom = virGetDomain(conn, name, uuid, id);
After all, client domain representation consists of tuple (name,
uuid, id).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
f7ef0a5a91
commit
5683b21309
23 files changed
+130
-285
No files matched your search
+5
-10
@@ -608,6 +608,7 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn,
|
||||
virDomainPtr *domain)
|
||||
{
|
||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||
int id = -1;
|
||||
|
||||
if (domain == NULL || *domain != NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||
@@ -621,18 +622,12 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
*domain = virGetDomain(conn, computerSystem->data->ElementName, uuid);
|
||||
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL))
|
||||
id = computerSystem->data->ProcessID;
|
||||
|
||||
if (*domain == NULL)
|
||||
return -1;
|
||||
*domain = virGetDomain(conn, computerSystem->data->ElementName, uuid, id);
|
||||
|
||||
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
|
||||
(*domain)->id = computerSystem->data->ProcessID;
|
||||
} else {
|
||||
(*domain)->id = -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return *domain ? 0 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in new issue
Block a user