Changeset 245 for trunk/packages/sipb-xen-guest-installer
- Timestamp:
- Nov 13, 2007, 5:10:10 AM (17 years ago)
- Location:
- trunk/packages/sipb-xen-guest-installer/sipb-xen-guest-installer
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-guest-installer/sipb-xen-guest-installer/files/usr/sbin/sipb-xen-duplicate
r231 r245 1 #!/usr/bin/env python 1 #!/usr/bin/env python2.5 2 2 3 3 import sys … … 5 5 import shutil 6 6 import tempfile 7 from subprocess import call, Popen7 from subprocess import call, check_call, Popen 8 8 9 9 # TODO: … … 72 72 print 'losetup -d '+destfs 73 73 74 def duplicate_by_vm(source, target, *args): 75 # source, target should be machine names 76 prefix = 'd_' 77 # 1. copy (by dd) source to target 78 source_device = '/dev/xenvg/' + prefix + source + '_hda' 79 target_device = '/dev/xenvg/' + prefix + target + '_hda' 80 #check_call(['/bin/dd', 'bs=1M', 'conv=nocreat', 81 # 'if='+source_device, 'of='+target_device]) 82 # 2. prepare arguments volume 83 args_volume = prefix+target+'_args' 84 args_device = '/dev/xenvg/' + args_volume 85 check_call(['/sbin/lvcreate', 'xenvg', '--name', args_volume, '--size', '4K']) 86 file(args_device, 'w').write('\n'.join(args) + '\n') 87 88 copier_device = '/dev/xenvg/d_wert_hda' 89 check_call(['/usr/sbin/xm', 'create', 'sipb-database', 90 'machine_name='+target, 91 'disks=' + ' '.join(['phy:'+copier_device+',hda,w', 92 'phy:'+target_device+',hdc,w', 93 'phy:'+args_device+',hdd,w'])]) 94 boot = 'c' 95 96 # XXX make this happen! check_call(['/sbin/lvremove', '-f', 'xenvg/'+args_volume]) 97 98 74 99 if __name__ == '__main__': 75 duplicate_ lv(*sys.argv[1:])100 duplicate_by_vm(*sys.argv[1:])
Note: See TracChangeset
for help on using the changeset viewer.