Blame SOURCES/0011-o-kubevirt-Move-cpu-element-under-domain.patch

b85204
From 6b7ef3efe748a72edad0faa508e91b340038a586 Mon Sep 17 00:00:00 2001
b85204
From: "Richard W.M. Jones" <rjones@redhat.com>
b85204
Date: Fri, 20 Jan 2023 09:11:52 +0000
b85204
Subject: [PATCH] -o kubevirt: Move "cpu" element under "domain"
b85204
b85204
Apparently this element doesn't go in the obvious place (under
b85204
"resources", next to memory), but in a whole new section under "cpu",
b85204
which makes no logical sense but here we are.  Also verified this
b85204
against Kubevirt examples/vm-template-fedora.yaml
b85204
b85204
Reported-by: Ming Xie
b85204
Fixes: commit bfa62b4683d312fc2fa9bb3c08963fc4846831b9
b85204
(cherry picked from commit 8db50a85f0363d90918edd1af4fc20ddc245b421)
b85204
---
b85204
 output/create_kubevirt_yaml.ml | 7 ++++---
b85204
 1 file changed, 4 insertions(+), 3 deletions(-)
b85204
b85204
diff --git a/output/create_kubevirt_yaml.ml b/output/create_kubevirt_yaml.ml
b85204
index 205e9be3..689555e4 100644
b85204
--- a/output/create_kubevirt_yaml.ml
b85204
+++ b/output/create_kubevirt_yaml.ml
b85204
@@ -65,13 +65,13 @@ let create_kubevirt_yaml source inspect
b85204
   let memory_str = sprintf "%LdMi" (source.s_memory /^ 1024_L /^ 1024_L) in
b85204
   List.push_back resources ("requests", Assoc ["memory", String memory_str]);
b85204
 
b85204
-  (* # vCPUs. XXX vendor, model, topology *)
b85204
-  List.push_back resources ("cpu", Assoc ["cores", Int source.s_vcpu]);
b85204
-
b85204
   (* Machine features. *)
b85204
   let features = List.map (fun name -> name, List []) source.s_features in
b85204
   List.push_back resources ("features", Assoc features);
b85204
 
b85204
+  (* # vCPUs. XXX vendor, model, topology *)
b85204
+  let cpu = "cpu", Assoc ["cores", Int source.s_vcpu] in
b85204
+
b85204
   (* XXX firmware, display, sound *)
b85204
 
b85204
   (* XXX guestcaps: rng, balloon, vsock, virtio 1.0 *)
b85204
@@ -109,6 +109,7 @@ let create_kubevirt_yaml source inspect
b85204
   if !devices <> [] then
b85204
     List.push_back domain ("devices", Assoc !devices);
b85204
   List.push_back domain ("resources", Assoc !resources);
b85204
+  List.push_back domain cpu;
b85204
 
b85204
   let spec = ref [] in
b85204
   List.push_back spec ("domain", Assoc !domain);