6
6
use anyhow:: Context ;
7
7
use disk_backend_resources:: layer:: RamDiskLayerHandle ;
8
8
use disk_backend_resources:: LayeredDiskHandle ;
9
- use gdma_resources:: GdmaDeviceHandle ;
10
- use gdma_resources:: VportDefinition ;
11
9
use guid:: Guid ;
12
10
use hvlite_defs:: config:: DeviceVtl ;
13
11
use hvlite_defs:: config:: VpciDeviceConfig ;
@@ -16,7 +14,6 @@ use mesh::rpc::RpcSend;
16
14
use nvme_resources:: NamespaceDefinition ;
17
15
use nvme_resources:: NvmeControllerHandle ;
18
16
use petri:: openvmm:: PetriVmConfigOpenVmm ;
19
- use petri:: openvmm:: PetriVmOpenVmm ;
20
17
use petri:: pipette:: cmd;
21
18
use petri:: pipette:: PipetteClient ;
22
19
use petri:: OpenHclServicingFlags ;
@@ -48,52 +45,11 @@ async fn validate_mana_nic(agent: &PipetteClient) -> Result<(), anyhow::Error> {
48
45
Ok ( ( ) )
49
46
}
50
47
51
- /// Boot an OpenHCL Linux direct VM with a MANA nic assigned to VTL2 (backed by
52
- /// the MANA emulator), and vmbus relay. This should expose a nic to VTL0 via
53
- /// vmbus.
54
- async fn boot_openhcl_linux_mana_nic (
55
- config : PetriVmConfigOpenVmm ,
56
- ) -> Result < ( PetriVmOpenVmm , PipetteClient ) , anyhow:: Error > {
57
- const MANA_INSTANCE : Guid = Guid :: from_static_str ( "27b553e8-8b39-411b-a55f-839971a7884f" ) ;
58
-
59
- let ( vm, agent) = config
60
- . with_vmbus_redirect ( )
61
- . with_custom_config ( |c| {
62
- c. vpci_devices . push ( VpciDeviceConfig {
63
- vtl : DeviceVtl :: Vtl2 ,
64
- instance_id : MANA_INSTANCE ,
65
- resource : GdmaDeviceHandle {
66
- vports : vec ! [ VportDefinition {
67
- mac_address: [ 0x00 , 0x15 , 0x5D , 0x12 , 0x12 , 0x12 ] . into( ) ,
68
- endpoint: net_backend_resources:: consomme:: ConsommeHandle { cidr: None }
69
- . into_resource( ) ,
70
- } ] ,
71
- }
72
- . into_resource ( ) ,
73
- } ) ;
74
- } )
75
- . with_custom_vtl2_settings ( |v| {
76
- v. dynamic
77
- . as_mut ( )
78
- . unwrap ( )
79
- . nic_devices
80
- . push ( vtl2_settings_proto:: NicDeviceLegacy {
81
- instance_id : MANA_INSTANCE . to_string ( ) ,
82
- subordinate_instance_id : None ,
83
- max_sub_channels : None ,
84
- } )
85
- } )
86
- . run ( )
87
- . await ?;
88
-
89
- Ok ( ( vm, agent) )
90
- }
91
-
92
48
/// Test an OpenHCL Linux direct VM with a MANA nic assigned to VTL2 (backed by
93
49
/// the MANA emulator), and vmbus relay.
94
50
#[ openvmm_test( openhcl_linux_direct_x64) ]
95
51
async fn mana_nic ( config : PetriVmConfigOpenVmm ) -> Result < ( ) , anyhow:: Error > {
96
- let ( vm, agent) = boot_openhcl_linux_mana_nic ( config) . await ?;
52
+ let ( vm, agent) = config. with_vmbus_redirect ( ) . with_nic ( ) . run ( ) . await ?;
97
53
98
54
validate_mana_nic ( & agent) . await ?;
99
55
@@ -108,10 +64,12 @@ async fn mana_nic(config: PetriVmConfigOpenVmm) -> Result<(), anyhow::Error> {
108
64
/// the shared pool dma path.
109
65
#[ openvmm_test( openhcl_linux_direct_x64) ]
110
66
async fn mana_nic_shared_pool ( config : PetriVmConfigOpenVmm ) -> Result < ( ) , anyhow:: Error > {
111
- let ( vm, agent) = boot_openhcl_linux_mana_nic (
112
- config. with_openhcl_command_line ( "OPENHCL_ENABLE_SHARED_VISIBILITY_POOL=1" ) ,
113
- )
114
- . await ?;
67
+ let ( vm, agent) = config
68
+ . with_vmbus_redirect ( )
69
+ . with_nic ( )
70
+ . with_openhcl_command_line ( "OPENHCL_ENABLE_SHARED_VISIBILITY_POOL=1" )
71
+ . run ( )
72
+ . await ?;
115
73
116
74
validate_mana_nic ( & agent) . await ?;
117
75
@@ -126,7 +84,12 @@ async fn mana_nic_shared_pool(config: PetriVmConfigOpenVmm) -> Result<(), anyhow
126
84
/// nic is still functional.
127
85
#[ openvmm_test( openhcl_linux_direct_x64) ]
128
86
async fn mana_nic_servicing ( config : PetriVmConfigOpenVmm ) -> Result < ( ) , anyhow:: Error > {
129
- let ( mut vm, agent) = boot_openhcl_linux_mana_nic ( config) . await ?;
87
+ let ( mut vm, agent) = config
88
+ . with_vmbus_redirect ( )
89
+ . with_nic ( )
90
+ . with_openhcl_command_line ( "OPENHCL_ENABLE_SHARED_VISIBILITY_POOL=1" )
91
+ . run ( )
92
+ . await ?;
130
93
131
94
validate_mana_nic ( & agent) . await ?;
132
95
0 commit comments