Skip to content

Commit

Permalink
Merge pull request #11 from andreygubarev/feature-nic-model
Browse files Browse the repository at this point in the history
use virtio-net-pci model for network in user mode to support debian
  • Loading branch information
andreygubarev authored Jun 6, 2023
2 parents a96c343 + 5959f17 commit ab04773
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Supported platforms:

Support guest OS:
* Ubuntu 20.04 LTS (aarch64, x86_64)
* Debian 11 (x86_64)
* Ubuntu 22.04 LTS (aarch64, x86_64)
* Debian 11 (aarch64, x86_64)

Support of other platforms and guest OS is possible, but not tested. Please, open an issue if you want to add support for other platforms.

Expand Down Expand Up @@ -55,18 +56,42 @@ dependency:
driver:
name: molecule-qemu
platforms:
- name: ubuntu-1
- name: ubuntu-focal-arm64
image: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-arm64.img
image_checksum: sha256:https://cloud-images.ubuntu.com/focal/current/SHA256SUMS
image_arch: aarch64
ssh_port: 10022
ssh_port: 10000
ssh_user: ubuntu
- name: ubuntu-2
image: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-arm64.img
- name: ubuntu-focal-amd64
image: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
image_checksum: sha256:https://cloud-images.ubuntu.com/focal/current/SHA256SUMS
image_arch: x86_64 # default
ssh_port: 10023
image_arch: x86_64
ssh_port: 10001
ssh_user: ubuntu
- name: ubuntu-jammy-arm64
image: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
image_checksum: sha256:https://cloud-images.ubuntu.com/jammy/current/SHA256SUMS
image_arch: aarch64
ssh_port: 10002
ssh_user: ubuntu
- name: ubuntu-jammy-amd64
image: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
image_checksum: sha256:https://cloud-images.ubuntu.com/jammy/current/SHA256SUMS
image_arch: x86_64
ssh_port: 10003
ssh_user: ubuntu
- name: debian-bullseye-arm64
image: https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-arm64.qcow2
image_checksum: sha512:https://cloud.debian.org/images/cloud/bullseye/latest/SHA512SUMS
image_arch: aarch64
ssh_port: 10004
ssh_user: debian
- name: debian-bullseye-amd64
image: https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2
image_checksum: sha512:https://cloud.debian.org/images/cloud/bullseye/latest/SHA512SUMS
image_arch: x86_64
ssh_port: 10005
ssh_user: debian
provisioner:
name: ansible
verifier:
Expand Down Expand Up @@ -120,6 +145,7 @@ verifier:
* [Ansible](https://www.ansible.com/)
* [Molecule](https://molecule.readthedocs.io/en/latest/)
* [QEMU](https://www.qemu.org/)
* [QEMU BIOS](https://packages.debian.org/bullseye/qemu-efi-aarch64)

## QEMU vmnet-shared networking

Expand Down
Binary file added molecule_qemu/playbooks/QEMU_EFI.fd
Binary file not shown.
12 changes: 6 additions & 6 deletions molecule_qemu/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@
register: ssh_keypair

- name: Fetch ARM VMs bios
ansible.builtin.get_url:
url: "https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd"
checksum: "sha256:42f915c44de6858f69ae6f1ffc9eaa3884d1b2ca97a7537d81312fb0dfd712cd"
ansible.builtin.copy:
src: "QEMU_EFI.fd"
dest: "{{ molecule_driver_directory }}/QEMU_EFI.fd"
checksum: "sha256:d28d0f28b31b9982f0bed6123d9e1b9c4b9f49aa57de159808487318056ba89b"
mode: "0644"
when: "'aarch64' in molecule_instances | map(attribute='image_arch') | list | unique"

Expand Down Expand Up @@ -245,7 +245,7 @@
-nic vmnet-shared,model=virtio-net-pci,mac={{ item.vm_network_mac }}
{% endif %}
{% if item.vm_network == 'user' %}
-nic user,hostfwd=tcp::{{ item.ssh_port }}-:22
-nic user,model=virtio-net-pci,hostfwd=tcp::{{ item.ssh_port }}-:22
{% endif %}
-display none
-daemonize
Expand Down Expand Up @@ -318,8 +318,8 @@
ansible.builtin.wait_for:
host: "{{ molecule_instances_ipv4[item.name] }}"
port: "{{ item.ssh_port }}"
delay: 5
timeout: 180
delay: 30
timeout: "{{ 60 * molecule_instances | length }}"
search_regex: "OpenSSH"
loop: "{{ molecule_instances }}"
loop_control:
Expand Down

0 comments on commit ab04773

Please sign in to comment.