try:
for f in os.listdir(XSEGBD_SYSFS + "devices/"):
d_id = open(XSEGBD_SYSFS + "devices/" + f + "/id").read().strip()
- name = open(XSEGBD_SYSFS + "devices/"+ f + "/name").read().strip()
+ name = open(XSEGBD_SYSFS + "devices/"+ f + "/target").read().strip()
if device == DEVICE_PREFIX + d_id:
fd = os.open(XSEGBD_SYSFS + "remove", os.O_WRONLY)
os.write(fd, d_id)
try:
for f in os.listdir(XSEGBD_SYSFS + "devices/"):
d_id = open(XSEGBD_SYSFS + "devices/" + f + "/id").read().strip()
- name = open(XSEGBD_SYSFS + "devices/"+ f + "/name").read().strip()
+ target = open(XSEGBD_SYSFS + "devices/"+ f + "/target").read().strip()
- print "%s\t%s\t%s\t%s\t%s" % (d_id, '-', name, '-', DEVICE_PREFIX +
+ print "%s\t%s\t%s\t%s\t%s" % (d_id, '-', target, '-', DEVICE_PREFIX +
d_id)
except Exception, reason:
print >> sys.stderr, reason
ls_parser.set_defaults(func=vlmc_list)
ls_parser.add_argument('-p', '--pool', type=str, nargs='?', help='for backwards compatiblity with rbd')
- args = parser.parse_args()
-
- #FIXME
- try:
- if args.config == None:
- execfile(os.path.expanduser("~/.xsegrc"))
- else:
- execfile(args.config)
- except:
- pass
+ resize_parser = subparsers.add_parser('resize', help='Resize volume')
+ resize_parser.add_argument('-s', '--size', type=int, nargs=1, help='requested size in MB for resize')
+ resize_parser.add_argument('name', type=str, nargs=1, help='volume/device name')
+ resize_parser.set_defaults(func=vlmc_resize)
+ resize_parser.add_argument('-p', '--pool', type=str, nargs='?', help='for backwards compatiblity with rbd')
+ args = parser.parse_args()
+ loadrc(args.config)
args.func(args)