mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
src/xenxs: Refactor code formating general VM config
introduce function xenFormatXMGeneralMeta(virConfPtr conf,......); which parses uuid and name instead Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
0c35a415f7
commit
44650e91b9
@ -1660,32 +1660,43 @@ xenFormatXMPCI(virConfPtr conf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenFormatXMGeneralMeta(virConfPtr conf, virDomainDefPtr def)
|
||||||
|
{
|
||||||
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
|
if (xenXMConfigSetString(conf, "name", def->name) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
virUUIDFormat(def->uuid, uuid);
|
||||||
|
if (xenXMConfigSetString(conf, "uuid", uuid) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
||||||
either 32, or 64 on a platform where long is big enough. */
|
either 32, or 64 on a platform where long is big enough. */
|
||||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||||
|
|
||||||
virConfPtr xenFormatXM(virConnectPtr conn,
|
virConfPtr
|
||||||
virDomainDefPtr def,
|
xenFormatXM(virConnectPtr conn,
|
||||||
int xendConfigVersion)
|
virDomainDefPtr def,
|
||||||
|
int xendConfigVersion)
|
||||||
{
|
{
|
||||||
virConfPtr conf = NULL;
|
virConfPtr conf = NULL;
|
||||||
int hvm = 0, vmlocaltime = 0;
|
int hvm = 0, vmlocaltime = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *cpus = NULL;
|
char *cpus = NULL;
|
||||||
const char *lifecycle;
|
const char *lifecycle;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
|
||||||
virConfValuePtr diskVal = NULL;
|
virConfValuePtr diskVal = NULL;
|
||||||
virConfValuePtr netVal = NULL;
|
virConfValuePtr netVal = NULL;
|
||||||
|
|
||||||
if (!(conf = virConfNew()))
|
if (!(conf = virConfNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (xenFormatXMGeneralMeta(conf, def) < 0)
|
||||||
if (xenXMConfigSetString(conf, "name", def->name) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuid);
|
|
||||||
if (xenXMConfigSetString(conf, "uuid", uuid) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (xenXMConfigSetInt(conf, "maxmem",
|
if (xenXMConfigSetInt(conf, "maxmem",
|
||||||
|
Loading…
Reference in New Issue
Block a user