Revision cd315ad9

b/Makefile.am
1044 1044
	test/data/bdev-rbd/output_invalid.txt \
1045 1045
	test/data/cert1.pem \
1046 1046
	test/data/cert2.pem \
1047
	test/data/cluster_config_2.7.json \
1048
	test/data/cluster_config_downgraded_2.7.json \
1047 1049
	test/data/instance-minor-pairing.txt \
1048 1050
	test/data/ip-addr-show-dummy0.txt \
1049 1051
	test/data/ip-addr-show-lo-ipv4.txt \
b/test/data/cluster_config_2.7.json
1
{
2
  "cluster": {
3
    "beparams": {
4
      "default": {
5
        "always_failover": false,
6
        "auto_balance": true,
7
        "maxmem": 128,
8
        "minmem": 128,
9
        "spindle_use": 1,
10
        "vcpus": 1
11
      }
12
    },
13
    "blacklisted_os": [],
14
    "candidate_pool_size": 10,
15
    "cluster_name": "cluster.name.example.com",
16
    "ctime": 1343869045.604884,
17
    "default_iallocator": "hail",
18
    "disk_state_static": {},
19
    "diskparams": {
20
      "blockdev": {},
21
      "diskless": {},
22
      "drbd": {
23
        "c-delay-target": 1,
24
        "c-fill-target": 200,
25
        "c-max-rate": 2048,
26
        "c-min-rate": 1024,
27
        "c-plan-ahead": 1,
28
        "data-stripes": 2,
29
        "disk-barriers": "bf",
30
        "disk-custom": "",
31
        "dynamic-resync": false,
32
        "meta-barriers": true,
33
        "meta-stripes": 2,
34
        "metavg": "xenvg",
35
        "net-custom": "",
36
        "resync-rate": 1024
37
      },
38
      "ext": {},
39
      "file": {},
40
      "plain": {
41
        "stripes": 2
42
      },
43
      "rbd": {
44
        "pool": "rbd"
45
      },
46
      "sharedfile": {}
47
    },
48
    "drbd_usermode_helper": "/bin/true",
49
    "enabled_hypervisors": [
50
      "xen-pvm"
51
    ],
52
    "file_storage_dir": "",
53
    "hidden_os": [],
54
    "highest_used_port": 32105,
55
    "hv_state_static": {
56
      "xen-pvm": {
57
        "cpu_node": 1,
58
        "cpu_total": 1,
59
        "mem_hv": 0,
60
        "mem_node": 0,
61
        "mem_total": 0
62
      }
63
    },
64
    "hvparams": {
65
      "chroot": {
66
        "init_script": "/ganeti-chroot"
67
      },
68
      "fake": {},
69
      "kvm": {
70
        "acpi": true,
71
        "boot_order": "disk",
72
        "cdrom2_image_path": "",
73
        "cdrom_disk_type": "",
74
        "cdrom_image_path": "",
75
        "cpu_cores": 0,
76
        "cpu_mask": "all",
77
        "cpu_sockets": 0,
78
        "cpu_threads": 0,
79
        "cpu_type": "",
80
        "disk_cache": "default",
81
        "disk_type": "paravirtual",
82
        "floppy_image_path": "",
83
        "initrd_path": "",
84
        "kernel_args": "ro",
85
        "kernel_path": "/boot/vmlinuz-kvmU",
86
        "keymap": "",
87
        "kvm_extra": "",
88
        "kvm_flag": "",
89
        "kvm_path": "/usr/bin/kvm",
90
        "machine_version": "",
91
        "mem_path": "",
92
        "migration_bandwidth": 4,
93
        "migration_downtime": 30,
94
        "migration_mode": "live",
95
        "migration_port": 4041,
96
        "nic_type": "paravirtual",
97
        "reboot_behavior": "reboot",
98
        "root_path": "/dev/vda1",
99
        "security_domain": "",
100
        "security_model": "none",
101
        "serial_console": true,
102
        "serial_speed": 38400,
103
        "soundhw": "",
104
        "spice_bind": "",
105
        "spice_image_compression": "",
106
        "spice_ip_version": 0,
107
        "spice_jpeg_wan_compression": "",
108
        "spice_password_file": "",
109
        "spice_playback_compression": true,
110
        "spice_streaming_video": "",
111
        "spice_tls_ciphers": "HIGH:-DES:-3DES:-EXPORT:-ADH",
112
        "spice_use_tls": false,
113
        "spice_use_vdagent": true,
114
        "spice_zlib_glz_wan_compression": "",
115
        "usb_devices": "",
116
        "usb_mouse": "",
117
        "use_chroot": false,
118
        "use_localtime": false,
119
        "vga": "",
120
        "vhost_net": false,
121
        "vnc_bind_address": "",
122
        "vnc_password_file": "",
123
        "vnc_tls": false,
124
        "vnc_x509_path": "",
125
        "vnc_x509_verify": false
126
      },
127
      "lxc": {
128
        "cpu_mask": ""
129
      },
130
      "xen-hvm": {
131
        "acpi": true,
132
        "blockdev_prefix": "hd",
133
        "boot_order": "cd",
134
        "cdrom_image_path": "",
135
        "cpu_cap": 0,
136
        "cpu_mask": "all",
137
        "cpu_weight": 256,
138
        "device_model": "/usr/lib/xen/bin/qemu-dm",
139
        "disk_type": "paravirtual",
140
        "kernel_path": "/usr/lib/xen/boot/hvmloader",
141
        "migration_mode": "non-live",
142
        "migration_port": 8082,
143
        "nic_type": "rtl8139",
144
        "pae": true,
145
        "pci_pass": "",
146
        "reboot_behavior": "reboot",
147
        "use_localtime": false,
148
        "vnc_bind_address": "0.0.0.0",
149
        "vnc_password_file": "/your/vnc-cluster-password"
150
      },
151
      "xen-pvm": {
152
        "blockdev_prefix": "sd",
153
        "bootloader_args": "",
154
        "bootloader_path": "",
155
        "cpu_cap": 0,
156
        "cpu_mask": "all",
157
        "cpu_weight": 256,
158
        "initrd_path": "",
159
        "kernel_args": "ro",
160
        "kernel_path": "/boot/vmlinuz-xenU",
161
        "migration_mode": "live",
162
        "migration_port": 8082,
163
        "reboot_behavior": "reboot",
164
        "root_path": "/dev/xvda1",
165
        "use_bootloader": false
166
      }
167
    },
168
    "ipolicy": {
169
      "disk-templates": [
170
        "sharedfile",
171
        "diskless",
172
        "plain",
173
        "blockdev",
174
        "drbd",
175
        "file",
176
        "rbd"
177
      ],
178
      "max": {
179
        "cpu-count": 8,
180
        "disk-count": 16,
181
        "disk-size": 1048576,
182
        "memory-size": 32768,
183
        "nic-count": 8,
184
        "spindle-use": 12
185
      },
186
      "min": {
187
        "cpu-count": 1,
188
        "disk-count": 1,
189
        "disk-size": 1024,
190
        "memory-size": 128,
191
        "nic-count": 1,
192
        "spindle-use": 1
193
      },
194
      "spindle-ratio": 32.0,
195
      "std": {
196
        "cpu-count": 1,
197
        "disk-count": 1,
198
        "disk-size": 1024,
199
        "memory-size": 128,
200
        "nic-count": 1,
201
        "spindle-use": 1
202
      },
203
      "vcpu-ratio": 1.0
204
    },
205
    "mac_prefix": "aa:bb:cc",
206
    "maintain_node_health": false,
207
    "master_ip": "192.0.2.87",
208
    "master_netdev": "eth0",
209
    "master_netmask": 32,
210
    "master_node": "node1.example.com",
211
    "modify_etc_hosts": true,
212
    "modify_ssh_setup": true,
213
    "mtime": 1361964122.79471,
214
    "ndparams": {
215
      "exclusive_storage": false,
216
      "oob_program": "",
217
      "spindle_count": 1
218
    },
219
    "nicparams": {
220
      "default": {
221
        "link": "br974",
222
        "mode": "bridged"
223
      }
224
    },
225
    "os_hvp": {
226
      "TEMP-Ganeti-QA-OS": {
227
        "xen-hvm": {
228
          "acpi": false,
229
          "pae": true
230
        },
231
        "xen-pvm": {
232
          "root_path": "/dev/sda5"
233
        }
234
      }
235
    },
236
    "osparams": {},
237
    "prealloc_wipe_disks": false,
238
    "primary_ip_family": 2,
239
    "reserved_lvs": [],
240
    "rsahostkeypub": "YOURKEY",
241
    "serial_no": 3189,
242
    "shared_file_storage_dir": "/srv/ganeti/shared-file-storage",
243
    "tags": [
244
      "mytag"
245
    ],
246
    "tcpudp_port_pool": [
247
      32101,
248
      32102,
249
      32103,
250
      32104,
251
      32105
252
    ],
253
    "uid_pool": [],
254
    "use_external_mip_script": false,
255
    "uuid": "dddf8c12-f2d8-4718-a35b-7804daf12a3f",
256
    "volume_group_name": "xenvg"
257
  },
258
  "ctime": 1343869045.605523,
259
  "instances": {
260
    "instance1.example.com": {
261
      "admin_state": "up",
262
      "beparams": {},
263
      "ctime": 1363620258.608976,
264
      "disk_template": "drbd",
265
      "disks": [
266
        {
267
          "children": [
268
            {
269
              "dev_type": "lvm",
270
              "logical_id": [
271
                "xenvg",
272
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_data"
273
              ],
274
              "params": {},
275
              "physical_id": [
276
                "xenvg",
277
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_data"
278
              ],
279
              "size": 1024
280
            },
281
            {
282
              "dev_type": "lvm",
283
              "logical_id": [
284
                "xenvg",
285
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_meta"
286
              ],
287
              "params": {},
288
              "physical_id": [
289
                "xenvg",
290
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_meta"
291
              ],
292
              "size": 128
293
            }
294
          ],
295
          "dev_type": "drbd8",
296
          "iv_name": "disk/0",
297
          "logical_id": [
298
            "node1.example.com",
299
            "node3.example.com",
300
            32100,
301
            0,
302
            0,
303
            "d3c3fd475fcbaf5fd177fb245ac43b71247ada38"
304
          ],
305
          "mode": "rw",
306
          "params": {},
307
          "physical_id": [
308
            "198.51.100.82",
309
            32100,
310
            "198.51.100.84",
311
            32100,
312
            0,
313
            "d3c3fd475fcbaf5fd177fb245ac43b71247ada38"
314
          ],
315
          "size": 1024
316
        }
317
      ],
318
      "hvparams": {},
319
      "hypervisor": "xen-pvm",
320
      "mtime": 1363620320.874901,
321
      "name": "instance1.example.com",
322
      "nics": [
323
        {
324
          "mac": "aa:bb:cc:b2:6e:0b",
325
          "nicparams": {}
326
        }
327
      ],
328
      "os": "busybox",
329
      "osparams": {},
330
      "primary_node": "node1.example.com",
331
      "serial_no": 2,
332
      "uuid": "6c078d22-3eb6-4780-857d-81772e09eef1"
333
    },
334
    "instance2.example.com": {
335
      "admin_state": "up",
336
      "beparams": {},
337
      "ctime": 1355186880.451181,
338
      "disk_template": "plain",
339
      "disks": [
340
        {
341
          "dev_type": "lvm",
342
          "iv_name": "disk/0",
343
          "logical_id": [
344
            "xenvg",
345
            "3e559cd7-1024-4294-a923-a9fd13182b2f.disk0"
346
          ],
347
          "mode": "rw",
348
          "params": {},
349
          "physical_id": [
350
            "xenvg",
351
            "3e559cd7-1024-4294-a923-a9fd13182b2f.disk0"
352
          ],
353
          "size": 102400
354
        }
355
      ],
356
      "hvparams": {},
357
      "hypervisor": "xen-pvm",
358
      "mtime": 1355186898.307642,
359
      "name": "instance2.example.com",
360
      "nics": [
361
        {
362
          "mac": "aa:bb:cc:56:83:fb",
363
          "nicparams": {}
364
        }
365
      ],
366
      "os": "debian-image",
367
      "osparams": {},
368
      "primary_node": "node3.example.com",
369
      "serial_no": 2,
370
      "tags": [],
371
      "uuid": "8fde9f6d-e1f1-4850-9e9c-154966f622f5"
372
    },
373
    "instance3.example.com": {
374
      "admin_state": "up",
375
      "beparams": {},
376
      "ctime": 1354038435.343601,
377
      "disk_template": "plain",
378
      "disks": [
379
        {
380
          "dev_type": "lvm",
381
          "iv_name": "disk/0",
382
          "logical_id": [
383
            "xenvg",
384
            "b27a576a-13f7-4f07-885c-63fcad4fdfcc.disk0"
385
          ],
386
          "mode": "rw",
387
          "params": {},
388
          "physical_id": [
389
            "xenvg",
390
            "b27a576a-13f7-4f07-885c-63fcad4fdfcc.disk0"
391
          ],
392
          "size": 1280
393
        }
394
      ],
395
      "hvparams": {},
396
      "hypervisor": "xen-pvm",
397
      "mtime": 1354224585.700732,
398
      "name": "instance3.example.com",
399
      "nics": [
400
        {
401
          "mac": "aa:bb:cc:5e:5c:75",
402
          "nicparams": {}
403
        }
404
      ],
405
      "os": "debian-image",
406
      "osparams": {},
407
      "primary_node": "node2.example.com",
408
      "serial_no": 4,
409
      "tags": [],
410
      "uuid": "4e091bdc-e205-4ed7-8a47-0c9130a6619f"
411
    }
412
  },
413
  "mtime": 1361984633.373014,
414
  "networks": {
415
    "99f0128a-1c84-44da-90b9-9581ea00c075": {
416
      "ext_reservations": "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
417
      "name": "a network",
418
      "network": "203.0.113.0/24",
419
      "reservations": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
420
      "serial_no": 1,
421
      "uuid": "99f0128a-1c84-44da-90b9-9581ea00c075"
422
    }
423
  },
424
  "nodegroups": {
425
    "5244a46d-7506-4e14-922d-02b58153dde1": {
426
      "alloc_policy": "preferred",
427
      "diskparams": {},
428
      "ipolicy": {
429
        "max": {},
430
        "min": {},
431
        "std": {}
432
      },
433
      "mtime": 1361963775.575009,
434
      "name": "default",
435
      "ndparams": {},
436
      "networks": {},
437
      "serial_no": 125,
438
      "tags": [],
439
      "uuid": "5244a46d-7506-4e14-922d-02b58153dde1"
440
    },
441
    "6c0a8916-b719-45ad-95dd-82192b1e473f": {
442
      "alloc_policy": "preferred",
443
      "diskparams": {},
444
      "ipolicy": {
445
	"disk-templates": [
446
	  "plain"
447
	],
448
	"max": {
449
	  "nic-count": 18,
450
	  "spindle-use": 14
451
	},
452
	"min": {
453
	  "cpu-count": 2,
454
	  "disk-count": 2
455
	},
456
	"spindle-ratio": 5.2,
457
	"std": {},
458
	"vcpu-ratio": 3.14
459
      },
460
      "mtime": 1361963775.575009,
461
      "name": "another",
462
      "ndparams": {
463
        "exclusive_storage": true
464
      },
465
      "networks": {},
466
      "serial_no": 125,
467
      "tags": [],
468
      "uuid": "6c0a8916-b719-45ad-95dd-82192b1e473f"
469
    }
470
  },
471
  "nodes": {
472
    "node1.example.com": {
473
      "ctime": 1349722460.022264,
474
      "drained": false,
475
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
476
      "master_candidate": true,
477
      "master_capable": true,
478
      "mtime": 1359986533.353329,
479
      "name": "node1.example.com",
480
      "ndparams": {},
481
      "offline": false,
482
      "powered": true,
483
      "primary_ip": "192.0.2.82",
484
      "secondary_ip": "198.51.100.82",
485
      "serial_no": 197,
486
      "tags": [],
487
      "uuid": "9a12d554-75c0-4cb1-8064-103365145db0",
488
      "vm_capable": true
489
    },
490
    "node2.example.com": {
491
      "ctime": 1343869045.604884,
492
      "drained": false,
493
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
494
      "master_candidate": true,
495
      "master_capable": true,
496
      "mtime": 1358348755.779906,
497
      "name": "node2.example.com",
498
      "ndparams": {},
499
      "offline": false,
500
      "powered": true,
501
      "primary_ip": "192.0.2.83",
502
      "secondary_ip": "198.51.100.83",
503
      "serial_no": 6,
504
      "tags": [],
505
      "uuid": "2ae3d962-2dad-44f2-bdb1-85f77107f907",
506
      "vm_capable": true
507
    },
508
    "node3.example.com": {
509
      "ctime": 1343869205.934807,
510
      "drained": false,
511
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
512
      "master_candidate": true,
513
      "master_capable": true,
514
      "mtime": 1353019704.885368,
515
      "name": "node3.example.com",
516
      "ndparams": {},
517
      "offline": false,
518
      "powered": true,
519
      "primary_ip": "192.0.2.84",
520
      "secondary_ip": "198.51.100.84",
521
      "serial_no": 2,
522
      "tags": [],
523
      "uuid": "41f9c238-173c-4120-9e41-04ad379b647a",
524
      "vm_capable": true
525
    }
526
  },
527
  "serial_no": 7624,
528
  "version": 2070000
529
}
b/test/data/cluster_config_downgraded_2.7.json
1
{
2
  "cluster": {
3
    "beparams": {
4
      "default": {
5
        "always_failover": false,
6
        "auto_balance": true,
7
        "maxmem": 128,
8
        "minmem": 128,
9
        "spindle_use": 1,
10
        "vcpus": 1
11
      }
12
    },
13
    "blacklisted_os": [],
14
    "candidate_pool_size": 10,
15
    "cluster_name": "cluster.name.example.com",
16
    "ctime": 1343869045.604884,
17
    "default_iallocator": "hail",
18
    "disk_state_static": {},
19
    "diskparams": {
20
      "blockdev": {},
21
      "diskless": {},
22
      "drbd": {
23
        "c-delay-target": 1,
24
        "c-fill-target": 200,
25
        "c-max-rate": 2048,
26
        "c-min-rate": 1024,
27
        "c-plan-ahead": 1,
28
        "data-stripes": 2,
29
        "disk-barriers": "bf",
30
        "disk-custom": "",
31
        "dynamic-resync": false,
32
        "meta-barriers": true,
33
        "meta-stripes": 2,
34
        "metavg": "xenvg",
35
        "net-custom": "",
36
        "resync-rate": 1024
37
      },
38
      "ext": {},
39
      "file": {},
40
      "plain": {
41
        "stripes": 2
42
      },
43
      "rbd": {
44
        "pool": "rbd"
45
      },
46
      "sharedfile": {}
47
    },
48
    "drbd_usermode_helper": "/bin/true",
49
    "enabled_hypervisors": [
50
      "xen-pvm"
51
    ],
52
    "file_storage_dir": "",
53
    "hidden_os": [],
54
    "highest_used_port": 32105,
55
    "hv_state_static": {
56
      "xen-pvm": {
57
        "cpu_node": 1,
58
        "cpu_total": 1,
59
        "mem_hv": 0,
60
        "mem_node": 0,
61
        "mem_total": 0
62
      }
63
    },
64
    "hvparams": {
65
      "chroot": {
66
        "init_script": "/ganeti-chroot"
67
      },
68
      "fake": {},
69
      "kvm": {
70
        "acpi": true,
71
        "boot_order": "disk",
72
        "cdrom2_image_path": "",
73
        "cdrom_disk_type": "",
74
        "cdrom_image_path": "",
75
        "cpu_cores": 0,
76
        "cpu_mask": "all",
77
        "cpu_sockets": 0,
78
        "cpu_threads": 0,
79
        "cpu_type": "",
80
        "disk_cache": "default",
81
        "disk_type": "paravirtual",
82
        "floppy_image_path": "",
83
        "initrd_path": "",
84
        "kernel_args": "ro",
85
        "kernel_path": "/boot/vmlinuz-kvmU",
86
        "keymap": "",
87
        "kvm_extra": "",
88
        "kvm_flag": "",
89
        "kvm_path": "/usr/bin/kvm",
90
        "machine_version": "",
91
        "mem_path": "",
92
        "migration_bandwidth": 4,
93
        "migration_downtime": 30,
94
        "migration_mode": "live",
95
        "migration_port": 4041,
96
        "nic_type": "paravirtual",
97
        "reboot_behavior": "reboot",
98
        "root_path": "/dev/vda1",
99
        "security_domain": "",
100
        "security_model": "none",
101
        "serial_console": true,
102
        "serial_speed": 38400,
103
        "soundhw": "",
104
        "spice_bind": "",
105
        "spice_image_compression": "",
106
        "spice_ip_version": 0,
107
        "spice_jpeg_wan_compression": "",
108
        "spice_password_file": "",
109
        "spice_playback_compression": true,
110
        "spice_streaming_video": "",
111
        "spice_tls_ciphers": "HIGH:-DES:-3DES:-EXPORT:-ADH",
112
        "spice_use_tls": false,
113
        "spice_use_vdagent": true,
114
        "spice_zlib_glz_wan_compression": "",
115
        "usb_devices": "",
116
        "usb_mouse": "",
117
        "use_chroot": false,
118
        "use_localtime": false,
119
        "vga": "",
120
        "vhost_net": false,
121
        "vnc_bind_address": "",
122
        "vnc_password_file": "",
123
        "vnc_tls": false,
124
        "vnc_x509_path": "",
125
        "vnc_x509_verify": false
126
      },
127
      "lxc": {
128
        "cpu_mask": ""
129
      },
130
      "xen-hvm": {
131
        "acpi": true,
132
        "blockdev_prefix": "hd",
133
        "boot_order": "cd",
134
        "cdrom_image_path": "",
135
        "cpu_cap": 0,
136
        "cpu_mask": "all",
137
        "cpu_weight": 256,
138
        "device_model": "/usr/lib/xen/bin/qemu-dm",
139
        "disk_type": "paravirtual",
140
        "kernel_path": "/usr/lib/xen/boot/hvmloader",
141
        "migration_mode": "non-live",
142
        "migration_port": 8082,
143
        "nic_type": "rtl8139",
144
        "pae": true,
145
        "pci_pass": "",
146
        "reboot_behavior": "reboot",
147
        "use_localtime": false,
148
        "vnc_bind_address": "0.0.0.0",
149
        "vnc_password_file": "/your/vnc-cluster-password"
150
      },
151
      "xen-pvm": {
152
        "blockdev_prefix": "sd",
153
        "bootloader_args": "",
154
        "bootloader_path": "",
155
        "cpu_cap": 0,
156
        "cpu_mask": "all",
157
        "cpu_weight": 256,
158
        "initrd_path": "",
159
        "kernel_args": "ro",
160
        "kernel_path": "/boot/vmlinuz-xenU",
161
        "migration_mode": "live",
162
        "migration_port": 8082,
163
        "reboot_behavior": "reboot",
164
        "root_path": "/dev/xvda1",
165
        "use_bootloader": false
166
      }
167
    },
168
    "ipolicy": {
169
      "disk-templates": [
170
        "sharedfile",
171
        "diskless",
172
        "plain",
173
        "blockdev",
174
        "drbd",
175
        "file",
176
        "rbd"
177
      ],
178
      "max": {
179
        "cpu-count": 8,
180
        "disk-count": 16,
181
        "disk-size": 1048576,
182
        "memory-size": 32768,
183
        "nic-count": 8,
184
        "spindle-use": 12
185
      },
186
      "min": {
187
        "cpu-count": 1,
188
        "disk-count": 1,
189
        "disk-size": 1024,
190
        "memory-size": 128,
191
        "nic-count": 1,
192
        "spindle-use": 1
193
      },
194
      "spindle-ratio": 32.0,
195
      "std": {
196
        "cpu-count": 1,
197
        "disk-count": 1,
198
        "disk-size": 1024,
199
        "memory-size": 128,
200
        "nic-count": 1,
201
        "spindle-use": 1
202
      },
203
      "vcpu-ratio": 1.0
204
    },
205
    "mac_prefix": "aa:bb:cc",
206
    "maintain_node_health": false,
207
    "master_ip": "192.0.2.87",
208
    "master_netdev": "eth0",
209
    "master_netmask": 32,
210
    "master_node": "node1.example.com",
211
    "modify_etc_hosts": true,
212
    "modify_ssh_setup": true,
213
    "mtime": 1361964122.79471,
214
    "ndparams": {
215
      "exclusive_storage": false,
216
      "oob_program": "",
217
      "spindle_count": 1
218
    },
219
    "nicparams": {
220
      "default": {
221
        "link": "br974",
222
        "mode": "bridged"
223
      }
224
    },
225
    "os_hvp": {
226
      "TEMP-Ganeti-QA-OS": {
227
        "xen-hvm": {
228
          "acpi": false,
229
          "pae": true
230
        },
231
        "xen-pvm": {
232
          "root_path": "/dev/sda5"
233
        }
234
      }
235
    },
236
    "osparams": {},
237
    "prealloc_wipe_disks": false,
238
    "primary_ip_family": 2,
239
    "reserved_lvs": [],
240
    "rsahostkeypub": "YOURKEY",
241
    "serial_no": 3189,
242
    "shared_file_storage_dir": "/srv/ganeti/shared-file-storage",
243
    "tags": [
244
      "mytag"
245
    ],
246
    "tcpudp_port_pool": [
247
      32101,
248
      32102,
249
      32103,
250
      32104,
251
      32105
252
    ],
253
    "uid_pool": [],
254
    "use_external_mip_script": false,
255
    "uuid": "dddf8c12-f2d8-4718-a35b-7804daf12a3f",
256
    "volume_group_name": "xenvg"
257
  },
258
  "ctime": 1343869045.605523,
259
  "instances": {
260
    "instance1.example.com": {
261
      "admin_state": "up",
262
      "beparams": {},
263
      "ctime": 1363620258.608976,
264
      "disk_template": "drbd",
265
      "disks": [
266
        {
267
          "children": [
268
            {
269
              "dev_type": "lvm",
270
              "logical_id": [
271
                "xenvg",
272
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_data"
273
              ],
274
              "params": {},
275
              "physical_id": [
276
                "xenvg",
277
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_data"
278
              ],
279
              "size": 1024
280
            },
281
            {
282
              "dev_type": "lvm",
283
              "logical_id": [
284
                "xenvg",
285
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_meta"
286
              ],
287
              "params": {},
288
              "physical_id": [
289
                "xenvg",
290
                "5c390722-6a7a-4bb4-9cef-98d896a8e6b1.disk0_meta"
291
              ],
292
              "size": 128
293
            }
294
          ],
295
          "dev_type": "drbd8",
296
          "iv_name": "disk/0",
297
          "logical_id": [
298
            "node1.example.com",
299
            "node3.example.com",
300
            32100,
301
            0,
302
            0,
303
            "d3c3fd475fcbaf5fd177fb245ac43b71247ada38"
304
          ],
305
          "mode": "rw",
306
          "params": {},
307
          "physical_id": [
308
            "198.51.100.82",
309
            32100,
310
            "198.51.100.84",
311
            32100,
312
            0,
313
            "d3c3fd475fcbaf5fd177fb245ac43b71247ada38"
314
          ],
315
          "size": 1024
316
        }
317
      ],
318
      "hvparams": {},
319
      "hypervisor": "xen-pvm",
320
      "mtime": 1363620320.874901,
321
      "name": "instance1.example.com",
322
      "nics": [
323
        {
324
          "mac": "aa:bb:cc:b2:6e:0b",
325
          "nicparams": {}
326
        }
327
      ],
328
      "os": "busybox",
329
      "osparams": {},
330
      "primary_node": "node1.example.com",
331
      "serial_no": 2,
332
      "uuid": "6c078d22-3eb6-4780-857d-81772e09eef1"
333
    },
334
    "instance2.example.com": {
335
      "admin_state": "up",
336
      "beparams": {},
337
      "ctime": 1355186880.451181,
338
      "disk_template": "plain",
339
      "disks": [
340
        {
341
          "dev_type": "lvm",
342
          "iv_name": "disk/0",
343
          "logical_id": [
344
            "xenvg",
345
            "3e559cd7-1024-4294-a923-a9fd13182b2f.disk0"
346
          ],
347
          "mode": "rw",
348
          "params": {},
349
          "physical_id": [
350
            "xenvg",
351
            "3e559cd7-1024-4294-a923-a9fd13182b2f.disk0"
352
          ],
353
          "size": 102400
354
        }
355
      ],
356
      "hvparams": {},
357
      "hypervisor": "xen-pvm",
358
      "mtime": 1355186898.307642,
359
      "name": "instance2.example.com",
360
      "nics": [
361
        {
362
          "mac": "aa:bb:cc:56:83:fb",
363
          "nicparams": {}
364
        }
365
      ],
366
      "os": "debian-image",
367
      "osparams": {},
368
      "primary_node": "node3.example.com",
369
      "serial_no": 2,
370
      "tags": [],
371
      "uuid": "8fde9f6d-e1f1-4850-9e9c-154966f622f5"
372
    },
373
    "instance3.example.com": {
374
      "admin_state": "up",
375
      "beparams": {},
376
      "ctime": 1354038435.343601,
377
      "disk_template": "plain",
378
      "disks": [
379
        {
380
          "dev_type": "lvm",
381
          "iv_name": "disk/0",
382
          "logical_id": [
383
            "xenvg",
384
            "b27a576a-13f7-4f07-885c-63fcad4fdfcc.disk0"
385
          ],
386
          "mode": "rw",
387
          "params": {},
388
          "physical_id": [
389
            "xenvg",
390
            "b27a576a-13f7-4f07-885c-63fcad4fdfcc.disk0"
391
          ],
392
          "size": 1280
393
        }
394
      ],
395
      "hvparams": {},
396
      "hypervisor": "xen-pvm",
397
      "mtime": 1354224585.700732,
398
      "name": "instance3.example.com",
399
      "nics": [
400
        {
401
          "mac": "aa:bb:cc:5e:5c:75",
402
          "nicparams": {}
403
        }
404
      ],
405
      "os": "debian-image",
406
      "osparams": {},
407
      "primary_node": "node2.example.com",
408
      "serial_no": 4,
409
      "tags": [],
410
      "uuid": "4e091bdc-e205-4ed7-8a47-0c9130a6619f"
411
    }
412
  },
413
  "mtime": 1361984633.373014,
414
  "networks": {
415
    "99f0128a-1c84-44da-90b9-9581ea00c075": {
416
      "ext_reservations": "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
417
      "name": "a network",
418
      "network": "203.0.113.0/24",
419
      "reservations": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
420
      "serial_no": 1,
421
      "uuid": "99f0128a-1c84-44da-90b9-9581ea00c075"
422
    }
423
  },
424
  "nodegroups": {
425
    "5244a46d-7506-4e14-922d-02b58153dde1": {
426
      "alloc_policy": "preferred",
427
      "diskparams": {},
428
      "ipolicy": {
429
        "max": {},
430
        "min": {},
431
        "std": {}
432
      },
433
      "mtime": 1361963775.575009,
434
      "name": "default",
435
      "ndparams": {},
436
      "networks": {},
437
      "serial_no": 125,
438
      "tags": [],
439
      "uuid": "5244a46d-7506-4e14-922d-02b58153dde1"
440
    },
441
    "6c0a8916-b719-45ad-95dd-82192b1e473f": {
442
      "alloc_policy": "preferred",
443
      "diskparams": {},
444
      "ipolicy": {
445
	"disk-templates": [
446
	  "plain"
447
	],
448
	"max": {},
449
	"min": {},
450
	"spindle-ratio": 5.2,
451
	"std": {},
452
	"vcpu-ratio": 3.14
453
      },
454
      "mtime": 1361963775.575009,
455
      "name": "another",
456
      "ndparams": {
457
        "exclusive_storage": true
458
      },
459
      "networks": {},
460
      "serial_no": 125,
461
      "tags": [],
462
      "uuid": "6c0a8916-b719-45ad-95dd-82192b1e473f"
463
    }
464
  },
465
  "nodes": {
466
    "node1.example.com": {
467
      "ctime": 1349722460.022264,
468
      "drained": false,
469
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
470
      "master_candidate": true,
471
      "master_capable": true,
472
      "mtime": 1359986533.353329,
473
      "name": "node1.example.com",
474
      "ndparams": {},
475
      "offline": false,
476
      "powered": true,
477
      "primary_ip": "192.0.2.82",
478
      "secondary_ip": "198.51.100.82",
479
      "serial_no": 197,
480
      "tags": [],
481
      "uuid": "9a12d554-75c0-4cb1-8064-103365145db0",
482
      "vm_capable": true
483
    },
484
    "node2.example.com": {
485
      "ctime": 1343869045.604884,
486
      "drained": false,
487
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
488
      "master_candidate": true,
489
      "master_capable": true,
490
      "mtime": 1358348755.779906,
491
      "name": "node2.example.com",
492
      "ndparams": {},
493
      "offline": false,
494
      "powered": true,
495
      "primary_ip": "192.0.2.83",
496
      "secondary_ip": "198.51.100.83",
497
      "serial_no": 6,
498
      "tags": [],
499
      "uuid": "2ae3d962-2dad-44f2-bdb1-85f77107f907",
500
      "vm_capable": true
501
    },
502
    "node3.example.com": {
503
      "ctime": 1343869205.934807,
504
      "drained": false,
505
      "group": "5244a46d-7506-4e14-922d-02b58153dde1",
506
      "master_candidate": true,
507
      "master_capable": true,
508
      "mtime": 1353019704.885368,
509
      "name": "node3.example.com",
510
      "ndparams": {},
511
      "offline": false,
512
      "powered": true,
513
      "primary_ip": "192.0.2.84",
514
      "secondary_ip": "198.51.100.84",
515
      "serial_no": 2,
516
      "tags": [],
517
      "uuid": "41f9c238-173c-4120-9e41-04ad379b647a",
518
      "vm_capable": true
519
    }
520
  },
521
  "serial_no": 7624,
522
  "version": 2070000
523
}
b/test/py/cfgupgrade_unittest.py
78 78
  def _LoadConfig(self):
