37
37
from nulltype import Null
38
38
39
39
import qubesadmin
40
- import qubesadmin .devices
40
+ import qubesadmin .device_protocol
41
41
import qubesadmin .firewall
42
42
43
43
# Enable logging
@@ -869,7 +869,7 @@ def prefs(vmname, *varargs, **kwargs):
869
869
dest = property_map .get (dest , dest )
870
870
871
871
if dest == 'pcidevs' :
872
- value_current = [str (dev .ident ).replace ('_' , ':' ) for dev
872
+ value_current = [str (dev .port_id ).replace ('_' , ':' ) for dev
873
873
in args .vm .devices ['pci' ].get_assigned_devices (required_only = True )]
874
874
elif dest == 'pci_strictreset' :
875
875
value_current = all (not assignment .options .get ('no-strict-reset' , False )
@@ -920,7 +920,7 @@ def prefs(vmname, *varargs, **kwargs):
920
920
dev_id_api = dev_id .strip ().replace (':' , '_' )
921
921
current_assignment = None
922
922
for a in args .vm .devices ['pci' ].get_assigned_devices (required_only = True ):
923
- if a .ident == dev_id_api :
923
+ if a .port_id == dev_id_api :
924
924
current_assignment = a
925
925
if current_assignment and \
926
926
pci_strictreset is not None and \
@@ -934,7 +934,7 @@ def prefs(vmname, *varargs, **kwargs):
934
934
options = {}
935
935
if pci_strictreset is not None :
936
936
options ['no-strict-reset' ] = not pci_strictreset
937
- assignment = qubesadmin .devices .DeviceAssignment (
937
+ assignment = qubesadmin .device_protocol .DeviceAssignment . new (
938
938
args .vm .app .domains ['dom0' ],
939
939
dev_id_api ,
940
940
devclass = 'pci' ,
@@ -1052,7 +1052,7 @@ def devices(vmname, *varargs, **kwargs):
1052
1052
for device_type in args .vm .devices :
1053
1053
for device in args .vm .devices [device_type ].get_assigned_devices ():
1054
1054
current_devices .append (
1055
- {'device_type' : device_type , 'backend' : device .backend_domain .name , 'dev_id' : device .ident ,
1055
+ {'device_type' : device_type , 'backend' : device .backend_domain .name , 'dev_id' : device .port_id ,
1056
1056
'options' : device .options })
1057
1057
1058
1058
# Return all current devices if a 'list' only was selected
@@ -1100,7 +1100,7 @@ def parse_device(raw_dev):
1100
1100
device_skip = False
1101
1101
message_old = None
1102
1102
for a in args .vm .devices [device_type ].get_assigned_devices ():
1103
- if a .ident == device ['dev_id' ] and a .backend_domain == device ['backend' ]:
1103
+ if a .port_id == device ['dev_id' ] and a .backend_domain == device ['backend' ]:
1104
1104
current_assignment = a
1105
1105
if current_assignment .options != device ['options' ]:
1106
1106
# detach and attach again to adjust options
@@ -1115,11 +1115,11 @@ def parse_device(raw_dev):
1115
1115
msg_options = '(' + ', ' .join ('{}={}' .format (key , value ) for key , value in device ['options' ].items ()) + ')'
1116
1116
if not device_skip :
1117
1117
try :
1118
- assignment = qubesadmin .devices .DeviceAssignment (
1118
+ assignment = qubesadmin .device_protocol .DeviceAssignment . new (
1119
1119
backend_domain = args .vm .app .domains [device ['backend' ]],
1120
- ident = device ['dev_id' ],
1120
+ port_id = device ['dev_id' ],
1121
1121
devclass = device_type ,
1122
- attach_automatically = True , required = True ,
1122
+ mode = " required" ,
1123
1123
options = device ['options' ])
1124
1124
1125
1125
args .vm .devices [device_type ].assign (assignment )
@@ -1142,7 +1142,7 @@ def parse_device(raw_dev):
1142
1142
device_type = device ['device_type' ]
1143
1143
1144
1144
try :
1145
- assignment = qubesadmin .devices .DeviceAssignment (
1145
+ assignment = qubesadmin .device_protocol .DeviceAssignment (
1146
1146
args .vm .app .domains [device ['backend' ]],
1147
1147
device ['dev_id' ],
1148
1148
devclass = device_type )
0 commit comments