@@ -64,7 +64,11 @@ pkgs.nixosTest {
6464 if status != 0:
6565 continue
6666 compute_nodes = json.loads(out)
67- if len(net_agents) == 4 and len(compute_nodes) == 1 and compute_nodes[0].get("Host","None") == "computeVM":
67+ status, out = controllerVM.execute("openstack volume service list -f json")
68+ if status != 0:
69+ continue
70+ storage_nodes = json.loads(out)
71+ if len(storage_nodes) == 2 and len(net_agents) == 4 and len(compute_nodes) == 1 and compute_nodes[0].get("Host","None") == "computeVM":
6872 return True
6973 return False
7074
@@ -107,6 +111,10 @@ pkgs.nixosTest {
107111 controllerVM.wait_for_unit("nova-scheduler.service")
108112 controllerVM.wait_for_unit("nova-conductor.service")
109113
114+ # check all services on storageVM
115+ storageVM.wait_for_unit("tgtd.service")
116+ storageVM.wait_for_unit("cinder-volume.service")
117+
110118 assert wait_for_openstack()
111119
112120 controllerVM.succeed("systemctl start nova-host-discovery.service")
@@ -126,5 +134,19 @@ pkgs.nixosTest {
126134 # Ping the OpenStack VM from the controller host. We use the network
127135 # namespace dedicated for the VM to ping it.
128136 assert retry_until_succeed(controllerVM, f"ip netns exec {net_ns} ping -c 1 {vm_ip}", 30)
137+
138+ # create volume with 4GB
139+ controllerVM.execute("openstack volume create --size 4 test_vol")
140+ # attach volume to VM
141+ controllerVM.execute("openstack server add volume test_vm test_vol")
142+ # wait until volume is attached
143+ time.sleep(20)
144+
145+ retry_until_succeed(controllerVM, f"ip netns exec {net_ns} sshpass -p gocubsgo ssh cirros@{vm_ip} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null lsblk", 60)
146+ # check second block device of VM
147+ status, output = controllerVM.execute(f"ip netns exec {net_ns} sshpass -p gocubsgo ssh cirros@{vm_ip} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null lsblk | grep vdb")
148+ output = output.strip()
149+ assert status == 0
150+ assert output == "vdb 252:16 0 4G 0 disk"
129151 '' ;
130152}
0 commit comments