struct msghdr msg;
size_t ctrllen;
unsigned char control[128];
+ int ret;
/* request an operation */
ctrllen = 0;
printf("]\n");
for (j = 0; j < msg.msg_iovlen; j++) {
- printf("IOV[%02u] %04zu [", i, msg.msg_iov[j].iov_len);
+ printf("IOV[%02u] %04zu [", j, msg.msg_iov[j].iov_len);
p = (const void *)msg.msg_iov[j].iov_base;
for (i = 0; i < msg.msg_iov[j].iov_len; i++)
printf("%02x", *p++);
printf("FLAGS %x\n", msg.msg_flags);
}
- return sendmsg(z_conn->fd, &msg, 0) == -1 ? -1 : 0;
+ ret = sendmsg(z_conn->fd, &msg, 0) == -1 ? -1 : 0;
+ if (0) {
+ printf("SENDMSG: %d\n", ret);
+ }
+ return ret;
}
/*
unsigned char control[128];
int ret;
+ if (0) {
+ printf("%s(,{%u,%s,%u/%u})\n",
+ __func__, call->phase, call->got_eor ? "EOR" : "-",
+ CIRC_CNT(call->head, call->tail, call->size), call->size);
+ }
+
/* wait for a reply */
while (!call->got_eor &&
CIRC_CNT(call->head, call->tail, call->size) < call->need_size
if (head >= tail) {
piov->iov_base = (void *)call->reply + head;
piov->iov_len = size - head;
+ if (piov->iov_len > space)
+ piov->iov_len = space;
+ space -= piov->iov_len;
piov++;
- space -= size - (head & mask);
if (space > 0) {
piov->iov_base = (void *)call->reply;
piov->iov_len = space;
msg.msg_controllen = sizeof(control);
msg.msg_flags = 0;
+ if (0) {
+ unsigned i;
+ for (i = 0; i < msg.msg_iovlen; i++)
+ printf("RECV IOV[%02u] %04zu\n", i, msg.msg_iov[i].iov_len);
+ }
+
ret = recvmsg(z_conn->fd, &msg, 0);
+ if (0) {
+ printf("RECVMSG: %d\n", ret);
+ }
if (ret == -1)
return -1;
+ if (ret > 0)
+ call->head += ret;
//printf("RECV: %d [fl:%d]\n", ret, msg.msg_flags);
//printf("CMSG: %zu\n", msg.msg_controllen);
break;
}
}
-
- call->head += ret;
}
return 0;
if ret:
raise RuntimeError("Abort occurred {:d}".format(ret));
+ servers = set();
+
for i in vldblist:
print("[", i.name, "]");
print("\tnum\t", i.nServers);
print("\ttype\t", i.volumeType);
print("\tvid\t", i.volumeId);
print("\tflags\t {:x}".format(i.flags));
+ for j in i.serverNumber:
+ if j:
+ servers.add(j);
+
+ # Pick an arbitrary server serving that volume and find out what volumes
+ # that server serves
+ attributes = kafs.new_VldbListByAttributes();
+ attributes.Mask = kafs.VLLIST_SERVER;
+ attributes.server = servers.pop();
+ nentries = [];
+ blkentries = [];
+ ret = kafs.VL_ListAttributes(z_conn, attributes, nentries, blkentries)
+ if ret:
+ raise RuntimeError("Abort occurred {:d}".format(ret));
+
+ for i in blkentries:
+ print("->", i.name);