mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu_conf: split out virQEMUDriverConfigLoadDefaultTLSEntry
Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
cfe99a336d
commit
4079f47677
@ -423,6 +423,25 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virQEMUDriverConfigLoadDefaultTLSEntry(virQEMUDriverConfigPtr cfg,
|
||||
virConfPtr conf)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if ((rv = virConfGetValueString(conf, "default_tls_x509_cert_dir", &cfg->defaultTLSx509certdir)) < 0)
|
||||
return -1;
|
||||
cfg->checkdefaultTLSx509certdir = (rv == 1);
|
||||
if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->defaultTLSx509verify) < 0)
|
||||
return -1;
|
||||
if (virConfGetValueString(conf, "default_tls_x509_secret_uuid",
|
||||
&cfg->defaultTLSx509secretUUID) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfigPtr cfg,
|
||||
virConfPtr conf)
|
||||
@ -1009,7 +1028,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
|
||||
{
|
||||
virConfPtr conf = NULL;
|
||||
int ret = -1;
|
||||
int rv;
|
||||
char *corestr = NULL;
|
||||
|
||||
/* Just check the file is readable before opening it, otherwise
|
||||
@ -1023,13 +1041,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
|
||||
if (!(conf = virConfReadFile(filename, 0)))
|
||||
goto cleanup;
|
||||
|
||||
if ((rv = virConfGetValueString(conf, "default_tls_x509_cert_dir", &cfg->defaultTLSx509certdir)) < 0)
|
||||
goto cleanup;
|
||||
cfg->checkdefaultTLSx509certdir = (rv == 1);
|
||||
if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->defaultTLSx509verify) < 0)
|
||||
goto cleanup;
|
||||
if (virConfGetValueString(conf, "default_tls_x509_secret_uuid",
|
||||
&cfg->defaultTLSx509secretUUID) < 0)
|
||||
if (virQEMUDriverConfigLoadDefaultTLSEntry(cfg, conf) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virQEMUDriverConfigLoadVNCEntry(cfg, conf) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user