Commit 59b1c489 authored by Mike Hibler's avatar Mike Hibler

Pass PERMS= param in storageconfig command.

For persistent blockstores, is based on the value of the "readonly"
virt_blockstore_attributes attribute if it exists. The RO attribute
is set by libvtop when an attempt is made to use a lease that is in
the 'grace' state.
parent 0f14299c
......@@ -4450,7 +4450,7 @@ sendstoreconf(int sock, int tcp, tmcdreq_t *reqp, char *bscmd, char *vname,
char iqn[BS_IQN_MAXSIZE];
char *mynodeid;
char *class, *protocol, *placement, *mountpoint, *lease;
int nrows, nattrs;
int nrows, nattrs, ro;
/* Remember the nodeid we care about up front. */
mynodeid = reqp->isvnode ? reqp->vnodeid : reqp->nodeid;
......@@ -4471,6 +4471,7 @@ sendstoreconf(int sock, int tcp, tmcdreq_t *reqp, char *bscmd, char *vname,
grab some additional attributes. */
nrows = nattrs = (int) mysql_num_rows(res);
class = protocol = placement = mountpoint = lease = "\0";
ro = 0;
while (nrows--) {
char *key, *val;
row = mysql_fetch_row(res);
......@@ -4486,6 +4487,8 @@ sendstoreconf(int sock, int tcp, tmcdreq_t *reqp, char *bscmd, char *vname,
mountpoint = val;
} else if (strcmp(key,"lease") == 0) {
lease = val;
} else if (strcmp(key,"readonly") == 0) {
ro = (strcmp(val, "0") == 0) ? 0 : 1;
}
}
......@@ -4506,6 +4509,7 @@ sendstoreconf(int sock, int tcp, tmcdreq_t *reqp, char *bscmd, char *vname,
bufp += OUTPUT(bufp, ebufp-bufp,
"%s CLASS=%s PROTO=%s UUID=%s UUID_TYPE=iqn",
bscmd, class, protocol, iqn);
bufp += OUTPUT(bufp, ebufp-bufp, " PERMS=%s", ro? "RO" : "RW");
if (strlen(mountpoint)) {
bufp += OUTPUT(bufp, ebufp-bufp, " MOUNTPOINT=%s",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment