From 47155fd47b3a45c50627a63f4b3137705ea16a61 Mon Sep 17 00:00:00 2001
From: Lucas Nussbaum <lucas.nussbaum@loria.fr>
Date: Mon, 28 Oct 2019 08:45:50 +0100
Subject: [PATCH] [dev] Add empty by_id value if not available in input file
 (bug 11043)

---
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-1.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-11.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-12.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-13.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-14.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-15.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-16.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-17.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-18.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-19.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-2.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-20.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-24.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-27.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-29.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-3.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-30.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-31.json  | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-4.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-5.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-6.json   | 1 +
 .../sites/lyon/clusters/sagittaire/nodes/sagittaire-7.json   | 1 +
 lib/refrepo/gen/reference-api.rb                             | 5 +++++
 23 files changed, 27 insertions(+)

diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-1.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-1.json
index 14e5a01cb97..1fba628e5b1 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-1.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-1.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-11.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-11.json
index 5f65375e175..37c18264b56 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-11.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-11.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-12.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-12.json
index b0b8689c908..747a15976ef 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-12.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-12.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-13.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-13.json
index c0307235906..cfd2432482b 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-13.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-13.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-14.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-14.json
index 85a097dff69..32f8865df3a 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-14.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-14.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-15.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-15.json
index 4559571344e..28f9723d6a0 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-15.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-15.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-16.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-16.json
index 36114f83620..2092d9c1883 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-16.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-16.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-17.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-17.json
index 118df402c46..e36d6689752 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-17.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-17.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-18.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-18.json
index c46d8037fcb..7fe3703aa2f 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-18.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-18.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-19.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-19.json
index f944932bed2..b14bf342b99 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-19.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-19.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-2.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-2.json
index 057b66d677e..09312c285d4 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-2.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-2.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-20.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-20.json
index af0af3cae45..6623236aa1c 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-20.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-20.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-24.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-24.json
index a51a1fe53db..53bbf52bd39 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-24.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-24.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-27.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-27.json
index bdbdd12a622..669fb702db8 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-27.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-27.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-29.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-29.json
index 3aa8c7e9f27..1ec2076dd97 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-29.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-29.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-3.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-3.json
index 1f2c5dfde18..a1cac9798d2 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-3.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-3.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-30.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-30.json
index 6ceaa72bd84..489c0c6a5c0 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-30.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-30.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-31.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-31.json
index 45eb975fa1f..13626804c57 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-31.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-31.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-4.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-4.json
index fbad7ec9588..4b9e45dce9b 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-4.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-4.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-5.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-5.json
index f79de154f40..84a9d402ead 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-5.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-5.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-6.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-6.json
index a8a2b7c0609..e0e7ee75133 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-6.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-6.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-7.json b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-7.json
index 41705ab54e5..a0bf23c400d 100644
--- a/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-7.json
+++ b/data/grid5000/sites/lyon/clusters/sagittaire/nodes/sagittaire-7.json
@@ -146,6 +146,7 @@
   },
   "storage_devices": [
     {
+      "by_id": "",
       "by_path": "/dev/disk/by-path/pci-0000:02:04.0-scsi-0:0:1:0",
       "device": "sda",
       "driver": "mptspi",
diff --git a/lib/refrepo/gen/reference-api.rb b/lib/refrepo/gen/reference-api.rb
index 849d3bbe577..568cf549494 100644
--- a/lib/refrepo/gen/reference-api.rb
+++ b/lib/refrepo/gen/reference-api.rb
@@ -236,6 +236,11 @@ def generate_reference_api
             hash['vendor'] = matching_vendor.keys.first
           end
 
+          # Ensure that by_id is present (bug 11043)
+          node["storage_devices"].each do |key, hash|
+            hash['by_id'] = '' if not hash['by_id']
+          end
+
           # Type conversion
           node["network_adapters"].each { |key, hash| hash["rate"] = hash["rate"].to_i if hash["rate"].is_a?(Float) }
 
-- 
GitLab