def _delete_target(self): LOG.debug("Virtman: start to remove target %s (%s)" % (self.target_id, self.image_name)) iscsi.remove_iscsi_target(self.image_name, self.image_name) self.has_target = False LOG.debug("Virtman: successful remove target %s (%s)" % (self.target_id, self.image_name))
def delete_target(base_image): """ :type base_image: BlockDeviceBaseImage """ if base_image.has_target: LOG.debug("Virtman: start to remove target %s (%s)" % (base_image.target_id, base_image.image_name)) iscsi.remove_iscsi_target(base_image.image_name, base_image.image_name) LOG.debug("Virtman: successful remove target %s (%s)" % (base_image.target_id, base_image.image_name)) base_image.has_target = False base_image.target_id = 0
def destroy_image_target(image_name): """ :returns : string "0:info" specifies SUCCESS, info="nothing", nothing is None "1:info" specifies WARNING, info indicates image_name not exists """ LOG.debug("Virtman: Image Service: remove image target started! " "image_name = %s" % image_name) if not image_name.startswith("volume-"): image_name = "volume-" + image_name if image_name not in targetlist: LOG.warn("Virtman: Image Service: Warning! " "image_name = %s not exists!" % image_name) return "1:" + "Virtman: Image Service: Warning! " \ "image_name = %s not exists!" % image_name iscsi.remove_iscsi_target(image_name, image_name) blockservice.unlinkloop(targetlist[image_name].split(':')[1]) del targetlist[image_name] LOG.debug("Virtman: Image Service: remove image target completed!") return "0:"