79 79
    return serializer.LoadJson(utils.ReadFile(self.config_path))
80 80

  
81
  def _LoadTestDataConfig(self, filename):
82
    return serializer.LoadJson(testutils.ReadTestData(filename))
83

  
81 84
  def _CreateValidConfigDir(self):
82 85
    utils.WriteFile(self.noded_cert_path, data="")
83 86
    utils.WriteFile(self.known_hosts_path, data="")
......
140 143
    utils.WriteFile(self.config_path, data=serializer.DumpJson({}))
141 144
    self.assertRaises(Exception, _RunUpgrade, self.tmpdir, False, True)
142 145

  
146
  def _TestUpgradeFromFile(self, filename, dry_run):
147
    cfg = self._LoadTestDataConfig(filename)
148
    self._TestUpgradeFromData(cfg, dry_run)
149

  
143 150
  def _TestSimpleUpgrade(self, from_version, dry_run,
144 151
                         file_storage_dir=None,
145 152
                         shared_file_storage_dir=None):
......
352 359
  def testUpgradeFrom_2_6(self):
353 360
    self._TestSimpleUpgrade(constants.BuildVersion(2, 6, 0), False)
354 361

  
362
  def testUpgradeFrom_2_7(self):
363
    self._TestSimpleUpgrade(constants.BuildVersion(2, 7, 0), False)
