Skip to content

Instantly share code, notes, and snippets.

import xml.etree.ElementTree as ET
cvm_xml_file_in = "./cvm.xml"
cvm_xml_file_out = "./cvm-10GB.xml"
cvm_memory_gb = 10
cvm_memory_kb = cvm_memory_gb * 1024 * 1024
tree = ET.parse(cvm_xml_file_in)
root = tree.getroot()
function timestamp_us2jst($timestamp_us){
$ts_base = Get-Date "1970/1/1"
$ts_base = $ts_base.AddHours(9)
$ts_base.AddSeconds($timestamp_us / 1000000)
}
$images = Get-NTNXImage -IncludeVmDiskSizes
$ctrs = Get-NTNXContainer
$clsuter = Get-NTNXCluster
function timestamp_us2jst($timestamp_us){
$ts_base = Get-Date "1970/1/1"
$ts_base = $ts_base.AddHours(9)
$ts_base.AddSeconds($timestamp_us / 1000000)
}
VMNAME=hakobune01
IMAGELIST=all_images.txt
cat $IMAGELIST | tail -n +2 | awk '{print $1}' | while read IMG
do
acli vm.disk_create $VMNAME clone_from_image=$IMG
done
VMNAME=Nutanix-Clone-hakobune01
IMAGELIST=all_images.txt
N=0
tail -n +2 $IMAGELIST | while read L
do
IMG=`echo $L | awk '{print $1}'`
TYPE=`echo $L | awk '{print $2}'`
acli image.create $IMG image_type=$TYPE clone_from_vmdisk=vm:$VMNAME:scsi.$N
N=`expr $N + 1`
# SJIS を BOM なし に変換。
# 使用方法
# PS> to_utf8_noBOM.ps1 SJISファイル 出力ファイルをフルパス
# PS> .\to_utf8_noBOM.ps1 C:\work\sjis.txt C:\work\utf8.tx
$in_file_name = $args[0]
$utfbom_file_name = $in_file_name + "_utf-bom.txt"
$out_file_name = $args[1]
@gowatana
gowatana / hello.yml
Created November 20, 2017 16:02
JPOUG in15m6 Kubernetesのサンプル
---
apiVersion: v1
kind: Service
metadata:
name: hello-service
labels:
app: hello
spec:
type: NodePort
ports:
#cloud-config
users:
- name: ntnx-user
groups: wheel
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA(以下省略)
#!/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import requests
import datetime
args = sys.argv
conf_file = args[1]
REPOPATH=$1
[ "$REPOPATH" = "" ] && REPOPATH=/OVS
find $REPOPATH -name vm.cfg | while read L
do
echo -n `grep ^name $L | awk '{print $3}'`
echo -n ' '
echo `grep OVM_simple_name $L | awk '{print $3}'`
done