我是一个openstack初学者,我有一些关于热量的问题, 这是我自己写的一个hello-world热门模板:
heat_template_version: 2013-05-23
description: >
hello windows
parameters:
key_name:
type: string
default: demo_heat_key
instance_type:
type: string
default: t1.4core-4g-40g
constraints:
- allowed_values: [m1.sminy, m1.small, m1.medium, m1.large m1.xlarge, t1.2core-2g-40g, t1.4core-4g-40g]
image_id:
default: win2008srv-enterprise-v1.4.1
type: string
constraints:
- allowed_values: [ win2012-srv-v0.1, win2008srv-enterprise-v1.4.1 ]
resources:
iis:
type: OS::Nova::Server
properties:
image: { get_param: image_id }
flavor: { get_param: instance_type }
key_name: { get_param: key_name }
networks:
- network : public-ivt-direct-net
user_data: |
#ps1_helloworld
echo "hello world" > C:\hello.txt
但事实证明它当前无法执行。我认为这可能是因为srcipt执行Windows的角色不是当前的。所以我改变了我的模板:
heat_template_version: 2013-05-23
description: >
hello windows
parameters:
key_name:
type: string
default: demo_heat_key
instance_type:
type: string
default: t1.4core-4g-40g
constraints:
- allowed_values: [m1.sminy, m1.small, m1.medium, m1.large m1.xlarge, t1.2core-2g-40g, t1.4core-4g-40g]
image_id:
default: win2008srv-enterprise-v1.4.1
type: string
constraints:
- allowed_values: [ win2012-srv-v0.1, win2008srv-enterprise-v1.4.1 ]
resources:
iis:
type: OS::Nova::Server
properties:
image: { get_param: image_id }
flavor: { get_param: instance_type }
key_name: { get_param: key_name }
networks:
- network : public-ivt-direct-net
user_data: |
#ps1_install
Function ExecRetry($command){
$psi = New-object System.Diagnostics.ProcessStartInfo
$psi.UseShellExecute = $false
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$psi.FileName = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
$psi.Arguments = $command
$psi.UserName = "Administrator"
$Password = New-object System.Security.SecureString
$Password.AppendChar('T')
$Password.AppendChar('E')
$Password.AppendChar('S')
$Password.AppendChar('T')
$Password.AppendChar('@')
$Password.AppendChar('l')
$Password.AppendChar('y')
$Password.AppendChar('.')
$Password.AppendChar('c')
$Password.AppendChar('0')
$Password.AppendChar('m')
$psi.Password = $Password
$psi.Verb = "runas"
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $psi
$process.Start()
}
ExecRetry{
echo "abc" > C:\hello.txt
}
仍然无法执行。我无法找到它为什么会发生。有人可以帮助我。