364

  
365
  def testUpgradeFullConfigFrom_2_7(self):
366
    self._TestUpgradeFromFile("cluster_config_2.7.json", False)
367

  
355 368
  def testUpgradeCurrent(self):
356 369
    self._TestSimpleUpgrade(constants.CONFIG_VERSION, False)
357 370

  
......
366 379
    self._TestSimpleUpgrade(constants.CONFIG_VERSION, False)
367 380
    self._RunDowngradeUpgrade()
368 381

  
382
  def testDowngradeFullConfig(self):
383
    """Test for upgrade + downgrade combination."""
384
    # This test can work only with the previous version of a configuration!
385
    # For 2.7, downgrading returns the original file only if group policies
386
    # don't override instance specs, so we need to use an ad-hoc configuration.
387
    oldconfname = "cluster_config_downgraded_2.7.json"
388
    self._TestUpgradeFromFile(oldconfname, False)
389
    _RunUpgrade(self.tmpdir, False, True, downgrade=True)
390
    oldconf = self._LoadTestDataConfig(oldconfname)
391
    newconf = self._LoadConfig()
392
    self.assertEqual(oldconf, newconf)
393

  
394
  def testDowngradeFullConfigBackwardFrom_2_7(self):
395
    """Test for upgrade + downgrade + upgrade combination."""
396
    self._TestUpgradeFromFile("cluster_config_2.7.json", False)
397
    self._RunDowngradeUpgrade()
398

  
369 399
  def _RunDowngradeTwice(self):
370 400
    """Make sure that downgrade is idempotent."""
371 401
    _RunUpgrade(self.tmpdir, False, True, downgrade=True)
......
378 408
    self._TestSimpleUpgrade(constants.CONFIG_VERSION, False)
379 409
    self._RunDowngradeTwice()
380 410

  
411
  def testDowngradeTwiceFullConfigFrom_2_7(self):
412
    self._TestUpgradeFromFile("cluster_config_2.7.json", False)
413
    self._RunDowngradeTwice()
414

  
381 415
  def testUpgradeDryRunFrom_2_0(self):
382 416
    self._TestSimpleUpgrade(constants.BuildVersion(2, 0, 0), True)
383 417

  

Also available in: Unified diff