security_manager: Remove redundant qemuSecurityGetNested() call

This commit removes the redundant call to qemuSecurityGetNested() in
qemuStateInitialize(). In qemuSecurityGetModel(), the first security manager
in the stack is already used by default, so this change helps to
simplify the code.

Signed-off-by: hongmianquan <hongmianquan@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
hongmianquan 2024-07-05 16:01:58 +08:00 committed by Michal Privoznik
parent 790b4d8067
commit 0d3e962d47

View File

@ -560,7 +560,6 @@ qemuStateInitialize(bool privileged,
bool autostart = true;
size_t i;
const char *defsecmodel = NULL;
g_autofree virSecurityManager **sec_managers = NULL;
g_autoptr(virIdentity) identity = virIdentityGetCurrent();
qemu_driver = g_new0(virQEMUDriver, 1);
@ -826,11 +825,8 @@ qemuStateInitialize(bool privileged,
if (!qemu_driver->qemuCapsCache)
goto error;
if (!(sec_managers = qemuSecurityGetNested(qemu_driver->securityManager)))
goto error;
if (sec_managers[0] != NULL)
defsecmodel = qemuSecurityGetModel(sec_managers[0]);
if (qemu_driver->securityManager != NULL)
defsecmodel = qemuSecurityGetModel(qemu_driver->securityManager);
if (!(qemu_driver->xmlopt = virQEMUDriverCreateXMLConf(qemu_driver,
defsecmodel)))