Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
55ffacfa
Commit
55ffacfa
authored
Mar 09, 2012
by
Iustin Pop
Browse files
Add RAPI shell-level unittest
Signed-off-by:
Iustin Pop
<
iustin@google.com
>
Reviewed-by:
René Nussbaumer
<
rn@google.com
>
parent
d575c755
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
55ffacfa
...
...
@@ -715,6 +715,10 @@ TEST_FILES = \
test
/data/htools/hail-change-group.json
\
test
/data/htools/hail-node-evac.json
\
test
/data/htools/hail-reloc-drbd.json
\
test
/data/htools/rapi/groups.json
\
test
/data/htools/rapi/info.json
\
test
/data/htools/rapi/instances.json
\
test
/data/htools/rapi/nodes.json
\
test
/data/ovfdata/compr_disk.vmdk.gz
\
test
/data/ovfdata/config.ini
\
test
/data/ovfdata/corrupted_resources.ovf
\
...
...
htools/offline-test.sh
View file @
55ffacfa
...
...
@@ -173,4 +173,18 @@ hail -t $T/simu-rebal-merged.standard $TESTDATA_DIR/hail-alloc-drbd.json | \
grep
-q
'"success":true,'
echo
OK
echo
Checking file-based RAPI
mkdir
-p
$T
/hscan
URL
=
"file://
$TESTDATA_DIR
/rapi"
hinfo
-v
-v
-p
--print-instances
-m
$URL
>
/dev/null 2>&1
hbal
-v
-v
-p
--print-instances
-m
$URL
>
/dev/null 2>&1
hscan
-d
$T
/hscan/
-p
-v
-v
$URL
>
/dev/null 2>&1
# check that we file parsing is correct, i.e. hscan saves correct text
# files, and is idempotent (rapi+text == rapi)
HS
=
"
$(
ls
$T
/hscan/
*
.data|head
-n1
)
"
hinfo
-p
--print-instances
-m
$URL
>
$T
/hscan/direct.hinfo 2>&1
hinfo
-p
--print-instances
-t
$HS
>
$T
/hscan/fromtext.hinfo 2>&1
cmp
-s
$T
/hscan/direct.hinfo
$T
/hscan/fromtext.hinfo
echo
OK
echo
All OK
test/data/htools/rapi/groups.json
0 → 100644
View file @
55ffacfa
[
{
"uuid"
:
"uuid-group-1"
,
"tags"
:
[],
"ipolicy"
:
{
"std"
:
{
"cpu-count"
:
1
,
"nic-count"
:
1
,
"disk-size"
:
1024
,
"memory-size"
:
128
,
"disk-count"
:
1
,
"spindle-use"
:
1
},
"min"
:
{
"cpu-count"
:
1
,
"nic-count"
:
1
,
"disk-size"
:
1024
,
"memory-size"
:
128
,
"disk-count"
:
1
,
"spindle-use"
:
1
},
"max"
:
{
"cpu-count"
:
8
,
"nic-count"
:
8
,
"disk-size"
:
1048576
,
"memory-size"
:
32768
,
"disk-count"
:
16
,
"spindle-use"
:
8
},
"vcpu-ratio"
:
4.0
,
"disk-templates"
:
[
"sharedfile"
,
"diskless"
,
"plain"
,
"blockdev"
,
"drbd"
,
"file"
,
"rbd"
],
"spindle-ratio"
:
32.0
},
"node_cnt"
:
4
,
"serial_no"
:
15
,
"node_list"
:
[
"node1"
,
"node2"
,
"node3"
,
"node4"
],
"ctime"
:
null
,
"mtime"
:
1325251614.671967
,
"alloc_policy"
:
"preferred"
,
"name"
:
"default"
}
]
test/data/htools/rapi/info.json
0 → 100644
View file @
55ffacfa
{
"maintain_node_health"
:
true
,
"hvparams"
:
{
"xen-pvm"
:
{
"use_bootloader"
:
false
,
"migration_mode"
:
"live"
,
"kernel_args"
:
"ro"
,
"migration_port"
:
8002
,
"bootloader_args"
:
""
,
"root_path"
:
"/dev/sda1"
,
"blockdev_prefix"
:
"sd"
,
"bootloader_path"
:
""
,
"cpu_mask"
:
"all"
,
"kernel_path"
:
"/boot/vmlinuz-2.6-xenU"
,
"initrd_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"xen-hvm"
:
{
"nic_type"
:
"rtl8139"
,
"use_localtime"
:
false
,
"migration_mode"
:
"non-live"
,
"boot_order"
:
"cd"
,
"migration_port"
:
8002
,
"cpu_mask"
:
"all"
,
"vnc_bind_address"
:
"0.0.0.0"
,
"reboot_behavior"
:
"reboot"
,
"blockdev_prefix"
:
"hd"
,
"cdrom_image_path"
:
""
,
"device_model"
:
"/usr/lib/xen/bin/qemu-dm"
,
"pae"
:
true
,
"vnc_password_file"
:
"/etc/ganeti/vnc-cluster-password"
,
"disk_type"
:
"paravirtual"
,
"kernel_path"
:
"/usr/lib/xen/boot/hvmloader"
,
"acpi"
:
true
}
},
"default_hypervisor"
:
"xen-pvm"
,
"uid_pool"
:
[],
"prealloc_wipe_disks"
:
false
,
"primary_ip_version"
:
4
,
"mtime"
:
1331075221.432734
,
"os_hvp"
:
{
"instance-debootstrap"
:
{
"xen-pvm"
:
{
"root_path"
:
"/dev/xvda1"
,
"kernel_path"
:
"/boot/vmlinuz-2.6.38"
}
}
},
"osparams"
:
{
"debootstrap"
:
{
"dhcp"
:
"no"
,
"partition_style"
:
"none"
,
"packages"
:
"ssh"
}
},
"shared_file_storage_dir"
:
""
,
"master_netmask"
:
32
,
"uuid"
:
"1616c1cc-f793-499c-b1c5-48264c2d2976"
,
"use_external_mip_script"
:
false
,
"export_version"
:
0
,
"hidden_os"
:
[
"lenny"
],
"os_api_version"
:
20
,
"master"
:
"node4"
,
"nicparams"
:
{
"default"
:
{
"link"
:
"xen-br0"
,
"mode"
:
"bridged"
}
},
"protocol_version"
:
2050000
,
"config_version"
:
2050000
,
"software_version"
:
"2.5.0~rc5"
,
"tags"
:
[
"htools:iextags:test"
,
"htools:iextags:service-group"
],
"ipolicy"
:
{
"std"
:
{
"nic-count"
:
1
,
"disk-size"
:
1024
,
"disk-count"
:
1
,
"memory-size"
:
128
,
"cpu-count"
:
1
,
"spindle-use"
:
1
},
"min"
:
{
"nic-count"
:
1
,
"disk-size"
:
128
,
"disk-count"
:
1
,
"memory-size"
:
128
,
"cpu-count"
:
1
,
"spindle-use"
:
1
},
"max"
:
{
"nic-count"
:
8
,
"disk-size"
:
1048576
,
"disk-count"
:
16
,
"memory-size"
:
32768
,
"cpu-count"
:
8
,
"spindle-use"
:
8
},
"vcpu-ratio"
:
4.0
,
"disk-templates"
:
[
"sharedfile"
,
"diskless"
,
"plain"
,
"blockdev"
,
"drbd"
,
"file"
,
"rbd"
],
"spindle-ratio"
:
32.0
},
"candidate_pool_size"
:
3
,
"file_storage_dir"
:
"/srv/ganeti/file-storage"
,
"blacklisted_os"
:
[],
"enabled_hypervisors"
:
[
"xen-pvm"
,
"xen-hvm"
],
"reserved_lvs"
:
[
"xenvg/test"
],
"drbd_usermode_helper"
:
"/bin/true"
,
"default_iallocator"
:
"hail"
,
"ctime"
:
1271079848.3199999
,
"name"
:
"cluster"
,
"master_netdev"
:
"xen-br0"
,
"ndparams"
:
{
"spindle_count"
:
1
,
"oob_program"
:
null
},
"architecture"
:
[
"64bit"
,
"x86_64"
],
"volume_group_name"
:
"xenvg"
,
"beparams"
:
{
"default"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"always_failover"
:
false
,
"maxmem"
:
128
}
}
}
test/data/htools/rapi/instances.json
0 → 100644
View file @
55ffacfa
[
{
"disk_usage"
:
256
,
"oper_vcpus"
:
1
,
"serial_no"
:
7
,
"hvparams"
:
{
"root_path"
:
"/dev/xvda1"
,
"kernel_args"
:
"ro"
,
"blockdev_prefix"
:
"sd"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"cpu_mask"
:
"all"
,
"kernel_path"
:
"/boot/vmlinuz-ganetixenu-2.6.38"
,
"initrd_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"oper_state"
:
true
,
"disk_template"
:
"drbd"
,
"mtime"
:
1330349951.511833
,
"nic.modes"
:
[
"bridged"
],
"oper_ram"
:
128
,
"pnode"
:
"node3"
,
"nic.bridges"
:
[
"xen-br0"
],
"status"
:
"running"
,
"custom_hvparams"
:
{},
"tags"
:
[],
"nic.ips"
:
[
null
],
"snodes"
:
[
"node4"
],
"nic.macs"
:
[
"aa:00:00:73:20:3e"
],
"name"
:
"instance2"
,
"network_port"
:
null
,
"ctime"
:
1327334413.084552
,
"custom_beparams"
:
{},
"custom_nicparams"
:
[
{}
],
"uuid"
:
"4b9ff2a2-3399-4141-b4e1-cde418b1dfec"
,
"disk.sizes"
:
[
128
],
"admin_state"
:
"up"
,
"nic.links"
:
[
"xen-br0"
],
"os"
:
"debian-image"
,
"beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"always_failover"
:
false
,
"maxmem"
:
128
,
"spindle_use"
:
1
}
},
{
"disk_usage"
:
384
,
"oper_vcpus"
:
null
,
"serial_no"
:
6
,
"hvparams"
:
{
"root_path"
:
"/dev/xvda1"
,
"kernel_args"
:
"ro"
,
"blockdev_prefix"
:
"sd"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"cpu_mask"
:
"all"
,
"kernel_path"
:
"/boot/vmlinuz-ganetixenu-2.6.38"
,
"initrd_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"oper_state"
:
false
,
"disk_template"
:
"plain"
,
"mtime"
:
1325681489.4059889
,
"nic.modes"
:
[
"bridged"
],
"oper_ram"
:
null
,
"pnode"
:
"node4"
,
"nic.bridges"
:
[
"xen-br0"
],
"status"
:
"ADMIN_down"
,
"custom_hvparams"
:
{
"root_path"
:
"/dev/xvda1"
,
"kernel_args"
:
"ro"
,
"blockdev_prefix"
:
"sd"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"kernel_path"
:
"/boot/vmlinuz-ganetixenu-2.6.38"
,
"initrd_path"
:
""
},
"tags"
:
[],
"nic.ips"
:
[
null
],
"snodes"
:
[],
"nic.macs"
:
[
"aa:00:00:ec:e8:a2"
],
"name"
:
"instance3"
,
"network_port"
:
null
,
"ctime"
:
1312272250.96
,
"custom_beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"maxmem"
:
128
,
"spindle_use"
:
1
},
"custom_nicparams"
:
[
{
"link"
:
"xen-br0"
,
"mode"
:
"bridged"
}
],
"uuid"
:
"3cecca87-eae7-476c-847c-818a28764989"
,
"disk.sizes"
:
[
256
,
128
],
"admin_state"
:
"down"
,
"nic.links"
:
[
"xen-br0"
],
"os"
:
"debian-image"
,
"beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"always_failover"
:
false
,
"maxmem"
:
128
,
"spindle_use"
:
1
}
},
{
"disk_usage"
:
2176
,
"oper_vcpus"
:
null
,
"serial_no"
:
23
,
"hvparams"
:
{
"root_path"
:
"/dev/xvda1"
,
"kernel_args"
:
"ro"
,
"blockdev_prefix"
:
"sd"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"cpu_mask"
:
"all"
,
"kernel_path"
:
"/boot/vmlinuz-ganetixenu-2.6.38"
,
"initrd_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"oper_state"
:
false
,
"disk_template"
:
"drbd"
,
"mtime"
:
1325681487.384176
,
"nic.modes"
:
[
"bridged"
],
"oper_ram"
:
null
,
"pnode"
:
"node4"
,
"nic.bridges"
:
[
"xen-br0"
],
"status"
:
"ADMIN_down"
,
"custom_hvparams"
:
{},
"tags"
:
[
"service-group:dns"
],
"nic.ips"
:
[
null
],
"snodes"
:
[
"node3"
],
"nic.macs"
:
[
"aa:00:00:62:b0:76"
],
"name"
:
"instance4"
,
"network_port"
:
null
,
"ctime"
:
1274885795.4000001
,
"custom_beparams"
:
{},
"custom_nicparams"
:
[
{}
],
"uuid"
:
"33f4c063-bb65-41b2-af29-d8a631201bd7"
,
"disk.sizes"
:
[
2048
],
"admin_state"
:
"down"
,
"nic.links"
:
[
"xen-br0"
],
"os"
:
"lenny-image"
,
"beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"always_failover"
:
false
,
"maxmem"
:
128
,
"spindle_use"
:
1
}
},
{
"disk_usage"
:
256
,
"oper_vcpus"
:
null
,
"serial_no"
:
9
,
"hvparams"
:
{
"spice_password_file"
:
""
,
"spice_use_tls"
:
false
,
"spice_use_vdagent"
:
true
,
"nic_type"
:
"paravirtual"
,
"vnc_bind_address"
:
"0.0.0.0"
,
"cdrom2_image_path"
:
""
,
"usb_mouse"
:
""
,
"spice_streaming_video"
:
""
,
"use_chroot"
:
false
,
"spice_tls_ciphers"
:
"HIGH:-DES:-3DES:-EXPORT:-ADH"
,
"migration_downtime"
:
30
,
"floppy_image_path"
:
""
,
"security_model"
:
"none"
,
"cdrom_image_path"
:
""
,
"spice_ip_version"
:
0
,
"vhost_net"
:
false
,
"cpu_mask"
:
"all"
,
"disk_cache"
:
"default"
,
"kernel_path"
:
"/boot/vmlinuz-2.6.38-gg426-generic"
,
"initrd_path"
:
"/boot/initrd.img-2.6.38-gg426-generic"
,
"spice_jpeg_wan_compression"
:
""
,
"vnc_tls"
:
false
,
"cdrom_disk_type"
:
""
,
"use_localtime"
:
false
,
"security_domain"
:
""
,
"serial_console"
:
false
,
"spice_bind"
:
""
,
"spice_zlib_glz_wan_compression"
:
""
,
"kvm_flag"
:
""
,
"vnc_password_file"
:
""
,
"disk_type"
:
"paravirtual"
,
"vnc_x509_verify"
:
false
,
"spice_image_compression"
:
""
,
"spice_playback_compression"
:
true
,
"kernel_args"
:
"ro"
,
"root_path"
:
"/dev/vda1"
,
"vnc_x509_path"
:
""
,
"acpi"
:
true
,
"keymap"
:
""
,
"boot_order"
:
"disk"
,
"mem_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"oper_state"
:
false
,
"disk_template"
:
"plain"
,
"mtime"
:
1325681492.191576
,
"nic.modes"
:
[
"bridged"
],
"oper_ram"
:
null
,
"pnode"
:
"node4"
,
"nic.bridges"
:
[
"xen-br0"
],
"status"
:
"ADMIN_down"
,
"custom_hvparams"
:
{},
"tags"
:
[],
"nic.ips"
:
[
null
],
"snodes"
:
[],
"nic.macs"
:
[
"aa:00:00:3f:6d:e3"
],
"name"
:
"instance8"
,
"network_port"
:
12111
,
"ctime"
:
1311771325.6600001
,
"custom_beparams"
:
{},
"custom_nicparams"
:
[
{}
],
"uuid"
:
"1ea53cc3-cc69-43da-b261-f22ac47896ea"
,
"disk.sizes"
:
[
256
],
"admin_state"
:
"down"
,
"nic.links"
:
[
"xen-br0"
],
"os"
:
"debian-image"
,
"beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"always_failover"
:
false
,
"maxmem"
:
128
,
"spindle_use"
:
1
}
},
{
"disk_usage"
:
256
,
"oper_vcpus"
:
null
,
"serial_no"
:
31
,
"hvparams"
:
{
"root_path"
:
"/dev/sda1"
,
"kernel_args"
:
"ro"
,
"blockdev_prefix"
:
"sd"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"cpu_mask"
:
"all"
,
"kernel_path"
:
"/boot/vmlinuz-2.6-xenU"
,
"initrd_path"
:
""
,
"reboot_behavior"
:
"reboot"
},
"oper_state"
:
false
,
"disk_template"
:
"drbd"
,
"mtime"
:
1325681490.685926
,
"nic.modes"
:
[
"bridged"
],
"oper_ram"
:
null
,
"pnode"
:
"node3"
,
"nic.bridges"
:
[
"xen-br0"
],
"status"
:
"ADMIN_down"
,
"custom_hvparams"
:
{
"root_path"
:
"/dev/sda1"
,
"kernel_args"
:
"ro"
,
"use_bootloader"
:
false
,
"bootloader_args"
:
""
,
"bootloader_path"
:
""
,
"kernel_path"
:
"/boot/vmlinuz-2.6-xenU"
,
"initrd_path"
:
""
},
"tags"
:
[
"gogu:test"
],
"nic.ips"
:
[
null
],
"snodes"
:
[
"node4"
],
"nic.macs"
:
[
"aa:00:00:10:d2:01"
],
"name"
:
"instance9"
,
"network_port"
:
null
,
"ctime"
:
1271937489.76
,
"custom_beparams"
:
{
"auto_balance"
:
true
,
"minmem"
:
128
,
"vcpus"
:
1
,
"maxmem"
:
128
,
"spindle_use"
:
1
},
"custom_nicparams"
:
[
{}
],
"uuid"
:
"4927ac66-a3c5-45c6-be39-97e2b119557e"
,
"disk.sizes"
:
[
128