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

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