コード例 #1
0
def get_property(name):

    try:
        result = re.search(append(name, '\s*=\s*([0-9]+)\,'), output)
    except:
        return None

    return result.group(1)
コード例 #2
0
ファイル: install.py プロジェクト: autovmnet/kvm
# VNC password
vnc_password = ''

for i in range(9):
  vnc_password = vnc_password + random.choice(string.ascii_lowercase + string.ascii_lowercase)

# VNC key
vnc_key = generate_key(vnc_password)

data.update({'RemoteDisplay.vnc.enabled': 'TRUE', 'RemoteDisplay.vnc.port': vnc_port, 'RemoteDisplay.vnc.password': vnc_password, 'RemoteDisplay.vnc.key': vnc_key})

# Prepare template
for arg in data:
  
  template = append(template, '\n', space(arg, '='), '"', data[arg], '"')

if 'mikrotik' in os_name:
  template = template.replace('scsi0', 'ide0')

# Status
write('status', '2:25')
  
def delete(serve, machine):
  
  request = VI.Destroy_TaskRequestMsg()

  _this = request.new__this(machine._mor)
  _this.set_attribute_type(machine._mor.get_attribute_type())

  request.set_element__this(_this)
コード例 #3
0
ファイル: install.py プロジェクト: meliholog/autovm
if 'centos' in os_name:
    scsi = 'lsilogic'

if 'windows' in os_name:

    if '2003' in os_name:
        scsi = 'lsilogic'
    else:
        scsi = 'lsisas1068'

data.update({'scsi0.virtualDev': scsi})

# Prepare template
for arg in data:

    template = append(template, '\n', space(arg, '='), '"', data[arg], '"')

# Status
write('status', '2:25')


def delete(serve, machine):

    request = VI.Destroy_TaskRequestMsg()

    _this = request.new__this(machine._mor)
    _this.set_attribute_type(machine._mor.get_attribute_type())

    request.set_element__this(_this)

    try:
コード例 #4
0
ファイル: console.py プロジェクト: iii80/autovm
        except:
            response(False)

        if online:
            try:
                machine.power_off()
            except:
                response(False)

        try:
            machine.set_extra_config(settings)
        except:
            response(False)

        try:
            machine.power_on()
        except:
            response(False)

# VNC address
vnc_address = append(server_address, ':', first)

try:
    os.system(
        space('bash',
              path(base, '..', '..', '..', 'web/console/utils/launch.sh'),
              '--vnc', vnc_address, '--listen', port, '> /dev/null 2>&1 &'))
except:
    response(False)

response(True, {'password': password})
コード例 #5
0
ssh = get_ssh()

if not ssh:
    response(False)

address = get_arg('ip[ip]')

try:
    result = ssh.run(['sh', '-c', 'vim-cmd vmsvc/getallvms'])
except:
    response(False)

output = result.output

try:
    result = re.search(append('([0-9]+).*', address, '.*'), output)
except:
    response(False)

machine = result.group(1)

if not machine:
    response(False)

try:
    result = ssh.run(
        ['sh', '-c',
         space('vim-cmd', 'vmsvc/get.summary', machine)])
except:
    response(False)