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

Ruoyu liangry at ucweb.com
Fri Sep 19 08:47:51 CEST 2014


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;
}





More information about the sheepdog mailing list