At Thu, 25 Apr 2013 16:42:34 +0800,
Liu Yuan wrote:
> 
> +/* Delete current working VDI on the snapshot chain */
> +static bool sd_delete(BDRVSheepdogState *s)
> +{
> +    unsigned int wlen = SD_MAX_VDI_LEN, rlen = 0;
> +    SheepdogVdiReq hdr = {
> +        .opcode = SD_OP_DEL_VDI,
> +        .vdi_id = s->inode.vdi_id,
> +        .data_length = wlen,
> +        .flags = SD_FLAG_CMD_WRITE,
> +    };
> +    SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
> +    int fd, ret;
> +
> +    fd = connect_to_sdog(s);
> +    if (fd < 0) {
> +        return false;
> +    }
> +
> +    ret = do_req(fd, (SheepdogReq *)&hdr, s->name, &wlen, &rlen);
> +    closesocket(fd);
> +    if (ret || (rsp->result != SD_RES_SUCCESS &&
> +                rsp->result != SD_RES_NO_VDI)) {
> +        error_report("%s, %s", sd_strerror(rsp->result), s->name);
> +        return false;
> +    }
> +
> +    return true;
> +}

Isn't it better to show an error message when the result code is
SD_RES_NO_VDI?

Thanks,

Kazutaka

Reply via email to