[sheepdog] [PATCH v2] dog: allow vdi snapshot without snapshot tag

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Sep 19 10:00:20 CEST 2014


At Fri, 19 Sep 2014 14:47:51 +0800,
Ruoyu wrote:
> 
> 
> On 2014年09月19日 11:59, Hitoshi Mitake wrote:
> >
> >> It is OK if empty snapshot tag "" is allowed.
> >> I am afraid whether empty snapshot tag could cause an unexpected problem.
> > I believe empty tags cause no problems. Because looking up snapshots
> > with "" tag isn't allowed. Actually, this rule isn't changed for a
> > long time.
> I agree with you on this behavior.
> But on second thought, it is better to rework the switch ... case ...
> statement something like as below because the current function
> find_vdi_name() may return other results.
> Once the return value is not SD_RES_SUCCESS, for example, SD_RES_EIO,
> the variable vid is not initialized. It might cause other unexpected
> problem.
> 
> ret = find_vdi_name(vdiname, snapid, tag, &vid);
> switch (ret) {
> case SD_RES_NO_TAG:
> break;
> case SD_RES_SUCCESS:
> /* check if the vdi is snapshot. if yes, return failure, otherwise,
> allow continue */
> break;
> default:
> /* including SD_RES_NO_VDI, SD_RES_EIO, etc. */
> sd_err("Failed to create snapshot for %s: %s",
> vdiname, sd_strerror(ret));
> return EXIT_FAILURE;
> }
> 
> 

Seems good. I'll rework the switch statement. But I want to write the
case of SD_RES_SUCCESS out of the statement for reducing indent.

Thanks,
Hitoshi



More information about the sheepdog mailing list