From 559ec9a7ccdf3299048af95ce942b4c472944960 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 27 Jul 2023 16:10:42 +0200 Subject: [libvirt] If cpu mode is passtrough, pass through cpu cache info as well --- src/main/java/org/openslx/libvirt/domain/Domain.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index a8b57ff..c19b2a3 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -728,6 +728,13 @@ public class Domain extends LibvirtXmlDocument public void setCpuMode( CpuMode mode ) { this.getRootXmlNode().setXmlElementAttributeValue( "cpu", "mode", mode.toString() ); + // Pass through cache information as well, because for some reason this is no the default + // when we do CPU host passthrough.... + if ( mode == CpuMode.HOST_PASSTHROUGH ) { + this.getRootXmlNode().setXmlElementAttributeValue( "cpu/cache", "mode", "passthrough" ); + } else if ( "passthrough".equals( this.getRootXmlNode().getXmlElementAttributeValue( "cpu/cache", "mode" ) ) ) { + this.getRootXmlNode().removeXmlElement( "cpu/cache" ); + } } /** -- cgit v1.2.3-55-g7522