Skip to content
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
7 changes: 6 additions & 1 deletion lib/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class TestOptions
:commit, :svvp, :dump, :gthb_context_prefix, :gthb_context_suffix, :playlist,
:select_test_names, :reject_test_names, :reject_report_sections, :boot_device,
:allow_test_duplication, :manual, :package_with_playlist, :enable_vbs, :tag_suffix,
:fs_test_image_format, :extensions
:fs_test_image_format, :extensions, :net_test_speed

def create_parser
OptionParser.new do |parser|
Expand Down Expand Up @@ -218,6 +218,11 @@ def define_options(parser)
parser.on('--extensions <extensions_list>', Array,
'List of extensions for run test',
&method(:extensions=))

parser.on('--net-test-speed <net_test_speed>', Integer,
'Network test speed (in Mbps). Default is 10000.',
'Has effect only when testing virtio-net-pci network device.',
&method(:net_test_speed=))
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
end
Expand Down
2 changes: 1 addition & 1 deletion lib/setupmanagers/qemuhck/devices/virtio-net-pci.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"need_pci_bus": true,
"command_line": [
"-netdev @network_backend@,id=@net_if_name@@netdev_options@",
"-device virtio-net-pci@device_extra_param@@iommu_device_param@,netdev=@net_if_name@,mac=@net_if_mac@@net_addr@,bus=@bus_name@.0,id=@net_if_name@"
"-device virtio-net-pci@device_extra_param@@iommu_device_param@,netdev=@net_if_name@,mac=@net_if_mac@@net_addr@,speed=@speed@,bus=@bus_name@.0,id=@net_if_name@"
]
}
10 changes: 9 additions & 1 deletion lib/setupmanagers/qemuhck/network_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ class NetworkManager
include Helper

CONFIG_JSON = 'lib/setupmanagers/qemuhck/network_manager.json'
DEFAULT_NET_SPEED = 10_000 # 10G

def initialize(id, client_id, machine, logger)
def initialize(id, client_id, machine, qemu_options, logger)
@id = id
@client_id = client_id
@machine = machine
@logger = logger
@dev_id = 0

@net_test_speed = qemu_options['net_test_speed'] || DEFAULT_NET_SPEED

@config = Json.read_json(CONFIG_JSON, @logger)
end

Expand Down Expand Up @@ -67,6 +70,11 @@ def device_command_info(type, device, command_options, dev_pci, qemu_replacement
@dev_id += 1

type_config = @config['devices'][type]
command_options['@speed@'] = if type == 'test'
@net_test_speed
else
DEFAULT_NET_SPEED
end

replacement_map = device_replacement_map(type, device, type_config, dev_pci, qemu_replacement_map)
replacement_map.merge! command_options
Expand Down
2 changes: 1 addition & 1 deletion lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def initialize(options)
init_ports

@pcim = PciManager.new(@logger)
@nm = NetworkManager.new(@id, @client_id, @machine, @logger)
@nm = NetworkManager.new(@id, @client_id, @machine, @options, @logger)
@sm = StorageManager.new(@id, @client_id, @config, @options, @logger)

@devices_list.flatten!
Expand Down
6 changes: 4 additions & 2 deletions lib/setupmanagers/qemuhck/qemuhck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def platform_client_options

def client_vm_common_options
common = @project.options.common
test_opt = @project.options.test
{
'id' => @id.to_i,
'workspace_path' => @workspace_path,
Expand All @@ -96,8 +97,9 @@ def client_vm_common_options
'client_world_net' => common.client_world_net,
'attach_debug_net' => common.attach_debug_net,
'share_on_host_path' => common.share_on_host_path,
'boot_device' => @project.options.test.boot_device,
'fs_test_image_format' => @project.options.test.fs_test_image_format,
'boot_device' => test_opt.boot_device,
'fs_test_image_format' => test_opt.fs_test_image_format,
'net_test_speed' => test_opt.net_test_speed,
'ctrl_net_device' => common.client_ctrl_net_dev
}.compact
end
Expand Down
Loading