From 8c4a9a741fa0bbc4a57b192d2f553d232dcd552c Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 18 Aug 2008 11:37:55 +0000
Subject: [PATCH] QA: Convert configuration from YAML to JSON

We no longer use YAML in Ganeti at all. This patch converts the QA
configuration from YAML to JSON. JSON doesn't support comments and
I had to use a hack with fields starting with '#'.

Reviewed-by: ultrotter
---
 qa/qa-sample.json | 90 +++++++++++++++++++++++++++++++++++++++++++++++
 qa/qa-sample.yaml | 85 --------------------------------------------
 qa/qa_config.py   |  4 +--
 3 files changed, 92 insertions(+), 87 deletions(-)
 create mode 100644 qa/qa-sample.json
 delete mode 100644 qa/qa-sample.yaml

diff --git a/qa/qa-sample.json b/qa/qa-sample.json
new file mode 100644
index 000000000..8bbe30799
--- /dev/null
+++ b/qa/qa-sample.json
@@ -0,0 +1,90 @@
+{
+  "name": "xen-test",
+  "rename": "xen-test-rename",
+  "hypervisor-type": "xen-3.0",
+
+  "os": "debian-etch",
+  "os-size": "10G",
+  "swap-size": "1G",
+  "mem": "512M",
+
+  "nodes": [
+    {
+      "# Master node": null,
+      "primary": "xen-test-0",
+      "secondary": "192.168.1.1"
+    },
+
+    {
+      "primary": "xen-test-1",
+      "secondary": "192.168.1.2"
+    }
+  ],
+
+  "instances": [
+    {
+      "name": "xen-test-inst1"
+    },
+    {
+      "name": "xen-test-inst2"
+    }
+  ],
+
+  "tests": {
+    "env": true,
+    "os": true,
+    "tags": true,
+    "rapi": true,
+
+    "cluster-verify": true,
+    "cluster-info": true,
+    "cluster-burnin": true,
+    "cluster-command": true,
+    "cluster-copyfile": true,
+    "cluster-master-failover": true,
+    "cluster-destroy": true,
+    "cluster-rename": true,
+
+    "node-info": true,
+    "node-volumes": true,
+    "node-readd": true,
+
+    "# This test needs at least three nodes": null,
+    "node-evacuate": false,
+
+    "# This test needs at least two nodes": null,
+    "node-failover": false,
+
+    "instance-add-plain-disk": true,
+    "instance-add-drbd-disk": true,
+
+    "instance-list": true,
+    "instance-failover": true,
+    "instance-info": true,
+    "instance-modify": true,
+    "instance-export": true,
+    "instance-import": true,
+    "instance-reinstall": true,
+    "instance-reboot": true,
+    "instance-shutdown": true,
+    "instance-automatic-restart": false,
+    "instance-consecutive-failures": false,
+
+    "# This test might fail with certain hypervisor types, depending on whether": null,
+    "# they support the `gnt-instance console' command.": null,
+    "instance-console": false,
+
+    "# Disabled by default because it takes rather long": null,
+    "instance-replace-disks": false,
+
+    "# Make sure not to include the disk(s) required for Dom0 to be included in": null,
+    "# the volume group used for instances. Otherwise the whole system may stop": null,
+    "# working until restarted.": null,
+    "instance-disk-failure": false
+  },
+
+  "options": {
+    "burnin-instances": 2,
+    "burnin-disk-template": "drbd"
+  }
+}
diff --git a/qa/qa-sample.yaml b/qa/qa-sample.yaml
deleted file mode 100644
index e1457c78f..000000000
--- a/qa/qa-sample.yaml
+++ /dev/null
@@ -1,85 +0,0 @@
-# Cluster name
-name: xen-test
-rename: xen-test-rename
-hypervisor-type: xen-3.0
-
-# System to use
-os: debian-etch
-os-size: 10G
-swap-size: 1G
-mem: 512M
-
-# Nodes to use
-nodes:
-# Master node
-- primary: xen-test-0
-  secondary: 192.168.1.1
-
-# Other nodes
-- primary: xen-test-1
-  secondary: 192.168.1.2
-
-# Instance names to use
-instances:
-- name: xen-test-inst1
-- name: xen-test-inst2
-
-# Tests to run
-tests:
-  env: True
-  os: True
-  tags: True
-  rapi: True
-
-  cluster-verify: True
-  cluster-info: True
-  cluster-burnin: True
-  cluster-command: True
-  cluster-copyfile: True
-  cluster-master-failover: True
-  cluster-destroy: True
-  cluster-rename: True
-
-  node-info: True
-  node-volumes: True
-  node-readd: True
-
-  # This test needs at least three nodes
-  node-evacuate: False
-
-  # This test needs at least two nodes
-  node-failover: False
-
-  instance-add-plain-disk: True
-
-  # Requires DRBD 8.x
-  instance-add-drbd-disk: True
-
-  instance-list: True
-  instance-failover: True
-  instance-info: True
-  instance-modify: True
-  instance-export: True
-  instance-import: True
-  instance-reinstall: True
-  instance-reboot: True
-  instance-shutdown: True
-  instance-automatic-restart: False
-  instance-consecutive-failures: False
-
-  # This test might fail with certain hypervisor types, depending on whether
-  # they support the `gnt-instance console' command.
-  instance-console: False
-
-  # Disabled by default because it takes rather long
-  instance-replace-disks: False
-
-  # Make sure not to include the disk(s) required for Dom0 to be included in
-  # the volume group used for instances. Otherwise the whole system may stop
-  # working until restarted.
-  instance-disk-failure: False
-
-# Other settings
-options:
-  burnin-instances: 2
-  burnin-disk-template: drbd
diff --git a/qa/qa_config.py b/qa/qa_config.py
index d7a6ed307..13d857f8e 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -24,7 +24,7 @@
 """
 
 
-import yaml
+import simplejson
 
 import qa_error
 
@@ -41,7 +41,7 @@ def Load(path):
 
   f = open(path, 'r')
   try:
-    cfg = yaml.load(f.read())
+    cfg = simplejson.load(f)
   finally:
     f.close()
 
-- 
GitLab