2014년 5월 10일 토요일

How to change network model for Windows instance in Openstack.

I posted about installing virtio drivers on Windows 2012R2. This was for as Openstack glance.

I chose this image to create a Windows virtual instance using nova command and I found the instance had no network connection at all after boot.


My last post described how to install virtio scsi controller (HDD) and baloon (memory) driver. Network was not included.

In Openstack, the compute node which has KVM hypervisor tries to add virtual network typed "virtio" for instances. My instance had also virtio one. 
$ virsh dumpxml 
...
    <interface type='bridge'>
      <mac address='fa:16:3e:82:9d:c3'/>
      <source bridge='br-int'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='a3bc1442-e121-4730-9f6f-1abff6466f11'/>
      </virtualport>
      <target dev='tapa3bc1442-e1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
Because I didn't installed virtio network driver for the glance image.
So, What I did to enable network of the instance was to change network type from "virtio" to "e1000" (default ethernet driver in Linux) of the glance image.

$ glance image-update --property hw_vif_model=e1000 $image_id2
+-------------------------+--------------------------------------+
| Property                | Value                                |
+-------------------------+--------------------------------------+
| Property 'hw_vif_model' | e1000                                |
| checksum                | 572850147e8f2cf1814e4953065a6421     |
| container_format        | bare                                 |
| created_at              | 2014-05-09T04:16:56                  |
| deleted                 | False                                |
| deleted_at              | None                                 |
| disk_format             | qcow2                                |
| id                      | 0ec11912-6634-4e09-bf09-c97373da2a47 |
| is_public               | True                                 |
| min_disk                | 0                                    |
| min_ram                 | 0                                    |
| name                    | windows2012r2                        |
| owner                   | None                                 |
| protected               | False                                |
| size                    | 10739318784                          |
| status                  | active                               |
| updated_at              | 2014-05-09T07:48:21                  |
+-------------------------+--------------------------------------+

After updating, I created the 2nd instance. This time, network in my 2nd instance is working well.


Let's look at how the network type is added for the 2nd instance.
$ virsh dumpxml 
...
    <interface type='bridge'>
      <mac address='fa:16:3e:57:cf:41'/>
      <source bridge='br-int'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='1a3a7af8-945e-425f-a39f-e6a48b7d87f3'/>
      </virtualport>
      <target dev='tap1a3a7af8-94'/>
      <model type='e1000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

As to install virtio network driver, I added it to my evernote. Please refer to this link for further information. Of course, you don't need to change network type in case you've already installed virtio network driver.

댓글 1개: