components/openstack/nova/files/solariszones/driver.py
changeset 5948 bfd525bc0bf2
parent 5847 230bb7c2a9fb
child 5949 eefd43fe9fc4
equal deleted inserted replaced
5947:d9fcc08e98bf 5948:bfd525bc0bf2
   840             if entry['connection_info'] is None:
   840             if entry['connection_info'] is None:
   841                 continue
   841                 continue
   842 
   842 
   843             if entry['device_name'] == rootmp:
   843             if entry['device_name'] == rootmp:
   844                 root_ci = jsonutils.loads(entry['connection_info'])
   844                 root_ci = jsonutils.loads(entry['connection_info'])
       
   845                 # Let's make sure this is a well formed connection_info, by
       
   846                 # checking if it has a serial key that represents the volume_id.
       
   847                 # If not check to see if the block device has a volume_id, if so
       
   848                 # then assign this to the root_ci.serial.
       
   849                 #
       
   850                 # If we cannot repair the connection_info then simply do not
       
   851                 # return a root_ci and let the caller decide if they want to
       
   852                 # fail or not.
       
   853                 if root_ci.get('serial') is None:
       
   854                     if entry.get('volume_id') is not None:
       
   855                         root_ci['serial'] = entry['volume_id']
       
   856                     else:
       
   857                         LOG.debug(_("Unable to determine the volume id for "
       
   858                                     "the connection info for the root device "
       
   859                                     "for instance '%s'") % instance['name'])
       
   860                         root_ci = None
       
   861 
   845                 continue
   862                 continue
   846 
   863 
   847             if not recreate:
   864             if not recreate:
   848                 ci = jsonutils.loads(entry['connection_info'])
   865                 ci = jsonutils.loads(entry['connection_info'])
   849                 self.detach_volume(ci, instance, entry['device_name'])
   866                 self.detach_volume(ci, instance, entry['device_name'])