@@ -1990,24 +1990,33 @@ class GetRoCEPropertiesTask(task.Task):
1990
1990
def __init__ (self , client , * args , ** kwargs ):
1991
1991
super (GetRoCEPropertiesTask , self ).__init__ (* args , ** kwargs )
1992
1992
self .client = client
1993
+
1994
+ @staticmethod
1995
+ def _set_de_replicas (mapping_info ):
1996
+ portals = mapping_info .get ('portals' )
1997
+ if len (portals ) == 1 :
1998
+ return
1993
1999
1994
- def execute ( self , target_ips , host_id , lun_id , lun_info ):
1995
- host_lun_info = self . client . get_hostlun_info ( host_id , lun_id )
1996
- if not host_lun_info :
1997
- msg = _ ( "No hostlun information between host %(host_id)s and lun %(lun_id)s." % {
1998
- 'host_id ' : host_id ,
1999
- 'lun_id ' : lun_id
2000
+ dm_replicas = []
2001
+ for portal in portals :
2002
+ dm_replicas . append ({
2003
+ 'target_nqn' : mapping_info . get ( 'target_nqn' ),
2004
+ 'vol_uuid ' : mapping_info . get ( 'vol_uuid' ) ,
2005
+ 'portals ' : [ portal ]
2000
2006
})
2001
- LOG .error (msg )
2002
- raise exception .VolumeBackendAPIException (data = msg )
2003
- host_lun_id = host_lun_info [0 ]['hostLunId' ]
2007
+ mapping_info .update ({
2008
+ 'dm_replicas' : dm_replicas
2009
+ })
2010
+
2011
+ def execute (self , target_ips , host_id , lun_id , lun_info , lun ):
2004
2012
mapping_info = {
2013
+ 'vol_uuid' : lun .id ,
2005
2014
'portals' : [(ip , constants .ROCE_TARGET_PORT , 'rdma' ) for ip in target_ips ],
2006
- 'target_luns' : [host_lun_id ] * len (target_ips ),
2007
2015
'target_nqn' : constants .ROCE_TARGET_NQN_PREFIX + self .client ._login_device_id ,
2008
2016
'discard' : True ,
2009
2017
'volume_nguid' : lun_info .get ('NGUID' )
2010
2018
}
2019
+ self ._set_de_replicas (mapping_info )
2011
2020
return mapping_info
2012
2021
2013
2022
0 commit comments