Example #1
0
func (os *OpenStack) GetImage(imageID string) (*compute.Image, error) {
	apiImage, err := image.Get(os.ImageClient, imageID).Extract()
	if err != nil {
		return nil, err
	} else {
		return os.mapImage(apiImage), nil
	}
}
Example #2
0
func (this *OpenStack) ImageInfo(imageIdentification string) (*lobster.ImageInfo, error) {
	osImage, err := image.Get(this.ImageClient, imageIdentification).Extract()
	if err != nil {
		return nil, err
	}

	image := new(lobster.ImageInfo)
	image.Size, _ = strconv.ParseInt(osImage.Size, 10, 64)
	if osImage.Status == "active" {
		image.Status = lobster.ImageActive
	} else if osImage.Status == "error" || osImage.Status == "killed" {
		image.Status = lobster.ImageError
	} else {
		image.Status = lobster.ImagePending
	}
	return image, nil
}