Closed hbonath closed 5 years ago
I didn't consider Hyper-V and OpenStack but it is absolutely possible, of course.
My preference is detect the cloud automatically in order to have one image that runs "everywhere". But I have an idea how to make it optionally configurable and I'll probably add this later.
But it would be even nicer if we could find a nice heuristic to detect if it runs under OpenStack and not Azure. But maybe I should just fallback to OpenStack if it cannot find the Azure stack.
No I completely get the idea of having it "just work" and auto-detect the undercloud.
What if you simply probed the various metadata methods to find out the cloud type? (I think cloud-init might possibly work this way...?)
If there is any info I can provide you that may help from my Openstack/HyperV deployment such as a dmesg or any other output let me know.
Could you try the version from the probe-order
branch?
It allows you to specify and overwrite the probe order, for example
# cloud-agent -c openstack,cloudinit,azure hvn0
See: https://github.com/reyk/cloud-agent/tree/probe-order and https://github.com/reyk/cloud-agent/pull/7
This looks great, I most likely will not be able to test for the next day or two but will report back once I do. Thank you for your work on this!
Thanks, take your time! I might rebase and force-push this branch again but it shouldn’t change the test.
I merged the branch into master. Testing is still very welcome.
Finally was able to build a fresh image and run a proper test, with success! Nice work! ;-)
The OpenBSD install used in the image was 6.5 -release.
I used the cloud-agent flags: -v -c openstack -r sd0 "\$if"
in /etc/hostname.hvn0 on Openstack Stein/Hyper-V Server 2016.
cloud-agent was built from 39f33c76a43f3ecf24121b16f3d681fb8f7d8bd4
Here is my dmesg + boot output from the test instance:
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2019 OpenBSD. All rights reserved. https://www.OpenBSD.org
OpenBSD 6.5 (GENERIC) #3: Sat Apr 13 14:42:43 MDT 2019
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 788463616 (751MB)
avail mem = 755109888 (720MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf8ec0 (216 entries)
bios0: vendor American Megatrends Inc. version "090006" date 04/28/2016
bios0: Microsoft Corporation Virtual Machine
acpi0 at bios0: rev 0
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP WAET SLIC OEM0 SRAT APIC OEMB
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihve0 at acpi0
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz, 3197.27 MHz, 06-3a-09
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,RDTSCP,LONG,LAHF,FSGSBASE,SMEP,ERMS,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 198MHz
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 11, 24 pins, remapped
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C1(@1 halt!)
acpipci0 at acpi0 PCI0: _OSC failed
acpicmos0 at acpi0
"VMBus" at acpi0 not configured
"Hyper_V_Gen_Counter_V1" at acpi0 not configured
pvbus0 at mainbus0: Hyper-V 10.0
hyperv0 at pvbus0: protocol 3.0, features 0x2e7f
hyperv0: heartbeat, kvp, shutdown, timesync
hvs0 at hyperv0 channel 2: ide, protocol 6.2
scsibus1 at hvs0: 2 targets
sd0 at scsibus1 targ 0 lun 0: <FreeNAS, iSCSI Disk, 0123> SCSI0 0/direct fixed
sd0: 16384MB, 512 bytes/sector, 33554432 sectors
hvs1 at hyperv0 channel 14: scsi, protocol 6.2
scsibus2 at hvs1: 2 targets
hvn0 at hyperv0 channel 15: NVS 5.0 NDIS 6.30, address fa:16:3e:fd:ca:95
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82443BX" rev 0x03
pcib0 at pci0 dev 7 function 0 "Intel 82371AB PIIX4 ISA" rev 0x01
pciide0 at pci0 dev 7 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
pciide0: channel 0 disabled (no drives)
pciide0: channel 1 disabled (no drives)
piixpm0 at pci0 dev 7 function 3 "Intel 82371AB Power" rev 0x02: SMBus disabled
vga1 at pci0 dev 8 function 0 "Microsoft VGA" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd0a (6122c4d45285fe5d.a) swap on sd0b dump on sd0b
Automatic boot in progress: starting file system checks.
/dev/sd0a (6122c4d45285fe5d.a): file system is clean; not checking
/dev/sd0k (6122c4d45285fe5d.k): file system is clean; not checking
/dev/sd0d (6122c4d45285fe5d.d): file system is clean; not checking
/dev/sd0f (6122c4d45285fe5d.f): file system is clean; not checking
/dev/sd0g (6122c4d45285fe5d.g): file system is clean; not checking
/dev/sd0h (6122c4d45285fe5d.h): file system is clean; not checking
/dev/sd0j (6122c4d45285fe5d.j): file system is clean; not checking
/dev/sd0i (6122c4d45285fe5d.i): file system is clean; not checking
/dev/sd0e (6122c4d45285fe5d.e): file system is clean; not checking
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
pf enabled
machdep.allowaperture: 0 -> 2
starting network
hvn0: bound to 192.168.47.153 from 192.168.47.100 (fa:16:3e:a5:db:ab)
growing sd0k from 1759MB to 5859MB
fd1 at fdc0 drive 1: density unknown
trycloud: openstack
main: openstack
agent_configure: hostname test-1.novalocal
agent_configure: username puffy
agent_configure: key ssh-rsa AAAAB3NzaC1yc2EXXXXXXXXXXXXXXXXX1nLsadrqVHwbUcbWqokdcjUdachMZ henry@xxx-redacted-xxx
agent_configure: /etc/rc.firsttime
reordering libraries: done.
openssl: generating isakmpd/iked RSA keys... done.
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: no core dump
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
running rc.sysmerge
starting network daemons: sshd smtpd sndiod.
running rc.firsttime
Path to firmware: http://firmware.openbsd.org/firmware/6.5/
Installing: intel-firmware
Checking for available binary patches...
Run syspatch(8) to install:
001_rip6cksum 002_srtp 003_mds 004_bgpd 005_libssl
cloud-agent: #############################################################
cloud-agent: -----BEGIN SSH HOST KEY FINGERPRINTS-----
cloud-agent: 1024 SHA256:9GHEekbd1GDu+iqCa869WE3nMKDA0PEC8CPs5aHgWOA root@test-1.novalocal (DSA)
cloud-agent: 256 SHA256:Glz63Mz1fHaMPHaNoHI1g1PTVvAgq559CwBcOGGZOiM root@test-1.novalocal (ECDSA)
cloud-agent: 256 SHA256:hE/OD+p7Kf4sjOVJIgcXojzD6b9VonQ7ZJOsnFwgVl4 root@test-1.novalocal (ED25519)
cloud-agent: 3072 SHA256:igejS1AKeRqBRDIlL+e1fxzb54gSPyTXjgYZvNF6tgQ root@test-1.novalocal (RSA)
cloud-agent: -----END SSH HOST KEY FINGERPRINTS-----
cloud-agent: #############################################################
starting local daemons: cron.
Thu Jun 13 20:11:15 EDT 2019
OpenBSD/amd64 (test-1.novalocal) (tty00)
login:
Thanks!
I just built a fresh image with 6.5 with the code from commit bce8634bf5a60e11d67cb3859c00910ef4b3fbd0 on my Openstack Stein/HyperV lab when testing the resolution for Issue #3
Cloud-Agent was failing during boot, complaining that it couldn't find 'ovf-env.xml' (Which of course doesn't exist on Openstack)
Digging into the code, in agent/main.c we have:
I am guessing that the hostctl and sysctl for regular Hyper-V are the same as Azure, so cloud-agent is expecting the weird Azure metadata service.
I tested this by removing the following lines and recompiling:
After replacing the binaries in my Openstack Image and re-deploying, it of course worked perfectly, as the
ret = openstack(sc);
is matched, and so the Openstack Metadata network is contacted.I believe that both Cloudstack and Openstack can both use various hypervisors, including KVM/QEMU, Xen and HyperV - so it might be nice to allow the user to manually specify their cloud provider, e.g.