Page MenuHomeVyOS Platform

Create image for MicroSoft Azure
Closed, ResolvedPublicFEATURE REQUEST

Details

Difficulty level
Hard (possibly days)

Event Timeline

It´s time to build something for Azure
i have an account in Azure for testing and would be glad participate in the coordinated effort

I'm not sure how much this will help, but I have a branch on a fork of vyos-build to build AMI's from ISO files: https://github.com/amosshapira/vyos-build/tree/make-ami

@amos.shapira Thanks!

My working branch is here: https://github.com/higebu/vyos-build/tree/azure
The image created by this doesn't work on Azure for now.

my azure image works on azure too. the image is here: https://dev.vyos.jp/vyos/dev-images/vyos_azure_image.img
and walinuxagent is running on it. I'm checking walinuxagent status.

I followed MS document. So I run waagent deprovision in image creation process. But waagent deprovision destroys the image.

Fixed waagent installation script is here: https://github.com/higebu/vyos-build/blob/azure/scripts/packer-scripts/azure.sh

waagent log

Oct 11 13:33:01 vyos systemd[1]: Started Microsft Azure Linux Agent.
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.139916 INFO Azure Linux Agent Version:2.2.0
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.158702 INFO OS: debian 8.9
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.159932 INFO Python: 2.7.9
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.161915 INFO Run daemon
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.163203 INFO No RDMA handler exists for distro='debian' version='8.9'
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.164401 INFO Clean protocol
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.166477 INFO run Ubuntu provision handler
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.167850 INFO Waiting cloud-init to copy ovf-env.xml.
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:04.169611 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:09.183584 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:14.190571 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:19.197662 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:24.204710 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:29.212321 INFO Wait for cloud-init to copy ovf-env.xml
Oct 11 13:37:14 vyos waagent[1716]: 2017/10/11 13:33:34.219404 INFO Wait for cloud-init to copy ovf-env.xml

Hi, can you please share the VHD file as well?

This comment was removed by higebu.

@higebu thanks for sharing! I was just able to make it work on Azure just last week, yaay :) Thanks though!

Played with the VHD and attempted to make it an image that could be deployed as a template. Looks like the following is lacking currently to allow provision support:

  • No support for provision credentials (that's ok for me)
  • WAAGENT can't ever report provision success to azure.

Diving into it, WAAGENT is waiting for cloud-init to copy the ovf-env.xml to the designated /var/lib area so it can parse. In testing, the build above doesn't have kernel UDF filesystem support so that is at least one blocker to prevent it from working:

DMESG:
[    1.457348] scsi 1:0:0:0: CD-ROM            Msft     Virtual CD/ROM   1.0  PQ: 0 ANSI: 5
[    1.461681] sr 1:0:0:0: [sr0] scsi3-mmc drive: 0x/0x tray
[    1.461685] cdrom: Uniform CD-ROM driver Revision: 3.20
[    1.462087] sr 1:0:0:0: Attached scsi CD-ROM sr0
[    1.462618] sr 1:0:0:0: Attached scsi generic sg2 type 5
root@vyos:/etc# mkdir /tmp/mnt
root@vyos:/etc# cd /tmp
root@vyos:/tmp# mount /dev/sr0 mnt
mount: unknown filesystem type 'udf'
root@vyos:/tmp#

So, for eventual image template/provision support, you'll definitely need to add UDF support to the kernel.

If anyone else tries to use this as an image, you can manually force WAAGENT to send "provision success" by doing the following:

root@vyos:/tmp# python
Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from azurelinuxagent.common.protocol.wire import WireProtocol
>>> from azurelinuxagent.common.protocol.restapi import ProvisionStatus
>>> from azurelinuxagent.common.osutil.default import DefaultOSUtil
>>> os_util = DefaultOSUtil()
>>> os_util.get_endpoint_from_leases_path('/var/lib/dhcp/dhclient_eth*.leases')
'168.63.129.16'
>>> wire = WireProtocol(os_util.get_endpoint_from_leases_path('/var/lib/dhcp/dhclient_eth*.leases'))
>>> wire.detect()
>>> status = ProvisionStatus(status="Ready")
>>> wire.report_provision_status(status)
>>> quit()
root@vyos:/tmp#

Those python commands will tell the WAAGENT to

  1. Figure out the Wire protocol endpoint IP from the leases file
  2. "detect" the VM info and wire proto status (will populate /var/lib/waagent dir with config info)
  3. Create a status object of "ready"
  4. Send the status object to Azure to end provisioning.

EDIT: added python commands below as easy cut-paste to have a image-spun VM mark as provisioned:

from azurelinuxagent.common.protocol.wire import WireProtocol
from azurelinuxagent.common.protocol.restapi import ProvisionStatus
from azurelinuxagent.common.osutil.default import DefaultOSUtil
os_util = DefaultOSUtil()
wire = WireProtocol(os_util.get_endpoint_from_leases_path('/var/lib/dhcp/dhclient_eth*.leases'))
wire.detect()
status = ProvisionStatus(status="Ready")
wire.report_provision_status(status)
quit()
syncer changed the subtype of this task from "Task" to "Feature Request".Oct 19 2018, 6:08 PM
syncer raised the priority of this task from Wishlist to Normal.
syncer moved this task from Needs Triage to Finished on the VyOS 1.2 Crux (VyOS 1.2.0-EPA3) board.

Ok, @UnicronNL we will need document procedure and add it to other guides