from subprocess import call, check_call
BIN_PATH="/usr/bin"
-PIDFILE_PATH="/var/run/archipelagos"
+PIDFILE_PATH="/var/run/archipelago"
DEVICE_PREFIX="/dev/xsegbd"
XSEGBD_SYSFS="/sys/bus/xsegbd/"
STORAGE="File"
try:
- execfile(os.path.expanduser("/etc/default/archipelagos"), globals())
+ execfile(os.path.expanduser("/etc/default/archipelago"), globals())
except:
print "Cannot open defaults"
sys.exit(1)
parser.add_argument('-c', '--config', type=str, nargs='?', help='config file')
subparsers = parser.add_subparsers()
- start_parser = subparsers.add_parser('start', help='Start archipelagos')
+ start_parser = subparsers.add_parser('start', help='Start archipelago')
start_parser.set_defaults(func=start)
- stop_parser = subparsers.add_parser('stop', help='Stop archipelagos')
+ stop_parser = subparsers.add_parser('stop', help='Stop archipelago')
stop_parser.set_defaults(func=stop)
- status_parser = subparsers.add_parser('status', help='Archipelagos status')
+ status_parser = subparsers.add_parser('status', help='Archipelago status')
status_parser.set_defaults(func=status)
- restart_parser = subparsers.add_parser('restart', help='Restart archipelagos')
+ restart_parser = subparsers.add_parser('restart', help='Restart archipelago')
restart_parser.set_defaults(func=restart)
args = parser.parse_args()
return r;
}
-static struct xseg_request * __open_map(struct peer_req *pr, struct map *m)
+static struct xseg_request * __open_map(struct peer_req *pr, struct map *m,
+ uint32_t flags)
{
int r;
xport p;
req->op = X_OPEN;
req->size = block_size;
req->offset = 0;
+ if (!(flags & MF_FORCE))
+ req->flags = XF_NOSYNC;
r = xseg_set_req_data(peer->xseg, req, pr);
if (r < 0){
XSEGLOG2(&lc, E, "Cannot set request data for map %s",
return NULL;
}
-static int open_map(struct peer_req *pr, struct map *map)
+static int open_map(struct peer_req *pr, struct map *map, uint32_t flags)
{
int err;
struct xseg_request *req;
struct peerd *peer = pr->peer;
map->flags |= MF_MAP_OPENING;
- req = __open_map(pr, map);
+ req = __open_map(pr, map, flags);
if (!req)
return -1;
wait_on_pr(pr, (!((req->state & XS_FAILED)||(req->state & XS_SERVED))));
static int open_load_map(struct peer_req *pr, struct map *map, uint32_t flags)
{
int r, opened = 0;
-retry_open:
if (flags & MF_EXCLUSIVE){
- r = open_map(pr, map);
+ r = open_map(pr, map, flags);
if (r < 0) {
if (flags & MF_FORCE){
-
- goto retry_open;
+ return -1;
}
} else {
opened = 1;
}
while(rados_lock(rados->ioctx, rio->obj_name) < 0){
- if (!(pr->req->flags & XF_NOSYNC)){
+ if (pr->req->flags & XF_NOSYNC){
XSEGLOG2(&lc, E, "Rados lock failed for %s",
rio->obj_name);
fail(pr->peer, pr);
#FIXME
try:
if rc == None:
- execfile(os.path.expanduser("/etc/defaut/archipelago"), globals())
+ execfile(os.path.expanduser("/etc/default/archipelago"), globals())
else:
execfile(rc, globals())
except: