Exemplo n.º 1
0
func (device *Device) deleteImage(uuid string) error {
	cfgName, err := getImageCfgName(uuid)
	if err != nil {
		return err
	}
	return util.RemoveConfig(device.Root, cfgName)
}
Exemplo n.º 2
0
func removeConfigFile(root, id string) error {
	cfgName := getCfgName(id)
	if err := util.RemoveConfig(root, cfgName); err != nil {
		return err
	}
	log.Debug("Removed ", cfgName)
	return nil
}
Exemplo n.º 3
0
func (s *Server) deleteVolume(volume *Volume) error {
	cfgName, err := getVolumeCfgName(volume.UUID)
	if err != nil {
		return err
	}
	if err := util.RemoveConfig(s.Root, cfgName); err != nil {
		return err
	}
	if volume.Name != "" {
		if _, exists := s.NameVolumeMap[volume.Name]; !exists {
			log.Errorf("BUG: Volume name %v assign to %v, but doesn't exist in cache", volume.Name, volume.UUID)
			return fmt.Errorf("BUG: Volume name %v assign to %v, but doesn't exist in cache", volume.Name, volume.UUID)

		}
		delete(s.NameVolumeMap, volume.Name)
	}
	return nil
}