From 5c7bfbf70b9d5ddc253e4cef30562adf9e37f7db Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 26 Jul 2023 16:06:12 +0200 Subject: [libvirt] Extend setFeatureKvmHiddenState to fully fool Windows --- src/main/java/org/openslx/libvirt/domain/Domain.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index 61d3bcc..9dc7200 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -373,6 +373,16 @@ public class Domain extends LibvirtXmlDocument public void setFeatureKvmHiddenState( boolean on ) { this.getRootXmlNode().setXmlElementAttributeValueOnOff( "features/kvm/hidden", "state", on ); + this.getRootXmlNode().setXmlElement( "cpu" ); + if ( on ) { + Element cpu = this.getRootXmlNode().getXmlElement( "cpu" ); + XmlHelper.getOrCreateElement( this.getRootXmlNode().getXmlDocument(), cpu, + null, null, + "feature", "name", "hypervisor" ); + this.getRootXmlNode().setXmlElementAttributeValue( "cpu/feature", "policy", "disable" ); + } else { + this.getRootXmlNode().removeXmlElement( "cpu/feature[@name='hypervisor']" ); + } } /** -- cgit v1.2.3-55-g7522