Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131452167
D23804.id72548.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D23804.id72548.diff
View Options
Index: release/Makefile.azure
===================================================================
--- release/Makefile.azure
+++ release/Makefile.azure
@@ -8,10 +8,15 @@
AZURE_IMG?= ${.OBJDIR}/azure.vhdf
AZURE_UPLOAD_TGTS= azure-check-depends \
azure-do-upload
+# we do not yet have a better way to deal with the "must be run interactively"
+# thing, so this is a fail-safe "do not do anything."
+.if !defined(AZURE_LOGIN_SKIP) || empty(AZURE_LOGIN_SKIP)
+AZURE_UPLOAD_TGTS= azure-do-login
+.endif
CLEANFILES+= ${AZURE_UPLOAD_TGTS}
.if defined(AZURE_UPLOAD_CONF) && !empty(AZURE_UPLOAD_CONF)
-. for VAR in _STORAGE _ACCOUNT _KEY
+. for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY
AZURE${VAR}!= grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F' ' '{print $$2}'
. endfor
.endif
@@ -20,34 +25,56 @@
SNAPSHOT_DATE!= date +-%Y-%m-%d
.endif
-AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.vhd
+AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}
+START_DATE!= date -v-1d -I -u
+EXPIRY_DATE!= date -v+1m -I -u
+
azure-upload: ${AZURE_UPLOAD_TGTS}
azure-check-depends:
-.for VAR in _STORAGE _ACCOUNT _KEY
+.for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY
. if !defined(AZURE${VAR}) || empty(AZURE${VAR})
@echo "Variable AZURE${VAR} cannot be empty."
@false
. endif
.endfor
-.if !exists(/usr/local/bin/azure)
-. if !exists(/usr/local/bin/npm)
-. if !exists(${PORTSDIR}/www/npm/Makefile)
-. if !exists(/usr/local/sbin/pkg-static)
+.if !exists(/usr/local/bin/az)
+. if !exists(${PORTSDIR}/sysutils/py-azure-cli/Makefile)
+. if !exists(/usr/local/sbin/pkg-static)
env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
-. endif
- env ASSUME_ALWAYS_YES=yes pkg install -y www/npm
-. else
- make -C ${PORTSDIR}/www/npm BATCH=1 all install clean
. endif
+ env ASSUME_ALWAYS_YES=yes pkg install -y py37-azure-cli
+. else
+ make -C ${PORTSDIR}/sysutils/py-azure-cli BATCH=1 all install clean
. endif
- npm install -g azure-cli
.endif
+azure-do-login:
+ @echo "This requires human interaction, which is not yet supported."
+ @echo "Please run \`az login\` manually."
+ @true
+
azure-do-upload:
- /usr/local/bin/azure storage blob upload \
- ${AZURE_IMG} ${AZURE_STORAGE} ${AZURE_TARGET} \
- -t page -a ${AZURE_ACCOUNT} -k "${AZURE_KEY}"
+ /usr/local/bin/az storage blob upload \
+ --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \
+ --container-name ${AZURE_STORAGE} --type page \
+ --file ${AZURE_IMG} --name ${AZURE_TARGET}.vhd
+ /usr/local/bin/az image create \
+ --resource-group ${AZURE_RESOURCEGROUP} --name ${AZURE_TARGET} \
+ --os-type Linux \
+ --source https://${AZURE_ACCOUNT}.blob.core.windows.net/${AZURE_STORAGE}/${AZURE_TARGET}.vhd
+ @echo "The image access url with shared access signature is:"
+ @/usr/local/bin/az storage container generate-sas \
+ --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \
+ --name ${AZURE_STORAGE} \
+ --permissions lr \
+ --start ${START_DATE} \
+ --expiry ${EXPIRY_DATE}
+ @echo "Please go to Microsoft Partner Center to create a new SKU and publish:"
+ @echo "https://partner.microsoft.com/dashboard/commercial-marketplace/overview"
+ @echo "After the new SKU goes live, you can delete the private image file with:"
+ @echo /usr/local/bin/az storage blob delete \
+ --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \
+ --container-name ${AZURE_STORAGE} --name ${AZURE_TARGET}.vhd
touch ${.OBJDIR}/${.TARGET}
-
Index: release/Makefile.vm
===================================================================
--- release/Makefile.vm
+++ release/Makefile.vm
@@ -16,7 +16,8 @@
QCOW2_DESC= Qemu, KVM disk image
RAW_DESC= Unformatted raw disk image
-CLOUDWARE?= EC2 \
+CLOUDWARE?= AZURE \
+ EC2 \
GCE \
VAGRANT-VIRTUALBOX \
VAGRANT-VMWARE
@@ -170,7 +171,7 @@
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS}
.endif
-.include "${.CURDIR}/Makefile.ec2"
.include "${.CURDIR}/Makefile.azure"
+.include "${.CURDIR}/Makefile.ec2"
.include "${.CURDIR}/Makefile.gce"
.include "${.CURDIR}/Makefile.vagrant"
Index: release/tools/azure.conf
===================================================================
--- release/tools/azure.conf
+++ release/tools/azure.conf
@@ -3,25 +3,49 @@
# $FreeBSD$
#
+# Convension of Linux type VM on Azure is 32G
+export VMSIZE=32G
+
# Set to a list of packages to install.
-# Example:
-#export VM_EXTRA_PACKAGES="www/apache24"
-export VM_EXTRA_PACKAGES="sysutils/azure-agent"
+export VM_EXTRA_PACKAGES="azure-agent python python3 firstboot-freebsd-update firstboot-pkgs"
# Set to a list of third-party software to enable in rc.conf(5).
-# Example:
-#export VM_RC_LIST="apache24"
-export VM_RC_LIST=
+export VM_RC_LIST="ntpd sshd waagent firstboot_freebsd_update"
+# No swap space; waagent will allocate swap space on the resource disk.
+# See ResourceDisk.EnableSwap and ResourceDisk.SwapSizeMB in waagent.conf
+export NOSWAP=YES
+
vm_extra_pre_umount() {
- chroot ${DESTDIR} ln -s /usr/local/sbin/waagent /usr/sbin/waagent
- chroot ${DESTDIR} /usr/local/sbin/waagent -verbose -install
+ # The firstboot_pkgs rc.d script will download the repository
+ # catalogue and install or update pkg when the instance first
+ # launches, so these files would just be replaced anyway; removing
+ # them from the image allows it to boot faster.
+ mount -t devfs devfs ${DESTDIR}/dev
+ chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
+ /usr/sbin/pkg delete -f -y pkg
+ umount ${DESTDIR}/dev
+ rm ${DESTDIR}/var/db/pkg/repo-*.sqlite
+
yes | chroot ${DESTDIR} /usr/local/sbin/waagent -deprovision
- echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf
- echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
- echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf
- echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf
- echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf
+
+ cat << EOF >> ${DESTDIR}/etc/rc.conf
+ifconfig_hn0="SYNCDHCP"
+ntpd_sync_on_start="YES"
+EOF
+
+ cat << EOF >> ${DESTDIR}/boot/loader.conf
+autoboot_delay="-1"
+beastie_disable="YES"
+loader_logo="none"
+hw.memtest.tests="0"
+console="comconsole vidconsole"
+comconsole_speed="115200"
+mlx4en_load="YES"
+mlx5en_load="YES"
+EOF
+
+ touch ${DESTDIR}/firstboot
rm -f ${DESTDIR}/etc/resolv.conf
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 9, 5:07 AM (18 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23484867
Default Alt Text
D23804.id72548.diff (6 KB)
Attached To
Mode
D23804: Update Azure release bits
Attached
Detach File
Event Timeline
Log In to Comment