First, convert the image to raw:

qemu-img convert -p -f qcow2 -O raw jinstall-vqfx-10-f-17.4R1.16.img jinstall-vqfx-10-f-17.4R1.16.img.raw

Next, mount it on FreeBSD:

mdconfig -a -t vnode -u 0 -f jinstall-vqfx-10-f-17.4R1.16.img.raw

mount /dev/md0s1a /mnt

Next, go to /mnt/etc/config and edit vqxf-10000-factory.conf

root@dora:/mnt/etc # cat vqfx-10000-factory.conf
protocols {
igmp-snooping {
vlan default;
}
}
vlans {
default {
vlan-id 1;
}
}

forwarding-options {
storm-control-profiles default {
all;
}
}

interfaces {
em0 {
unit 0 {
family inet dhcp vendor-id Juniper-qfx5100-48s-6q
}
}
em1 {
unit 0 {
family inet {
address 169.254.0.2/24;
}
}
}
}
system {
commit {
factory-settings {
reset-virtual-chassis-configuration;
reset-chassis-lcd-menu;
}
}
}

system {
extensions {
providers {
juniper license-type juniper deployment-scope commercial;
}
}
}

system {
extensions {
providers {
chef {
license-type juniper deployment-scope commercial;
}
}
}
}
chassis {
auto-image-upgrade;
}

Unmount and remove md:

root@dora:~ # umount /mnt
root@dora:~ # mdconfig -d -u0

Convert back to img

qemu-img convert -p -f raw -O qcow2 jinstall-vqfx-10-f-17.4R1.16.img.raw jinstall-vqfx-10-f-17.4R1.16-ZTP.img

Done!

Note to future me: Don’t forget to modify the image!!

1973 glance image-update –property hw_disk_bus=ide 3f64824f-e720-403d-9672-8e6529ee79e7
1974 glance image-update –property hw_vif_model=e1000 3f64824f-e720-403d-9672-8e6529ee79e7

 

Leave a Reply