Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush stor #486

Merged
merged 4 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions bin/fake-snmp-reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Intended to be usable as a standalone script
# it is not a part of the AutoHCK module

require 'json'
require 'logger'
require 'socket'

@logger = Logger.new('fake-snmp-reset.txt')

qmp_socket_file = ARGV[0]

def send_cmd(qmp_socket, cmd)
@logger.info "Sending #{cmd} via QMP"
qmp_socket.write JSON.dump({ 'execute' => cmd })
qmp_socket.flush

loop do
response = JSON.parse(qmp_socket.readline)
break response['return'] if response.key?('return')

@logger.error(response['error'].to_s) if response.key?('error')
end
end

count = 0

@logger.info 'Initializing UDP socket'
UDPSocket.open do |socket|
socket.bind('0.0.0.0', 'snmp')
@logger.info "Listening on #{socket.local_address.inspect_sockaddr}"

loop do
_, addr = socket.recvfrom(0)
@logger.info "Received data from #{addr[3]}:#{addr[1]}"

# Emulate that we do not get the UDP packet immediately
sleep 2

@logger.info "Initializing QMP session for #{qmp_socket_file}"
UNIXSocket.open(qmp_socket_file) do |qmp_socket|
send_cmd(qmp_socket, 'qmp_capabilities')
send_cmd(qmp_socket, 'system_reset')
count += 1
@logger.info "Rebooting... #{count}"
end
end
end
4 changes: 4 additions & 0 deletions bin/ns_unshared
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ module AutoHCK
%w[ip link set br_world up],
%w[ip route add default via 10.0.2.2],
%w[ip link add br_ctrl type bridge],
# See HLK-Setup-Scripts IP configuration
# https://github.com/HCK-CI/HLK-Setup-Scripts/blob/master/client.ps1
# needed for access to host without full Internet access
%w[ip addr add 192.168.100.100/24 dev br_ctrl],
%w[ip link set br_ctrl up],
%w[ip link add br_test type bridge],
%w[ip link set br_test up]
Expand Down
1 change: 0 additions & 1 deletion lib/engines/hcktest/drivers/vioscsi.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}
],
"reject_test_names": [
"Flush Test",
"DF - Embedded Signature Verification Test (Certification)",
"DF - Embedded Signature Verification Test (Tuning and Validation)",
"Storage HBA Firmware Update",
Expand Down
1 change: 0 additions & 1 deletion lib/engines/hcktest/drivers/viostor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}
],
"reject_test_names": [
"Flush Test",
"DF - Embedded Signature Verification Test (Certification)",
"DF - Embedded Signature Verification Test (Tuning and Validation)",
"Thin Provisioning SCSI Compliance Test (LOGO)",
Expand Down
15 changes: 15 additions & 0 deletions lib/engines/hcktest/hcktest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@
"value": 0
}
]
},
{
"tests": [
"Flush Test"
],
"parameters": [
{
"name": "IP",
"value": "192.168.100.100"
},
{
"name": "Outlet",
"value": "161"
}
]
}
]
}
11 changes: 10 additions & 1 deletion lib/setupmanagers/qemuhck/devices/virtio-blk-pci.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "virtio-blk-pci",
"type": "storage",
"define_variables": {
"@blk_qmp_socket@": "blk_qmp_@run_id@_@client_id@_sock"
},
"pre_start_commands": [
"rm -vf @blk_qmp_socket@",
"@source@/bin/fake-snmp-reset @blk_qmp_socket@ &"
],
"command_line": [
"-drive file=@image_path@,if=none,format=@image_format@,id=virtio_blk_@run_id@_@client_id@@drive_cache_options@",
"-device virtio-blk-pci@device_extra_param@@iommu_device_param@,bus=@[email protected],drive=virtio_blk_@run_id@_@client_id@,serial=@client_id@blk@run_id@@bootindex@"
"-device virtio-blk-pci@device_extra_param@@iommu_device_param@,bus=@[email protected],drive=virtio_blk_@run_id@_@client_id@,serial=@client_id@blk@run_id@@bootindex@",
"-chardev socket,id=blk_qmp,path=@blk_qmp_socket@,server=on,wait=off",
"-mon chardev=blk_qmp,mode=control"
]
}
11 changes: 10 additions & 1 deletion lib/setupmanagers/qemuhck/devices/virtio-scsi-pci.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"name": "virtio-scsi-pci",
"type": "storage",
"define_variables": {
"@scsi_qmp_socket@": "scsi_qmp_@run_id@_@client_id@_sock"
},
"pre_start_commands": [
"rm -vf @scsi_qmp_socket@",
"@source@/bin/fake-snmp-reset @scsi_qmp_socket@ &"
],
"command_line": [
"-drive file=@image_path@,if=none,format=@image_format@,id=virtio_scsi_@run_id@_@client_id@@drive_cache_options@",
"-device virtio-scsi-pci@device_extra_param@@iommu_device_param@,id=scsi,bus=@[email protected]",
"-device scsi-hd,drive=virtio_scsi_@run_id@_@client_id@,serial=@client_id@scsi@run_id@@bootindex@"
"-device scsi-hd,drive=virtio_scsi_@run_id@_@client_id@,serial=@client_id@scsi@run_id@@bootindex@",
"-chardev socket,id=scsi_qmp,path=@scsi_qmp_socket@,server=on,wait=off",
"-mon chardev=scsi_qmp,mode=control"
]
}
Loading