def test_check_for_export_with_vblade_process_missing(self): """Output a warning message when some vblade processes aren't running.""" volume_id_list = self._attach_volume() # the first vblade process isn't running self.output = self.output.replace("run", "down", 1) (shelf_id, blade_id) = db.volume_get_shelf_and_blade(self.context, volume_id_list[0]) msg_is_match = False self.stream.truncate(0) try: self.volume.check_for_export(self.context, self.instance_id) except exception.ProcessExecutionError, e: volume_id = volume_id_list[0] msg = _("Cannot confirm exported volume id:%(volume_id)s. " "vblade process for e%(shelf_id)s.%(blade_id)s " "isn't running.") % locals() msg_is_match = (0 <= e.message.find(msg))
def _attach_volume(self): """Attach volumes to an instance. This function also sets a fake log message.""" volume_id_list = [] for index in xrange(3): vol = {} vol['size'] = 0 volume_id = db.volume_create(self.context, vol)['id'] self.volume.create_volume(self.context, volume_id) # each volume has a different mountpoint mountpoint = "/dev/sd" + chr((ord('b') + index)) db.volume_attached(self.context, volume_id, self.instance_id, mountpoint) (shelf_id, blade_id) = db.volume_get_shelf_and_blade(self.context, volume_id) self.output += "%s %s eth0 /dev/nova-volumes/vol-foo auto run\n" \ % (shelf_id, blade_id) volume_id_list.append(volume_id) return volume_id_list