patch includes support for xml ipc at the backend, and many changes inside the gluster utilities, Likewise changes inside GlusterHPC and EP. parted version has been upgraded to 1.7.0, patch for parted print is also attached. -Harshavardhana http://harsha.80x25.org/
diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterHPC/GlusterHPC GlusterHPC/GlusterHPC --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterHPC/GlusterHPC 2006-08-04 12:39:07.000000000 -0700 +++ GlusterHPC/GlusterHPC 2006-08-11 18:05:19.000000000 -0700 @@ -79,7 +79,7 @@ def get_slaves (node): return def source_config (node): - if os.system ("ssh -t %s 'gprobe | gpart-sel -o /tmp/ghpc.spec -c /tmp/ghpc_tar_cmds -m /tmp/ghpc_approx_max' 2>>/var/log/proglog" % node) != 0: + if os.system ("ssh -t %s 'gprobe | gpart-sel -o /tmp/ghpc.xml -c /tmp/ghpc_tar_cmds -m /tmp/ghpc_approx_max' 2>>/var/log/proglog" % node) != 0: return 1 else: return 0 @@ -97,10 +97,12 @@ def make_slaves (slave_list): def source_action (node): - partlist = gdump_partlist (read_gdump (os.popen ("ssh %s 'cat /tmp/ghpc.spec' 2>>/var/log/proglog" % node))) + partlist = gdump_partlist (read_xml_to_gdump (os.popen ("ssh %s 'cat /tmp/ghpc.xml' 2>>/var/log/proglog" % node))) parts = partlist.keys () parts = filter ((lambda x: - partlist[x]['FS'] != 'linux-swap' and partlist[x]['XFER'] == 'Y'), + partlist[x]['FS'] != 'linux-swap' \ + and partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y'), parts) no_parts = len (parts) min_clients = os.popen ('gping -p 1332 -i /tmp/session_hosts | grep slave | wc -l').readline ().strip () @@ -120,10 +122,12 @@ def dest_config (node): # Send all the gex packages to clients os.system ("ghpc_send >>/var/log/proglog 2>&1") - partlist = gdump_partlist (read_gdump (os.popen ('ssh %s cat /tmp/ghpc.spec 2>>/var/log/proglog' % node))) + partlist = gdump_partlist (read_xml_to_gdump (os.popen ('ssh %s cat /tmp/ghpc.xml 2>>/var/log/proglog' % node))) parts = partlist.keys () parts = filter ((lambda x: - partlist[x]['FS'] != 'linux-swap' and partlist[x]['XFER'] == 'Y'), + partlist[x]['FS'] != 'linux-swap' \ + and partlist[x]['XFER'] \ + and partlist[x]['XFER'] == 'Y'), parts) no_parts = len (parts) cmd_file = os.popen ('ssh %s dd of=/tmp/ghpc_dest_cmds 2>>/var/log/proglog' % node, "w") @@ -137,7 +141,7 @@ def dest_config (node): def hpc_action (node): # TODO: Give a hook to user inbetween - os.system ("ssh %s 'gmeta-installer --auto --input /tmp/ghpc.spec -c /tmp/ghpc_dest_cmds' >>/var/log/proglog 2>&1" % node) + os.system ("ssh %s 'gmeta-installer --auto --input /tmp/ghpc.xml -c /tmp/ghpc_dest_cmds' >>/var/log/proglog 2>&1" % node) if get_hostname ('1') != node: os.system ("rm -rf /tmp/gmi") os.system ("scp -r %s:/tmp/gmi /tmp" % node) @@ -204,7 +208,7 @@ def get_dst_nodes (dst_nodes): if len (x) == 1: fd.write ("%s%s\n" % (get_hostname (), x[0])) elif len (x) == 2: - if int (x[0]) < int (x[1]): + if x[0] < x[1]: for a in range (int (x[0]), int (x[1]) + 1): fd.write ("%s%s\n" % (get_hostname (), a)) else:
diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/.arch-ids/gprobe.id gutils/.arch-ids/gprobe.id --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/.arch-ids/gprobe.id 2006-08-04 12:39:12.000000000 -0700 +++ gutils/.arch-ids/gprobe.id 1969-12-31 16:00:00.000000000 -0800 @@ -1 +0,0 @@ -Anand Babu <ab@xxxxxxxxxxxxx> Mon May 22 01:49:50 2006 14360.0 diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gimage-dump gutils/gimage-dump --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gimage-dump 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gimage-dump 2006-08-09 00:28:53.000000000 -0700 @@ -62,7 +62,7 @@ def main (): if o == '-s' or o == '--spec': try: spec_fd = file (val) - partlist = gdump_partlist (read_gdump (spec_fd)) + partlist = gdump_partlist (read_xml_to_gdump (spec_fd)) except: sys.exit (1) @@ -93,7 +93,9 @@ def main (): parts = partlist.keys () parts.sort () parts = filter ((lambda x: - partlist[x]['XFER'] == 'Y' and partlist[x]['FS'] != 'linux-swap'), + partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y'\ + and partlist[x]['FS'] != 'linux-swap'), parts) gmap.gmap (xfer_fn, map (None, parts, commands)) else: @@ -117,8 +119,11 @@ def main (): namelist = [] for p in partlist.keys (): - if partlist[p]['OS'] != '' and partlist[p]['XFER'] == 'Y': - namelist.append (partlist[p]['OS']) + if partlist[p].has_key ('OS') \ + and partlist[p].has_key ('XFER') \ + and partlist[p]['XFER'] == 'Y': + os = partlist[p]['OS']['type'] + partlist[p]['OS']['distro'] + namelist.append (os) namelist.append (time.strftime ('%Y-%m-%d-%H%M%S')) name = string.join (namelist, '-') while True: @@ -136,8 +141,8 @@ def main (): namefile.write ('%s\n' % newname) namefile.close () - specfile = file ('%s/provision.spec' % dirname, "w") - write_dump (specfile, partlist_gdump (partlist)) + specfile = file ('%s/provision.xml' % dirname, "w") + write_gdump_to_xml (specfile, partlist_gdump (partlist)) specfile.close () output_fd.write ('%s\n' % os.path.basename (dirname)) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gimage-sel gutils/gimage-sel --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gimage-sel 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gimage-sel 2006-08-09 00:17:10.000000000 -0700 @@ -82,20 +82,22 @@ def main (): if do_xfer: try: - spec_fd = file ('system-images/%s/provision.spec' % cookie) + spec_fd = file ('system-images/%s/provision.xml' % cookie) except: sys.exit (1) - partlist = gdump_partlist (read_gdump (spec_fd)) + partlist = gdump_partlist (read_xml_to_gdump (spec_fd)) parts = partlist.keys () parts.sort () parts = filter ((lambda x: - partlist[x]['XFER'] == 'Y' and partlist[x]['FS'] != 'linux-swap'), + partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y' \ + and partlist[x]['FS'] != 'linux-swap'), parts) print map (None, parts, commands) sys.stdout.flush () gmap.gmap (xfer_fn, map (None, parts, commands)) else: - fd = os.popen ("find system-images -name provision.spec -type f") + fd = os.popen ("find system-images -name provision.xml -type f") specfiles = fd.readlines () fd.close () specfiles = map (string.strip, specfiles) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmeta-installer gutils/gmeta-installer --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmeta-installer 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gmeta-installer 2006-08-11 18:09:25.000000000 -0700 @@ -137,14 +137,14 @@ def fstab_section (tx_buffer, mnt_buffer chroot = "/tmp/ginstaller/%s" % array[1] fstab = "%s/etc/fstab" % chroot if array[2] == 'swap': - if _parts[array[0]]['LABEL'] == '': + if not _parts[array[0]].has_key ('LABEL'): fd.write ("echo \"%s none swap defaults 0 0\" >> %s\n" % (array[0], fstab)) else: fd.write ("echo \"LABEL=%s none swap defaults 0 0\" >> %s\n" % (_parts[array[0]]['LABEL'], fstab)) else: - if _parts[array[0]]['LABEL'] == '': + if not _parts[array[0]].has_key ('LABEL'): fd.write ("echo \"%s %s auto defaults 1 1\" >> %s\n" % (array[0], array[2], fstab)) else: @@ -175,7 +175,7 @@ def bootloader_section (mnt_buf, tx_buf, if pieces[2] != '/': continue - if partlist[pieces[0]]['OS'] == '': + if not partlist[pieces[0]].has_key ('OS'): continue bl_dict['%s' % pieces[0]] = None @@ -185,7 +185,7 @@ def bootloader_section (mnt_buf, tx_buf, continue if len (src_partlist[part]['BLOADER']) == 0: continue - if src_partlist[part]['XFER'] == 'N': + if not src_partlist[part].has_key ('XFER'): continue teh_key = None for tx_line in tx_buf: @@ -451,8 +451,8 @@ def main (): mnt_buf = map (string.strip, mnt_buf) tx_buf = file (tx, "r").readlines () tx_buf = map (string.strip, tx_buf) - partlist = gdump_partlist (read_gdump (file (dump))) - src_partlist = gdump_partlist (read_gdump (file (inp_file))) + partlist = gdump_partlist (read_xml_to_gdump (file (dump))) + src_partlist = gdump_partlist (read_xml_to_gdump (file (inp_file))) cmds_buf = file (commands_file).readlines () cmds_buf = map (string.strip, cmds_buf) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmount gutils/gmount --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmount 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gmount 2006-08-08 18:41:47.000000000 -0700 @@ -23,14 +23,15 @@ from Gluster.GTmp import Dir from Gluster.gpartdump import * def mount_partitions (os_part, num): - os_name = os_part['OS'] + os_name = "%s%s" % (os_part['OS']['type'], + os_part['OS']['distro']) mnt_pt = [] - for part in os_part['FSTAB'].keys (): - if os_part['FSTAB'][part] == 'none' or \ - os_part['FSTAB'][part] == 'swap': + for entry in os_part['FSTAB']: + if entry[1] == 'none' or \ + entry[1] == 'swap': continue mnt_pt.append ("%s:/tmp/ginstaller/%s%d%s" % - (part, os_name, num, os_part['FSTAB'][part])) + (entry[0], os_name, num, entry[1])) mnt_pt.sort (key=len) for part in mnt_pt: @@ -40,7 +41,7 @@ def mount_partitions (os_part, num): os.system ("mount %s %s" % (dev, mp)) continue - return + return None def main (): @@ -67,25 +68,29 @@ def main (): if inp_file == None: inp_file = os.popen ("gprobe") - partlist = gdump_partlist (read_gdump (inp_file)) + partlist = gdump_partlist (read_xml_to_gdump (inp_file)) parts = partlist.keys () parts.sort () if show_option == True: for _part in parts: - if partlist[_part]['OS'] == '': + if not partlist[_part].has_key ('OS'): continue - print "%s%d" % (partlist[_part]['OS'], part_num) + print "%s%s%d" % (partlist[_part]['OS']['type'], + partlist[_part]['OS']['distro'], + part_num) part_num += 1 return for _part in parts: - if partlist[_part]['OS'] == '': + if not partlist[_part].has_key ('OS'): continue if os_key != 'all': - if os_key != "%s%d" % (partlist[_part]['OS'], part_num): + if os_key != "%s%s%d" % (partlist[_part]['OS']['type'], + partlist[_part]['OS']['distro'], + part_num): continue - if len (partlist[_part]['FSTAB']) == 0: + if partlist[_part].has_key ('FSTAB'): continue mount_partitions (partlist[_part], part_num) part_num += 1 diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmountmap gutils/gmountmap --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gmountmap 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gmountmap 2006-08-10 09:59:34.000000000 -0700 @@ -44,7 +44,7 @@ auto = False # # -linux_group = ['ext2', 'ext3', 'reiserfs', 'jfx', 'xfs'] +linux_group = ['ext2', 'ext3', 'reiserfs', 'jfs', 'xfs'] windows_group = ['fat32', 'ntfs'] all_commands = [] @@ -54,7 +54,7 @@ def gpart_call (dest_partlist, os_dict, d = Dir.TmpDir () inp = file (d.Name () + '/input', "w") - write_dump (inp, partlist_gdump (dest_partlist)) + write_gdump_to_xml (inp, partlist_gdump (dest_partlist)) inp.close () fmt = "gpart -c %s/commands -d %s/dump -i %s/input" @@ -66,7 +66,7 @@ def gpart_call (dest_partlist, os_dict, return (dest_partlist, os_dict) dump_fd = file (d.Name () + '/dump') - new_partlist = gdump_partlist (read_gdump (dump_fd)) + new_partlist = gdump_partlist (read_xml_to_gdump (dump_fd)) dump_fd.close () if not auto: @@ -100,22 +100,26 @@ def get_part_dict (partlist): part_dict = {} for part in partlist.keys (): mountlist = {} - if partlist[part]['XFER'] == 'N': + if partlist[part].has_key ('XFER'): continue for os_part in partlist.keys (): - if partlist[os_part]['FSTAB'].has_key (part): - mountlist[os_part] = partlist[os_part]['FSTAB'][part] + if partlist[os_part].has_key ('FSTAB'): + for entry in partlist[os_part]['FSTAB']: + if part == entry[0]: + mountlist[os_part] = entry[1] part_dict[part] = mountlist.copy () return part_dict def get_os_dict (partlist, part_dict, is_auto): os_dict = {} for part in partlist.keys (): - if partlist[part]['XFER'] == 'N': + if partlist[part].has_key ('XFER'): continue - if partlist[part]['OS'] != '': + if partlist[part].has_key ('OS'): os_dict[part] = {} - os_dict[part]['OS'] = partlist[part]['OS'] + os_dict[part]['OS'] = {} + os_dict[part]['OS']['type'] = partlist[part]['OS']['type'] + os_dict[part]['OS']['distro'] = partlist[part]['OS']['distro'] os_dict[part]['SWAP'] = [] if is_auto: os_dict[part]['FSTAB'] = { '/' : [part, True] } @@ -123,9 +127,9 @@ def get_os_dict (partlist, part_dict, is os_dict[part]['FSTAB'] = { '/' : [None, True] } for part in partlist.keys (): - if partlist[part]['XFER'] == 'N': + if partlist[part].has_key ('XFER'): continue - if partlist[part]['OS'] == '': + if not partlist[part].has_key ('OS') : if not partlist[part]['TYPE'] in ['primary', 'logical']: continue @@ -139,7 +143,7 @@ def get_os_dict (partlist, part_dict, is num_mounts = len (part_dict[part]) if num_mounts == 0: os_dict[part] = {} - os_dict[part]['OS'] = '' + # os_dict[part]['OS'] = '' if is_auto: os_dict[part]['FSTAB'] = { '/' : [part, True] } else: @@ -171,19 +175,19 @@ def run_map (os_dict, part_dict, source_ choices.append(('--------','----------------')) idx = idx + 1 desc = '' - if source_dump[os]['DESC'] != '': - desc = '%s (%s on source) ' % (source_dump[os]['DESC'], os) - key = '%s%d' % (source_dump[os]['OS'], idx) + if source_dump[os].has_key ('OS'): + desc = '%s (%s on source) ' % (source_dump[os]['OS']['desc'], os) + key = '%s%d' % (source_dump[os]['OS']['distro'], idx) key_to_os[key] = os else: key = 'misc%d' % idx key_to_os[key] = os - if source_dump[os]['LABEL'] != '': + if source_dump[os].has_key ('LABEL'): desc = 'LABEL=%s (%s on source)' % (source_dump[os]['LABEL'], os) else: desc = '(%s on source) %s' % (os, source_dump[os]['FS']) - choices.append ((key,desc)) - os_name = source_dump[os]['OS'] + choices.append ((key, desc)) + os_name = source_dump[os]['OS']['distro'] for mp in os_dict[os]['FSTAB'].keys (): k = '%s: %s' % (key, mp) @@ -195,7 +199,7 @@ def run_map (os_dict, part_dict, source_ p = '*merged*' choices.append ((k, p)) - if source_dump[os]['FSTAB'] != {}: + if source_dump[os]['FSTAB'] != []: k = '%s: swap' % key if len (os_dict[os]['SWAP']) > 0: choices.append ((k, string.join (os_dict[os]['SWAP']))) @@ -244,11 +248,11 @@ def run_map (os_dict, part_dict, source_ os = key_to_os[sel_os] - if os_dict[os]['OS'] == '' and sel_mp == None: + if not os_dict[os].has_key ('OS') and sel_mp == None: continue if not sel_mp: - if source_dump[os]['FSTAB'] != {}: + if source_dump[os]['FSTAB'] != []: while True: (ret, sel) = dlg.menu ('select action', choices=[('add', @@ -443,16 +447,17 @@ def get_key_from_os (part): def fix_fstab (dest_partlist, os_dict): for p in dest_partlist.keys (): - dest_partlist[p]['FSTAB'] = {} + dest_partlist[p]['FSTAB'] = [] for os in os_dict.keys (): - if os_dict[os]['OS'] == '': + if not os_dict[os].has_key ('OS'): continue os_part = os_dict[os]['FSTAB']['/'][0] for mp, stuff in os_dict[os]['FSTAB'].iteritems (): if not stuff[0]: continue - dest_partlist[os_part]['FSTAB'][stuff[0]] = mp - dest_partlist[os_part]['OS'] = os_dict[os]['OS'] + dest_partlist[os_part]['FSTAB'].append ((stuff[0], mp)) + dest_partlist[os_part]['OS']['type'] = os_dict[os]['OS']['type'] + dest_partlist[os_part]['OS']['distro'] = os_dict[os]['OS']['distro'] if 'SWAP' in os_dict[os].keys (): for sp in os_dict[os]['SWAP']: dest_partlist[os_part]['FSTAB'][sp] = 'swap' @@ -480,7 +485,7 @@ def write_map (map_fd, source_partlist, for part in parts: if source_partlist[part]['FS'] == 'linux-swap': continue - if source_partlist[part]['XFER'] == 'N': + if source_partlist[part].has_key ('XFER'): continue if source_partlist[part]['TYPE'] in ['extended', 'disk']: continue @@ -542,7 +547,7 @@ def main (): except: sys.exit (1) - source_dump = read_gdump (input_fd) + source_dump = read_xml_to_gdump (input_fd) source_partlist = gdump_partlist (source_dump) part_dict = get_part_dict (source_partlist) @@ -552,7 +557,7 @@ def main (): dest_dump = copy.deepcopy (source_dump) else: gprobe_fd = os.popen ("gprobe") - dest_dump = read_gdump (gprobe_fd) + dest_dump = read_xml_to_gdump (gprobe_fd) gprobe_fd.close () dest_partlist = gdump_partlist (dest_dump) @@ -561,7 +566,7 @@ def main (): if done: fix_fstab (dest_partlist, os_dict) - write_dump (dump_fd, partlist_gdump (dest_partlist)) + write_gdump_to_xml (dump_fd, partlist_gdump (dest_partlist)) write_map (map_fd, source_partlist, part_dict) @@ -570,7 +575,7 @@ def main (): if auto: d = Dir.TmpDir () dump_file = file (d.Name () + '/input', "w") - write_dump (dump_file, partlist_gdump (dest_partlist)) + write_gdump_to_xml (dump_file, partlist_gdump (dest_partlist)) dump_file.close () fmt = "gpart -a -i %s/input -d %s/dump -c %s/cmds" os.system (fmt % (d.Name (), d.Name (), d.Name ())) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpart gutils/gpart --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpart 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gpart 2006-08-08 23:24:58.000000000 -0700 @@ -261,7 +261,7 @@ def gpart_out (dump): global dump_fd if not dump: return - write_dump (dump_fd, dump) + write_gdump_to_xml (dump_fd, dump) map (commands_fd.write, commands) return @@ -439,7 +439,8 @@ def alter_parts (partlist): item = 'done' backup = copy.deepcopy (partlist) while True: - label_len = max (map (lambda x: len (partlist[x]['LABEL']), partlist)) + label_len = max (map (lambda x: partlist[x].has_key ('LABEL') \ + and len (partlist[x]['LABEL']), partlist)) if label_len < 6: label_len = 6 choices = [('parts', @@ -593,11 +594,7 @@ def alter_parts (partlist): 'START' : start, 'SIZE' : size, 'END' : '%.2f%%' % end_p, - 'OS' : '', - 'DESC' : '', 'XFER' : 'N', - 'FSTAB' : {}, - 'BLOADER' : {}, 'TAINTED' : True} if not validate (testlist): continue @@ -663,7 +660,7 @@ def main (): except: sys.exit (1) - dump = read_gdump (input_fd) + dump = read_xml_to_gdump (input_fd) if auto: auto_out (dump) else: diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpartdump.py gutils/gpartdump.py --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpartdump.py 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gpartdump.py 2006-08-08 18:43:24.000000000 -0700 @@ -20,6 +20,8 @@ import os, string, sys from Gluster.GTmp import Dir +import xml.dom.minidom +from xml.dom.minidom import parse def uniq (orig_list): uniq_list = [] @@ -29,6 +31,9 @@ def uniq (orig_list): return uniq_list def get_mpoint (part): + + """ Mount HDD """ + hnd = os.popen ("mount | grep '^ *%s ' | awk '{print $3}'" % part) line = hnd.readline ().strip () hnd.close () @@ -44,6 +49,9 @@ def get_mpoint (part): return (True, tmpdir.Name ()) def unget_mpoint (need_umount, mpoint): + + """ Umount HDD """ + if not need_umount or not mpoint: return if need_umount: @@ -52,72 +60,146 @@ def unget_mpoint (need_umount, mpoint): def get_disk_part (partname): diskname = partname.strip ('0123456789') if diskname == partname: - return (diskname, 0) + return (diskname, 0) partnum = string.atoi (partname[len (diskname):]) return (diskname, partnum) -def write_dump (fd, disks): +def write_gdump_to_xml (fd, disks): + + """ Dictionary to XML generator """ + + spec = xml.dom.minidom.Document () + spec_element = spec.createElement ("spec") + spec.appendChild (spec_element) + + # initial disc section for disk_name in disks.keys (): disk = disks[disk_name] if not disk: continue - for part_no in disk.keys (): + disk_element = spec.createElement ("disk") + spec_element.appendChild (disk_element) + disk_element.setAttribute ("name", disk_name) + disk_element.setAttribute ("size", disk[0]['SIZE']) + disk_element.setAttribute ("type", disk[0]['TYPE']) + + # partition section + for part_no in disk.keys (): if part_no == 0: - part_name = disk_name - else: - part_name = '%s%d' % (disk_name, part_no) - fmt = '%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' - fd.write (fmt % (part_name, - disk[part_no]['TYPE'], - disk[part_no]['FS'], - disk[part_no]['LABEL'], - disk[part_no]['START'], - disk[part_no]['END'], - disk[part_no]['SIZE'], - disk[part_no]['OS'], - disk[part_no]['DESC'], - disk[part_no]['XFER'])) - for fstab_part in disk[part_no]['FSTAB'].keys (): - fd.write ('fstab:%s:%s:%s\n' % - (part_name, - fstab_part, - disk[part_no]['FSTAB'][fstab_part])) - for bootloader in disk[part_no]['BLOADER'].keys (): - fd.write ('bootloader:%s:%s:%s\n' % - (part_name, - bootloader, - disk[part_no]['BLOADER'][bootloader])) + continue + part_name = '%s%d' % (disk_name, part_no) + part_element = spec.createElement ("part") + disk_element.appendChild (part_element) + part_element.setAttribute ("number", str (part_no)) + part_element.setAttribute ("start", disk[part_no]['START']) + part_element.setAttribute ("end", disk[part_no]['END']) + part_element.setAttribute ("size", disk[part_no]['SIZE']) + part_element.setAttribute ("type", disk[part_no]['TYPE']) + part = disk[part_no] + + for attribute in part.keys (): + if attribute == 'FLAGS': + part_element.setAttribute ("flags", disk[part_no]['FLAGS']) + if attribute == 'FS': + part_element.setAttribute ("fs", disk[part_no]['FS']) + if attribute == 'LABEL': + part_element.setAttribute ("LABEL", disk[part_no]['LABEL']) + if attribute == 'XFER': + if disk[part_no]['XFER'] == 'Y': + part_element.setAttribute ("transfer", "yes") + else: + part_element.setAttribute ("transfer", "no") + + # OS, and it's respective fstab section + if disk[part_no]['TYPE'] != 'extended': + if disk[part_no].has_key ('OS'): + os_element = spec.createElement ("os") + part_element.appendChild (os_element) + os_element.setAttribute ("type", disk[part_no]['OS']['type']) + os_element.setAttribute ("distro", disk[part_no]['OS']['distro']) + os_element.setAttribute ("desc", disk[part_no]['OS']['desc']) + if disk[part_no].has_key ('FSTAB'): + fstab_element = spec.createElement ("fstab") + os_element.appendChild (fstab_element) + for i in range (0,len (disk[part_no]['FSTAB'])): + entry_element = spec.createElement ("entry") + fstab_element.appendChild (entry_element) + entry_element.setAttribute ("source", + disk[part_no]['FSTAB'][i][0]) + entry_element.setAttribute ("mpoint", + disk[part_no]['FSTAB'][i][1]) + entry_element.setAttribute ("type", + disk[part_no]['FSTAB'][i][2]) + entry_element.setAttribute ("flags", + disk[part_no]['FSTAB'][i][3]) + entry_element.setAttribute ("boot", + disk[part_no]['FSTAB'][i][4]) + entry_element.setAttribute ("pass", + disk[part_no]['FSTAB'][i][5]) + # Boot loader section + if disk[part_no].has_key ('BLOADER'): + for bootloader in disk[part_no]['BLOADER'].keys (): + boot = disk[part_no]['BLOADER'][bootloader] + bloader_element = spec.createElement ("bootloader") + part_element.appendChild (bloader_element) + bloader_element.setAttribute ("type", bootloader) + bloader_element.setAttribute ("boot", boot) + + spec.writexml (fd, newl="\n", addindent=" ") + return None +def read_xml_to_gdump (fd): -def read_gdump (fd): + """ XML to Dictionary Converter """ + _disks = {} - all_lines = fd.readlines () - for line in all_lines: - pieces = line.strip (). split (':') - if pieces[0] == 'fstab': - (d, p) = get_disk_part (pieces[1]) - _disks[d][p]['FSTAB'][pieces[2]] = pieces[3] - continue - if pieces[0] == 'bootloader': - (d, p) = get_disk_part (pieces[1]) - _disks[d][p]['BLOADER'][pieces[2]] = pieces[3] - continue - (d, p) = get_disk_part (pieces[0]) + xml_doc = parse (fd) + spec = xml_doc._get_firstChild () + for disk_element in spec.getElementsByTagName ("disk"): + d = disk_element.getAttribute ("name") if not _disks.has_key (d): _disks[d] = {} - if not _disks[d].has_key (p): - _disks[d][p] = {} - _disks[d][p]['FSTAB'] = {} - _disks[d][p]['BLOADER'] = {} - _disks[d][p]['TYPE'] = pieces[1] - _disks[d][p]['FS'] = pieces[2] - _disks[d][p]['LABEL'] = pieces[3] - _disks[d][p]['START'] = pieces[4] - _disks[d][p]['END'] = pieces[5] - _disks[d][p]['SIZE'] = pieces[6] - _disks[d][p]['OS'] = pieces[7] - _disks[d][p]['DESC'] = pieces[8] - _disks[d][p]['XFER'] = pieces[9] + _disks[d][0] = {} + _disks[d][0]['START'] = '' + _disks[d][0]['END'] = '' + _disks[d][0]['SIZE'] = disk_element.getAttribute ("size") + _disks[d][0]['TYPE'] = disk_element.getAttribute ("type") + _disks[d][0]['FS'] = '' + for part_element in disk_element.getElementsByTagName ("part"): + p = int (part_element.getAttribute ("number")) + if not _disks[d].has_key (p): + _disks[d][p] = {} + _disks[d][p]['TYPE'] = part_element.getAttribute ("type") + _disks[d][p]['FS'] = part_element.getAttribute ("fs") + _disks[d][p]['LABEL'] = part_element.getAttribute ("LABEL") + _disks[d][p]['START'] = part_element.getAttribute ("start") + _disks[d][p]['END'] = part_element.getAttribute ("end") + _disks[d][p]['SIZE'] = part_element.getAttribute ("size") + if part_element.getAttribute ("transfer") != '': + if part_element.getAttribute ("transfer") == "yes": + _disks[d][p]['XFER'] = 'Y' + else: + _disks[d][p]['XFER'] = 'N' + + for os_element in part_element.getElementsByTagName ("os"): + _disks[d][p]['OS'] = {} + _disks[d][p]['OS']['type'] = os_element.getAttribute ("type") + _disks[d][p]['OS']['distro'] = os_element.getAttribute ("distro") + _disks[d][p]['OS']['desc'] = os_element.getAttribute ("desc") + for boot_ele in part_element.getElementsByTagName ("bootloader"): + _disks[d][p]['BLOADER'] = {} + bloader_type = boot_ele.getAttribute ("type") + _disks[d][p]['BLOADER'][bloader_type] = boot_ele.getAttribute ("boot") + + for fstab_element in part_element.getElementsByTagName ("fstab"): + _disks[d][p]['FSTAB'] = [] + for entry_e in fstab_element.getElementsByTagName ("entry"): + _disks[d][p]['FSTAB'].append ((entry_e.getAttribute ("source"), + entry_e.getAttribute ("mpoint"), + entry_e.getAttribute ("type"), + entry_e.getAttribute ("flags"), + entry_e.getAttribute ("boot"), + entry_e.getAttribute ("pass"))) return _disks diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpart-sel gutils/gpart-sel --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gpart-sel 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gpart-sel 2006-08-08 23:11:21.000000000 -0700 @@ -45,28 +45,33 @@ def sel_parts (_parts): i = 0 idx_to_part = {} for _part in _parts: - if _parts[_part]['OS'] != '': - if _parts[_part]['FS'] != '': - i = i + 1 - sel_os.append ((str (i),_parts[_part]['DESC'],"on")) - idx_to_part[i] = _part - - for _part in _parts: - if _part in idx_to_part.values (): + if _parts[_part]['FS'] in ['*', '']: continue - found = False - for os_part in idx_to_part.values (): - if _part in _parts[os_part]['FSTAB'].keys (): - found = True - break - if found: + if _parts[_part]['TYPE'] not in ['logical', 'primary']: continue - if _parts[_part]['FS'] != '': + if _parts[_part].has_key('OS'): + i = i + 1 + desc = "%s %s" % (_parts[_part]['OS']['distro'], + _parts[_part]['OS']['desc']) + sel_os.append ((str (i), + desc, + "on")) + idx_to_part[i] = _part + else: + found = False + for os_part in _parts.keys (): + if _parts[os_part].has_key ('FSTAB'): + for entry in _parts[os_part]['FSTAB']: + if _part == entry[0]: + found = True + break + if found: + continue i = i + 1 sel_os.append ((str (i), "%s ( %s | %s )" % (_part, - _parts[_part]['FS'], - _parts[_part]['SIZE']), + _parts[_part]['FS'], + _parts[_part]['SIZE']), "on")) idx_to_part[i] = _part @@ -83,39 +88,45 @@ def sel_parts (_parts): return (1, None) else: sel_ids = map (lambda (x, y, z): x, sel_os) - + sel_parts = map (idx_to_part.get, map (string.atoi, sel_ids)) new_parts = [] for sel_part in sel_parts: - if _parts[sel_part]['OS'] == '': + if not _parts[sel_part].has_key ('OS'): new_parts.append (sel_part) continue fstab_list = [] - for f in _parts[sel_part]['FSTAB'].keys (): - if f in _parts.keys () and _parts[f]['FS'] != '': - fstab_list.append ((f, _parts[sel_part]['FSTAB'][f], "on")) + if _parts[sel_part].has_key ('FSTAB'): + for entry in _parts[sel_part]['FSTAB']: + if entry[0] in _parts.keys () and _parts[entry[0]]['FS'] != '': + fstab_list.append ((entry[0], + entry[1], + "on")) if len (fstab_list) == 0: continue + desc = "%s %s" % (_parts[sel_part]['OS']['distro'], + _parts[sel_part]['OS']['desc']) (ret, - small_parts) = dlg.checklist ('\n%s\n\n' % _parts[sel_part]['DESC'], + small_parts) = dlg.checklist ('\n%s\n\n' % + desc, title='[ Select Partitions ]', choices=fstab_list, ok_label=' Select ') if ret != 0: continue # this is for the sake of merging partitions in destination - for del_part in _parts[sel_part]['FSTAB'].keys (): - if not del_part in small_parts: - _parts[sel_part]['FSTAB'].pop (del_part) + if _parts[sel_part].has_key ('FSTAB'): + for entry in _parts[sel_part]['FSTAB']: + del_part = entry[0] + if not del_part in small_parts: + _parts[sel_part]['FSTAB'].remove (entry) new_parts += small_parts - + if new_parts == []: return (1, []) - return (0,uniq (sel_parts + new_parts)) + return (0, uniq (sel_parts + new_parts)) def main (): - global port_base - global xfer_cmd global _parts spec_fd = sys.stdin cfd = sys.stdout @@ -155,8 +166,7 @@ def main (): except: sys.exit (1) - _parts = gdump_partlist (read_gdump (spec_fd)) - + _parts = gdump_partlist (read_xml_to_gdump (spec_fd)) (ret, parts_selected) = sel_parts (_parts) if ret != 0: sys.exit (1) @@ -167,19 +177,23 @@ def main (): for part in parts_selected: _parts[part]['XFER'] = 'Y' - write_dump (cfd, partlist_gdump (_parts)) - + write_gdump_to_xml (cfd, partlist_gdump (_parts)) - partlist = _parts - parts = partlist.keys () - parts.sort () + parts = _parts.keys () parts = filter ((lambda x: - partlist[x]['XFER'] == 'Y' and partlist[x]['FS'] != 'linux-swap'), + _parts[x].has_key ('XFER') \ + and _parts[x]['XFER'] == 'Y' \ + and _parts[x]['FS'] != 'linux-swap'), parts) bytes = 0 + print parts + os.system ("read") for part in parts: (need_umount, mp) = get_mpoint (part) + print mp + print need_umount + os.system ("read") if not mp: dlg.msgbox ('could not mount %s' % part) sys.exit (1) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gprobe gutils/gprobe --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gprobe 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gprobe 2006-08-09 00:04:41.000000000 -0700 @@ -44,7 +44,10 @@ distro_db = { 'echo unknown Redhat style distribution'] } -def get_bootloader (part, _fstab): +def get_bootloader (part): + + """ Bootloader Dictionary """ + (need_umount, mpoint) = get_mpoint (part) if not mpoint: return {} @@ -59,61 +62,65 @@ def get_bootloader (part, _fstab): bootloader['grub'] = 'default' # If /boot is mapped to another partition, then check for # grub/menu.lst in the path - for k, v in _fstab.iteritems (): - if '/boot' == v: - (tmp_need_umount, tmp_mpoint) = get_mpoint (k) - if not tmp_mpoint: - unget_mpoint (need_umount, mpoint) - return {} - if os.access ("%s/grub/menu.lst" % tmp_mpoint, os.R_OK): - bootloader['grub'] = 'default' - unget_mpoint (tmp_need_umount, tmp_mpoint) - - if os.access ("%s/ntldr" % mpoint, os.R_OK) \ - or os.access ("%s/boot.ini" % mpoint, os.R_OK): - bootloader['windows'] = part #need to check this still + # for i in range (0, len (_fstab)): + # if '/boot' == _fstab[i][1]: + # (tmp_need_umount, tmp_mpoint) = get_mpoint (_fstab[i][0]) + # if not tmp_mpoint: + # unget_mpoint (need_umount, mpoint) + # return {} + # if os.access ("%s/grub/menu.lst" % tmp_mpoint, os.R_OK): + # bootloader['grub'] = 'default' + # unget_mpoint (tmp_need_umount, tmp_mpoint) + + #if os.access ("%s/ntldr" % mpoint, os.R_OK) \ + # or os.access ("%s/boot.ini" % mpoint, os.R_OK): + # bootloader['windows'] = part # Decision yet to be done !!! unget_mpoint (need_umount, mpoint) return bootloader -def get_fstab (part, _parts): +def get_fstab (part): + + """ Filesystem table List """ + (need_umount, mpoint) = get_mpoint (part) if not mpoint: - return {} - fstab = {} - hnd = os.popen ("cat %s/etc/fstab | grep -v '^#' | awk '{print $1\":\"$2}'" % + return [] + fstab = [] + hnd = os.popen ("cat %s/etc/fstab | grep -v '^#' 2>/dev/null" % mpoint) fstab_entries = hnd.readlines () - + for entry in fstab_entries: - entry_pieces = entry.strip (). split (':') - if len (entry_pieces) != 2: - continue - if len (entry_pieces[0].split ("=")) == 2: - (l1, l2) = entry_pieces[0].split ("=") - l2 = l2.strip ('"') - for p in _parts.keys (): - if l1 in _parts[p].keys () and l2 == _parts[p][l1]: - fstab[p] = entry_pieces[1] - else: - if entry_pieces[0] in _parts.keys (): - fstab[entry_pieces[0]] = entry_pieces[1] + (source, mpoint, type, flags, boot, pas) = (entry.strip ().split ()[0], + entry.strip ().split ()[1], + entry.strip ().split ()[2], + entry.strip ().split ()[3], + entry.strip ().split ()[4], + entry.strip ().split ()[5]) + entry_pieces = (source, mpoint, type, flags, boot, pas) + fstab.append (entry_pieces) unget_mpoint (need_umount, mpoint) return fstab def get_os_desc (part): + + """ Operating System Dictionary """ + (need_umount, mpoint) = get_mpoint (part) if not mpoint: - return ('', '') - + return ('', '', '') + + the_os = '' the_distro = '' the_desc = '' if os.system ("ls %s/lib/ld-* >/dev/null 2>/dev/null" % mpoint) == 0 \ or os.system ("ls %s/lib64/ld-* >/dev/null 2>&1" % mpoint) == 0: + the_os = 'Linux' the_distro = 'unknown_gnu/linux' the_desc = 'Unknown GNU/Linux distribution' for k,v in distro_db.iteritems (): @@ -123,18 +130,26 @@ def get_os_desc (part): the_desc = hnd.readline ().strip () hnd.close () break - + #if os.access ("%s/windows/system32/ntoskrnl.exe" % mpoint, os.R_OK) \ + # or os.access ("%s/pagefile.sys" % mpoint, os.R_OK): + # the_os = 'Windows' + # the_distro = 'Unknown Windows NT' + # the_desc = 'Unknown Version' + unget_mpoint (need_umount, mpoint) - return (the_distro, the_desc) + return (the_os, the_distro, the_desc) def get_parts (): + + """ Partitions dictionary """ + _parts = {} hnd = os.popen ("blkid -c /dev/null 2>/dev/null") blk_lines = hnd.readlines () hnd.close () for blk_line in blk_lines: - blk_line_pieces = blk_line.strip ().split () + blk_line_pieces = blk_line.split () dev_part = blk_line_pieces[0].split (':')[0] part_val = {} for other_part in blk_line_pieces[1:]: @@ -146,21 +161,24 @@ def get_parts (): return _parts def get_disk_info (_disk): + + """ Disk database generator """ + _disk_db = {} parted_fd = os.popen ("parted -s %s unit %% print" % _disk) parted_lines = parted_fd.readlines () parted_fd.close () if len(parted_lines) == 0: return None - _pieces = parted_lines[0].split() + _pieces = parted_lines[1].split() _disk_db[0] = {} - _disk_db[0]['START'] = _pieces[4] - _disk_db[0]['END'] = _pieces[6] - _disk_db[0]['SIZE'] = _pieces[6] + _disk_db[0]['START'] = '' + _disk_db[0]['END'] = '' + _disk_db[0]['SIZE'] = _pieces[2] _disk_db[0]['TYPE'] = 'disk' _disk_db[0]['FS'] = '' - for part_line in parted_lines[3:]: - _pieces = part_line.strip ().split () + for part_line in parted_lines[6:-1]: + _pieces = part_line.split () _ent = string.atoi (_pieces[0]) _disk_db[_ent] = {} _disk_db[_ent]['START'] = _pieces[1] @@ -170,11 +188,12 @@ def get_disk_info (_disk): _disk_db[_ent]['FS'] = '' if _disk_db[_ent]['TYPE'] in ['logical', 'primary']: _disk_db[_ent]['FS'] = _pieces[5] - if len (_pieces) > 6: - _disk_db[_ent]['FLAGS'] = _pieces[6:] - else: - if len (_pieces) > 5: - _disk_db[_ent]['FLAGS'] = _pieces[5:] + if len (_pieces) > 7: + _disk_db[_ent]['FLAGS'] = _pieces[6] + _pieces[7] + else: + _disk_db[_ent]['FS'] = _pieces[5] + if len (_pieces) > 6: + _disk_db[_ent]['FLAGS'] = _pieces[6] return _disk_db def get_disks (): @@ -182,9 +201,12 @@ def get_disks (): probe_lines = probe_fd.readlines () probe_fd.close () probe_lines = map (string.strip, probe_lines) - return probe_lines + return probe_lines def main (): + + """ Gluster Partition Prober """ + _disks = get_disks () _parts = get_parts () disks = {} @@ -195,25 +217,28 @@ def main (): for part_no in disks[_disk].keys (): part_name = '%s%d' % (_disk, part_no) if disks[_disk][part_no]['TYPE'] == 'extended': - os, desc = '', '' + os_type, os_distro, os_desc = '', '', '' else: - (os, desc) = get_os_desc (part_name) + (os_type, os_distro, os_desc) = get_os_desc (part_name) disks[_disk][part_no]['XFER'] = 'N' - disks[_disk][part_no]['OS'] = os - disks[_disk][part_no]['DESC'] = desc - disks[_disk][part_no]['FSTAB'] = {} + + if os_type != '': + disks[_disk][part_no]['OS'] = {} + disks[_disk][part_no]['OS']['type'] = os_type + disks[_disk][part_no]['OS']['distro'] = os_distro + disks[_disk][part_no]['OS']['desc'] = os_desc + disks[_disk][part_no]['FSTAB'] = [] + fstab = get_fstab (part_name) + disks[_disk][part_no]['FSTAB'] = fstab disks[_disk][part_no]['BLOADER'] = {} - if os != '': - fstab = get_fstab (part_name, _parts) - disks[_disk][part_no]['FSTAB'] = fstab - bootloader = get_bootloader (part_name, fstab) - disks[_disk][part_no]['BLOADER'] = bootloader + bootloader = get_bootloader (part_name) + disks[_disk][part_no]['BLOADER'] = bootloader disks[_disk][part_no]['LABEL'] = '' if part_name in _parts.keys (): if 'LABEL' in _parts[part_name].keys (): disks[_disk][part_no]['LABEL'] = _parts[part_name]['LABEL'] - write_dump (sys.stdout, disks) + write_gdump_to_xml (sys.stdout, disks) return main () diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gstate-sel gutils/gstate-sel --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gstate-sel 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gstate-sel 2006-08-08 18:41:47.000000000 -0700 @@ -66,14 +66,13 @@ def set_part (part, fresh=False): return True def get_cmdline_state (): - # gluster_state=/dev/sda1 should return 'sda1' cmdline = file ('/proc/cmdline').readline ().strip () pieces = cmdline.split () for piece in pieces: sub_pieces = piece.split ('=') if len (sub_pieces) > 1: if sub_pieces[0] == 'gluster_state': - return sub_pieces[1].split ('/')[-1] + return sub_pieces[1] return None def init_fix (parts): diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gumount gutils/gumount --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/gutils/gumount 2006-08-04 12:39:13.000000000 -0700 +++ gutils/gumount 2006-08-09 00:12:52.000000000 -0700 @@ -23,14 +23,14 @@ from Gluster.GTmp import Dir from Gluster.gpartdump import * def umount_partitions (os_part, num): - os_name = os_part['OS'] + os_name = os_part['OS']['type'] + os_part['OS']['distro'] mnt_pt = [] - for part in os_part['FSTAB'].keys (): - if os_part['FSTAB'][part] == 'none' or \ - os_part['FSTAB'][part] == 'swap': + for entry in os_part['FSTAB']: + if entry[1] == 'none' or \ + entry[1] == 'swap': continue mnt_pt.append ("/tmp/ginstaller/%s%d%s" % - (os_name, num, os_part['FSTAB'][part])) + (os_name, num, entry[1])) mnt_pt.sort (key=len, reverse=True) for mp in mnt_pt: @@ -64,25 +64,25 @@ def main (): if inp_file == None: inp_file = os.popen ("gprobe") - partlist = gdump_partlist (read_gdump (inp_file)) + partlist = gdump_partlist (read_xml_to_gdump (inp_file)) parts = partlist.keys () parts.sort () if show_option == True: for _part in parts: - if partlist[_part]['OS'] == '': + if not partlist[_part].has_key ('OS'): continue print "%s%d" % (partlist[_part]['OS'], part_num) part_num += 1 return for _part in parts: - if partlist[_part]['OS'] == '': + if not partlist[_part].has_key ('OS'): continue if os_key != 'all': if os_key != "%s%d" % (partlist[_part]['OS'], part_num): continue - if len (partlist[_part]['FSTAB']) == 0: + if partlist[_part].has_key ('FSTAB'): continue umount_partitions (partlist[_part], part_num) part_num += 1
diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GCapture GlusterEP/GCapture --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GCapture 2006-08-04 12:39:07.000000000 -0700 +++ GlusterEP/GCapture 2006-08-10 10:24:34.000000000 -0700 @@ -30,7 +30,7 @@ my_ip = os.popen ("ifconfig -a | sed -n port_base = 13370 def source_config (): - if os.system ('gprobe | gpart-sel -o /tmp/gc.spec -m /tmp/gc_approx_max -c /tmp/gc.tar.cmds') == 0: + if os.system ('gprobe | gpart-sel -o /tmp/gc.xml -m /tmp/gc_approx_max -c /tmp/gc.tar.cmds') == 0: return else: sys.exit (1) @@ -39,16 +39,18 @@ def source_config (): def dest_config (): os.system ('ssh master-node mkdir -p /var/tmp/%s' % my_ip) os.system ('scp /tmp/gc.spec master-node:/var/tmp/%s' % my_ip) - if os.system ("ssh -t master-node 'gimage-dump -s /var/tmp/%s/gc.spec -o /var/tmp/%s/cookie'" % (my_ip, my_ip)) != 0: + if os.system ("ssh -t master-node 'gimage-dump -s /var/tmp/%s/gc.xml -o /var/tmp/%s/cookie'" % (my_ip, my_ip)) != 0: sys.exit (1) return return def source_action (): - partlist = gdump_partlist (read_gdump (file ('/tmp/gc.spec'))) + partlist = gdump_partlist (read_xml_to_gdump (file ('/tmp/gc.xml'))) parts = partlist.keys () parts = filter ((lambda x: - partlist[x]['FS'] != 'linux-swap' and partlist[x]['XFER'] == 'Y'), + partlist[x]['FS'] != 'linux-swap' \ + and partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y'), parts) parts.sort () no_parts = len (parts) diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GlusterEP GlusterEP/GlusterEP --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GlusterEP 2006-08-04 12:39:07.000000000 -0700 +++ GlusterEP/GlusterEP 2006-08-08 18:41:49.000000000 -0700 @@ -101,7 +101,6 @@ def image_management (): return def config_client (): - os.system ("rm /var/gluster/EP/bootp.iface -f") os.system ("/etc/stage2/config_network.sh") os.system ("gdump-netstate /var/gluster/EP/rc.local") os.system ("chmod +x /var/gluster/EP/rc.local") @@ -144,12 +143,7 @@ def master (): os.system ("/var/gluster/EP/rc.local") # GExtension.run ('client-reg') - while True: - if GExtension.run ('bootp-manager', '--allow 2>>/var/log/proglog') != 1: - break - os.system ("/etc/stage2/config_network.sh") - os.system ("gdump-netstate /var/gluster/EP/rc.local") - os.system ("chmod +x /var/gluster/EP/rc.local") + GExtension.run ('bootp-manager', '--allow 2>>/var/log/proglog') first_time = True while ('<no users>', '') in get_usernames (): diff -pruN /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GProvision GlusterEP/GProvision --- /home/harsha/gluster-work/current-rc3/gluster--mainline--1.0--patch-93/extensions/GlusterEP/GProvision 2006-08-04 12:39:07.000000000 -0700 +++ GlusterEP/GProvision 2006-08-11 18:07:50.000000000 -0700 @@ -37,9 +37,9 @@ def source_config (): cookie = os.popen ('ssh master-node cat /var/tmp/%s/cookie' % my_ip).readline ().strip () if not cookie: return None - spec_fd = os.popen ('ssh master-node cat system-images/%s/provision.spec' + spec_fd = os.popen ('ssh master-node cat system-images/%s/provision.xml' % cookie) - partlist = gdump_partlist (read_gdump (spec_fd)) + partlist = gdump_partlist (read_xml_to_gdump (spec_fd)) spec_fd.close () return partlist @@ -48,7 +48,9 @@ def source_action (partlist): global cookie parts = partlist.keys () parts = filter ((lambda x: - partlist[x]['FS'] != 'linux-swap' and partlist[x]['XFER'] == 'Y'), + partlist[x]['FS'] != 'linux-swap' \ + and partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y'), parts) parts.sort () no_parts = len (parts) @@ -68,14 +70,16 @@ def source_action (partlist): return def dest_config (partlist): - spec_fd = file ('/tmp/provision.spec', "w") - write_dump (spec_fd, partlist_gdump (partlist)) + spec_fd = file ('/tmp/provision.xml', "w") + write_gdump_to_xml (spec_fd, partlist_gdump (partlist)) spec_fd.flush () spec_fd.close () parts = partlist.keys () parts = filter ((lambda x: - partlist[x]['FS'] != 'linux-swap' and partlist[x]['XFER'] == 'Y'), + partlist[x]['FS'] != 'linux-swap' \ + and partlist[x].has_key ('XFER') \ + and partlist[x]['XFER'] == 'Y'), parts) parts.sort () no_parts = len (parts) @@ -90,12 +94,12 @@ def dest_config (partlist): title='[ Partition Assignment ]', yes_label='Auto', no_label='Manual'): - if os.system ('gmeta-installer -i /tmp/provision.spec -c /tmp/gprov.dest.cmds') == 0: + if os.system ('gmeta-installer -i /tmp/provision.xml -c /tmp/gprov.dest.cmds') == 0: return else: sys.exit (0) else: - os.system ('gmeta-installer --auto -i /tmp/provision.spec -c /tmp/gprov.dest.cmds') + os.system ('gmeta-installer --auto -i /tmp/provision.xml -c /tmp/gprov.dest.cmds') return def gprov_action (spec):
diff -pruN parted-1.7.0/parted/parted.c parted-1.7.0-h/parted/parted.c --- parted-1.7.0/parted/parted.c 2006-05-15 03:09:26.000000000 -0700 +++ parted-1.7.0-h/parted/parted.c 2006-08-03 17:28:27.000000000 -0700 @@ -1113,7 +1113,9 @@ partition_print_flags (PedPartition* par strncat (res, name, 21); } } - + if (first_flag) { + strncat (res, "*", 1); + } return res; } @@ -1340,7 +1342,7 @@ do_print (PedDevice** dev) str_list_append (row, name); str_list_append (row, part->fs_type ? - part->fs_type->name : ""); + part->fs_type->name : "*"); if (has_name) str_list_append (row, name);