2017-08-24 16 views
1

これは、terraformを使用してvSphere VMを作成する私の最初の試みです。 VMは正常に作成されますが、完了するまでに7分かかります。ここに私が取ったステップがあります。Terraform vSphereスローブート

  • Ubuntu 16.04 ovaを手動でアップロードします。
  • イメージをテンプレートに手動で変換します。
  • GUIを使用して、テンプレートからVMを手動で作成します。 VMが起動するまでに約12秒かかります( )。
  • テンプレートを指すterraformを使用してVMを作成します。これには分がかかります。

terraformを使用すると、手動で作成されたVMと同じようにVMブートシーケンスが進行し、約6分半の間、次のメッセージが表示されます。

[ 12.109016] blk_update_request: I/O error, dev fd0, sector 0 

エラーメッセージは、手動およびterraform VM作成の両方で約6回繰り返されます。しかし、手動で作成するときには、ほとんどすぐにログインプロンプトに移動します。テラフォームの作成中、このメッセージで約6分半の間ハングしてから、ログインプロンプトに進みます。なぜそれがテラフォームの作成中にぶら下がっているのか?

resource "vsphere_virtual_machine" "hellovm" { 
    name = "hellovm2" 
    vcpu = 1 
    memory = 1024 
    datacenter = "Lab09-Datacenter01" 

    network_interface { 
    label = "Lab09-NetA" 
    } 

    disk { 
    template = "${var.vmtemp}" 
    type = "thin" 
    datastore = "${var.vmdatastore}" 
    } 
} 

intance.tf

はUbuntuが

ubuntu dmesg

をdmesgのSTDOUT

Macbook12:concoursebootstrap steve$ terraform apply 
vsphere_folder.concourse-base: Refreshing state... (ID: Lab09-Datacenter01/VirtualMachines) 
vsphere_virtual_machine.hellovm: Refreshing state... (ID: hellovm) 
vsphere_virtual_machine.hellovm: Creating... 
    datacenter:        "" => "Lab09-Datacenter01" 
    detach_unknown_disks_on_delete:   "" => "false" 
    disk.#:         "" => "1" 
    disk.3867083049.bootable:    "" => "" 
    disk.3867083049.controller_type:  "" => "scsi" 
    disk.3867083049.datastore:    "" => "nfs-lab09-vol1" 
    disk.3867083049.iops:     "" => "" 
    disk.3867083049.keep_on_remove:   "" => "" 
    disk.3867083049.key:     "" => "<computed>" 
    disk.3867083049.name:     "" => "" 
    disk.3867083049.size:     "" => "" 
    disk.3867083049.template:    "" => "ubuntu-16.04-server-cloudimg-amd64" 
    disk.3867083049.type:     "" => "thin" 
    disk.3867083049.uuid:     "" => "<computed>" 
    disk.3867083049.vmdk:     "" => "" 
    domain:         "" => "vsphere.local" 
    enable_disk_uuid:      "" => "false" 
    linked_clone:       "" => "false" 
    memory:         "" => "1024" 
    memory_reservation:      "" => "0" 
    moid:         "" => "<computed>" 
    name:         "" => "hellovm" 
    network_interface.#:     "" => "1" 
    network_interface.0.ip_address:   "" => "<computed>" 
    network_interface.0.ipv4_address:  "" => "<computed>" 
    network_interface.0.ipv4_gateway:  "" => "<computed>" 
    network_interface.0.ipv4_prefix_length: "" => "<computed>" 
    network_interface.0.ipv6_address:  "" => "<computed>" 
    network_interface.0.ipv6_gateway:  "" => "<computed>" 
    network_interface.0.ipv6_prefix_length: "" => "<computed>" 
    network_interface.0.label:    "" => "Lab09-NetA" 
    network_interface.0.mac_address:  "" => "<computed>" 
    network_interface.0.subnet_mask:  "" => "<computed>" 
    skip_customization:      "" => "false" 
    time_zone:        "" => "Etc/UTC" 
    uuid:         "" => "<computed>" 
    vcpu:         "" => "1" 
vsphere_virtual_machine.hellovm: Still creating... (10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (1m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (2m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (3m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (4m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (5m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m40s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (6m50s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (7m0s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (7m10s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (7m20s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (7m30s elapsed) 
vsphere_virtual_machine.hellovm: Still creating... (7m40s elapsed) 
vsphere_virtual_machine.hellovm: Creation complete (ID: hellovm) 

Apply complete! Resources: 1 added, 0 changed, 0 destroyed. 

を適用テラフォームVMの後

テラフォームのトレース出力が作成され、それがブート

terrafrom trace output

テラフォーム出力の残りの部分を待っています。その後、繰り返しログの数分以下

terraform trace output part 2

答えて

1

は、vSphereプロバイダでの作業問題が発生していることを申し訳ありません!

ログに表示され、設定を調べることで、起動時に必ずしもVMにIPアドレスが設定されていない可能性があります。 Terraform vSphereプロバイダは現在、すべてのインターフェイスが仮想マシンの状態を読み取る前に、ネットワーク接続(VMwareツールを介して報告)を待っています。これはVM作成の場合も同様です。これは問題の原因である可能性があります(特に、ログにwaiting for interfaces to appearメッセージが表示された後の長い待機から判断して)。

設定を確認すると、TFコードにipv4_addressが割り当てられていないことがわかります。つまり、TerraformはDHCPを使用するようにインターフェイスに指示するVMカスタマイズ仕様を送信します。ネットワークにDHCPがない場合は、それが問題の一部になる可能性があります。

私が推薦する何を:あなたは、あなたが作業しているネットワーク上のDHCPを持っていない場合は、ipv4_addressと関連オプションを使用して仮想マシンにIPアドレスを割り当てて、再度適用してみてください

  • 。また、問題のネットワークにDHCPをインストールして、TFコードでIPアドレスを割り当てる必要がなくなります。
  • VMにVMwareツールがインストールされていることを確認します。また、Ubuntuにopen-vm-toolsパッケージをインストールすることもできます。
  • 最後に、問題が解決しない場合は、VMのカスタマイズログを確認できます。これらのログは、OSの/var/log/vmware-imc/toolsDeployPkg.logにあります。 More info on Linux customization

これで問題が解決するかどうか教えてください。

+0

提案に感謝します。私はそれを試して、結果を投稿します。 – ptsw

+1

こんにちはvancluever、IP割り当てを静的な値に変更してその部分を削除しようとしましたが、展開時間に変更はありませんでした。 toolsDeployPkg.logのログを確認した結果、アクションに関連するタイムスタンプがなくなり、出力に原因がわかりにくくなりました。カーネルの起動プロセスとログインプロンプトの表示との間に何が起こっているかを知るための他の提案がありますか? – ecoles

+0

@ptswこの問題に関するラジオ・サイレンスは申し訳ありません!私は、プラグインのバージョン0.3.0をリリースしたことで、カスタマイズとネットワークウェイターの動作を大幅に変更していると言いたいと思っています。さらに、これらの変更のどちらもあなたのために問題を解決しない場合、新しい['wait_for_guest_net'](https://www.terraform.io/docs/providers/vsphere)を設定することで、ウェイターを完全にスキップすることができます。 /r/virtual_machine.html#wait_for_guest_net)オプションを 'false'に設定します。それがどうなるか教えてください! – vancluever

関連する問題