Advertisement
Guest User

esxi_install.log

a guest
May 19th, 2017
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 2017-05-19T19:19:50.341Z DEBUG    section-contents: b'\nimport subprocess, os, uuid, syslog\n\nvsan_syslog_key = "VSAN-KS"\ndebug = False\n\nwith open ("/tmp/vsandisktype", "r") as myfile:\n    vsan_disk_type=myfile.read().replace(\'\\n\', \'\')\n\ndef execute(cmd,shell):\n    proc = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE)\n    return proc.communicate()[0].decode()\n\n# Enable vSAN traffic\ndef enableVsanTraffic():\n  vsan_traffic_cmd = "localcli vsan network ip add -i vmk0"\n  syslog.syslog(vsan_syslog_key + " Enabling vSAN traffic on vmk0: " + vsan_traffic_cmd)\n  if debug == False:\n    os.system(vsan_traffic_cmd)\n\n# Enable Dedupe/Compression\ndef enableDedupeCompression():\n  space_eff_cmd = "localcli system settings advanced set -o /VSAN/StorageEfficiency -i 1"\n  syslog.syslog(vsan_syslog_key + " Enabling vSAN Dedupe/Compression command: " + space_eff_cmd)\n  if debug == False:\n    os.system(space_eff_cmd)\n\n# Build VSAN Disk Group command based on vdq -q output\ndef createVsanAFDiskGroup():\n\toutput = execute([\'/sbin/vdq\',\'-q\'],False)\n\n\tcapacityDisk = None\n\tcachingDisk = None\n\tlargestDisk = None\n\tlargestDiskSize = None\n\tusbDevice = None\n\n\tresults = eval(output)\n\tfor disk in results:\n\t\tdiskId = disk[\'Name\']\n\n\t\tif disk[\'State\'] == \'Eligible for use by VSAN\':\n\t\t\tsyslog.syslog(vsan_syslog_key + " Found Disk: " + diskId)\n\n\t\t\tdiskcapacity_cmd = "localcli storage core device capacity list -d " + diskId + " | tail -1 | awk \'{print $5}\'"\n\t\t\tsyslog.syslog(vsan_syslog_key + " Running disk capacity command: " + diskcapacity_cmd)\n\t\t\tps = subprocess.Popen(diskcapacity_cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)\n\t\t\tdiskSize = ps.communicate()[0].decode().strip()\n\n\t\t\tif largestDisk == None:\n\t\t\t\tlargestDisk = diskId\n\t\t\t\tlargestDiskSize = diskSize\n\t\t\telse:\n\t\t\t\tif diskSize > largestDiskSize:\n\t\t\t\t\tcapacityDisk = diskId\n\t\t\t\t\tcachingDisk = largestDisk\n\t\t\t\telse:\n\t\t\t\t\tcapacityDisk = largestDisk\n\t\t\t\t\tcachingDisk = diskId\n\n\t\t\tsyslog.syslog(vsan_syslog_key + " Largest Capacity Disk so far: " + diskId + " (" + diskSize + ")")\n\n\t\tif disk[\'State\'] == \'Ineligible for use by VSAN\' and disk[\'VSANUUID\'] == "":\n\t\t\tusbDevice = diskId\n\t\t\tfo = open("/tmp/usbDevice.txt", "w")\n\t\t\tfo.write(usbDevice)\n\t\t\tfo.close()\n\n\tif cachingDisk != None and capacityDisk != None:\n\t\t# Tag Capacity Disk\n\t\tdisktag_cmd = "localcli vsan storage tag add -d " + capacityDisk + " -t capacityFlash"\n\t\tsyslog.syslog(vsan_syslog_key + " Running disk capacity tagging command: " + disktag_cmd)\n\t\tif debug == False:\n\t\t\tos.system(disktag_cmd)\n\n\t\t# Create VSAN Disk Group\n\t\tdiskgroup_cmd = "localcli vsan storage add -s " + cachingDisk + " -d " + capacityDisk\n\t\tsyslog.syslog(vsan_syslog_key + " Running disk group create command: " + diskgroup_cmd)\n\t\tif debug == False:\n\t\t\tos.system(diskgroup_cmd)\n\ndef createVsanHybridDiskGroup():\n\toutput = execute([\'/sbin/vdq\',\'-q\'],False)\n\n\tcapacityDisk = None\n\tcachingDisk = None\n\tlargestDisk = None\n\tlargestDiskSize = None\n\tusbDevice = None\n\n\tresults = eval(output)\n\tfor disk in results:\n\t\tdiskId = disk[\'Name\']\n\n\t\tif disk[\'State\'] == \'Eligible for use by VSAN\':\n\t\t\tsyslog.syslog(vsan_syslog_key + " Found Disk: " + diskId)\n\n\t\t\tdiskcapacity_cmd = "localcli storage core device capacity list -d " + diskId + " | tail -1 | awk \'{print $5}\'"\n\t\t\tsyslog.syslog(vsan_syslog_key + " Running disk capacity command: " + diskcapacity_cmd)\n\t\t\tps = subprocess.Popen(diskcapacity_cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)\n\n\t\t\tif disk[\'IsSSD\'] == \'1\':\n\t\t\t\tsyslog.syslog(vsan_syslog_key + " Found SSD " + diskId)\n\t\t\t\tcachingDisk = diskId\n\n\t\t\tif disk[\'IsSSD\'] == \'0\':\n\t\t\t\tsyslog.syslog(vsan_syslog_key + " Found HDD " + diskId)\n\t\t\t\tcapacityDisk = diskId\n\n\t\tif disk[\'State\'] == \'Ineligible for use by VSAN\' and disk[\'VSANUUID\'] == "":\n\t\t\tusbDevice = diskId\n\t\t\tfo = open("/tmp/usbDevice.txt", "w")\n\t\t\tfo.write(usbDevice)\n\t\t\tfo.close()\n\n\tif cachingDisk != None and capacityDisk != None:\n\t\t# Create VSAN Disk Group\n\t\tdiskgroup_cmd = "localcli vsan storage add -s " + cachingDisk + " -d " + capacityDisk\n\t\tsyslog.syslog(vsan_syslog_key + " Running disk group create command: " + diskgroup_cmd)\n\t\tif debug == False:\n\t\t\tos.system(diskgroup_cmd)\n\ndef createVsanCluster():\n\tcluster_cmd = "localcli vsan cluster new"\n\tsyslog.syslog(vsan_syslog_key + " Running VSAN cluster create command: " + cluster_cmd)\n\tif debug == False:\n\t\tos.system(cluster_cmd)\n\nenableVsanTraffic()\nif vsan_disk_type == "HYBRID":\n\tcreateVsanHybridDiskGroup()\nelse:\n\tcreateVsanAFDiskGroup()\n\tenableDedupeCompression()\ncreateVsanCluster()\n\n'
Advertisement
RAW Paste Data Copied
Advertisement