}
newId = *newNumber;
- if (newType != readonlyVolume && newType != backupVolume)
- return EINVAL;
tt = FindTrans(atrans);
if (!tt)
return ENOENT;
error = EINVAL;
goto fail;
}
- if (V_type(originalvp) == readonlyVolume
- && V_parentId(originalvp) != V_parentId(purgevp)) {
- Log("1 Volser: Clone: Volume %u and volume %u were not cloned from the same parent volume; aborted\n", tt->volid, purgeId);
- error = EXDEV;
- goto fail;
- }
- if (V_type(originalvp) == readwriteVolume
- && tt->volid != V_parentId(purgevp)) {
- Log("1 Volser: Clone: Volume %u was not originally cloned from volume %u; aborted\n", purgeId, tt->volid);
+ if (V_parentId(originalvp) != V_parentId(purgevp)) {
+ Log("1 Volser: Clone: Volume %u and volume %u were not originally cloned from the same parent; aborted\n", purgeId, tt->volid);
error = EXDEV;
goto fail;
}
error = EXDEV;
goto fail;
}
- if (V_type(clonevp) != readonlyVolume && V_type(clonevp) != backupVolume) {
- Log("1 Volser: Clone: The \"recloned\" volume must be a read only volume; aborted\n");
- error = EINVAL;
- goto fail;
- }
- if (V_type(originalvp) == readonlyVolume
- && V_parentId(originalvp) != V_parentId(clonevp)) {
- Log("1 Volser: Clone: Volume %u and volume %u were not cloned from the same parent volume; aborted\n", tt->volid, cloneId);
- error = EXDEV;
- goto fail;
- }
- if (V_type(originalvp) == readwriteVolume
- && tt->volid != V_parentId(clonevp)) {
+ if (V_parentId(originalvp) != V_parentId(clonevp)) {
Log("1 Volser: Clone: Volume %u was not originally cloned from volume %u; aborted\n", cloneId, tt->volid);
error = EXDEV;
goto fail;
#define RV_NOVLDB 0x040000
#define RV_NOCLONE 0x080000
#define RV_NODEL 0x100000
+#define RV_RWONLY 0x200000
struct ubik_client;
extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
flags = 0;
if (as->parms[5].items) flags |= RV_OFFLINE;
+ if (as->parms[6].items && as->parms[7].items) {
+ fprintf(STDERR, "vos: cannot specify that a volume be -readwrite and -readonly\n");
+ return EINVAL;
+ }
if (as->parms[6].items) flags |= RV_RDONLY;
+ if (as->parms[7].items) flags |= RV_RWONLY;
code =
"leave clone volume offline");
cmd_AddParm(ts, "-readonly", CMD_FLAG, CMD_OPTIONAL,
"make clone volume read-only, not readwrite");
+ cmd_AddParm(ts, "-readwrite", CMD_FLAG, CMD_OPTIONAL,
+ "make clone volume readwrite, not read-only");
COMMONPARMS;
ts = cmd_CreateSyntax("release", ReleaseVolume, NULL, "release a volume");
afs_int32 error = 0;
int backexists = 1;
volEntries volumeInfo;
+ int type = 0;
aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
} else {
VPRINT1("Creating a new clone %u ...", acloneid);
- code = AFSVolClone(aconn, ttid, 0,
- (flags & RV_RDONLY) ? readonlyVolume : backupVolume,
- aname, &acloneid);
+ if (flags & RV_RWONLY)
+ type = readwriteVolume;
+ else if (flags & RV_RDONLY)
+ type = readonlyVolume;
+ else
+ type = backupVolume;
+
+ code = AFSVolClone(aconn, ttid, 0, type, aname, &acloneid);
if (code) {
fprintf(STDERR, "Failed to clone the volume %lu\n",
(unsigned long)avolid);