Bug 1928761

Summary: validateMachinesSubnet doesn't verify if subnet exists
Product: OpenShift Container Platform Reporter: Emilien Macchi <emacchi>
Component: InstallerAssignee: Emilien Macchi <emacchi>
Installer sub component: OpenShift on OpenStack QA Contact: Udi Shkalim <ushkalim>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: medium CC: juriarte, ushkalim
Version: 4.7Keywords: Reopened, Triaged
Target Milestone: ---   
Target Release: 4.7.z   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-03 05:18:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1957809    
Bug Blocks:    

Description Emilien Macchi 2021-02-15 13:57:28 UTC
Version:

$ openshift-install version
4.7, but it also affects 4.6

Platform: openstack / IPI

What happened?

When deploying with OCP with machinesSubnet set to an UUID, the installer doesn't check if the Subnet actually exists in Neutron.

Here is the error that we get if it doesn't exist:

DEBUG OpenShift Installer unreleased-master-4227-g96d911bb98d67d30d31c0c51d25771aa399a7c4d
DEBUG Built from commit 96d911bb98d67d30d31c0c51d25771aa399a7c4d
DEBUG Fetching Metadata...
DEBUG Loading Metadata...
DEBUG   Loading Cluster ID...
DEBUG     Loading Install Config...
DEBUG       Loading SSH Key...
DEBUG       Loading Base Domain...
DEBUG         Loading Platform...
DEBUG       Loading Cluster Name...
DEBUG         Loading Base Domain...
DEBUG         Loading Platform...
DEBUG       Loading Networking...
DEBUG         Loading Platform...
DEBUG       Loading Pull Secret...
DEBUG       Loading Platform...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x24217c1]

goroutine 1 [running]:
github.com/openshift/installer/pkg/asset/installconfig/openstack/validation.validateMachinesSubnet(0xc0000e2400, 0xc000c0c240, 0xc001045030, 0xc000d8c270, 0x1, 0xc000d8c270, 0xc001096860)                                                                                      
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/openstack/validation/platform.go:48 +0xc1
github.com/openshift/installer/pkg/asset/installconfig/openstack/validation.ValidatePlatform(0xc0000e2400, 0xc000c0c240, 0xc001045030, 0x0, 0x1a, 0x1)                                                                                                                           
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/openstack/validation/platform.go:21 +0xc7
github.com/openshift/installer/pkg/asset/installconfig/openstack.Validate(0xc000bb8240, 0x0, 0x0)
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/openstack/validate.go:27 +0xc5
github.com/openshift/installer/pkg/asset/installconfig.(*InstallConfig).platformValidation(0xc000391020, 0x0, 0x0)
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/installconfig.go:196 +0x15b
github.com/openshift/installer/pkg/asset/installconfig.(*InstallConfig).finish(0xc000391020, 0xdabba25, 0x13, 0x1185, 0xd7d71a0)
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/installconfig.go:156 +0x234
github.com/openshift/installer/pkg/asset/installconfig.(*InstallConfig).Load(0xc000391020, 0xee1d520, 0xc000a82c50, 0xef17760, 0xc000391020, 0xc000391020)                                                                                                                       
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/installconfig/installconfig.go:133 +0x1f0
github.com/openshift/installer/pkg/asset/store.(*storeImpl).load(0xc0011126c0, 0xee4bca0, 0xc00110b7c0, 0xc0005f04cc, 0x4, 0xc0005f04cc, 0x4, 0x0)                                                                                                                               
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/store/store.go:264 +0x455
github.com/openshift/installer/pkg/asset/store.(*storeImpl).load(0xc0011126c0, 0xee4bc60, 0xc00110b700, 0xda4c044, 0x2, 0xda4c044, 0x2, 0x0)                                                                                                                                     
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/store/store.go:247 +0x2d7
github.com/openshift/installer/pkg/asset/store.(*storeImpl).load(0xc0011126c0, 0x7f17a6a2a660, 0x15d40400, 0x0, 0x0, 0x2, 0x2, 0xed91e20)
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/store/store.go:247 +0x2d7
github.com/openshift/installer/pkg/asset/store.(*storeImpl).fetch(0xc0011126c0, 0x7f17a6a2a660, 0x15d40400, 0x0, 0x0, 0x40b605, 0xc50ff40)                                                                                                                                       
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/store/store.go:201 +0xa3a
github.com/openshift/installer/pkg/asset/store.(*storeImpl).Fetch(0xc0011126c0, 0x7f17a6a2a660, 0x15d40400, 0x15d11120, 0x8, 0x8, 0x8300000000000000, 0xed7bc5e24)                                                                                                               
        /home/stack/go/src/github.com/openshift/installer/pkg/asset/store/store.go:77 +0x4b
main.runTargetCmd.func1(0x7ffccc29c865, 0x13, 0xc00110b620, 0xc001112480)
        /home/stack/go/src/github.com/openshift/installer/cmd/openshift-install/create.go:183 +0x135
main.runTargetCmd.func2(0x15d1a6a0, 0xc001112420, 0x0, 0x3)
        /home/stack/go/src/github.com/openshift/installer/cmd/openshift-install/create.go:210 +0xb5
github.com/spf13/cobra.(*Command).execute(0x15d1a6a0, 0xc0011123c0, 0x3, 0x3, 0x15d1a6a0, 0xc0011123c0)
        /home/stack/go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:854 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc001110000, 0xc000e3ddf8, 0x1, 0x1)
        /home/stack/go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/stack/go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:895
main.installerMain()
        /home/stack/go/src/github.com/openshift/installer/cmd/openshift-install/main.go:70 +0x2b8
main.main()
        /home/stack/go/src/github.com/openshift/installer/cmd/openshift-install/main.go:50 +0x16f




We need to improve UX and check if the subnet exists and if not provide a nice error message so it's more obvious what the problem is.

Comment 1 Emilien Macchi 2021-02-15 16:00:00 UTC
I tried to reproduce again from scratch and I got:
DEBUG OpenShift Installer 4.6.15                   
DEBUG Built from commit 26aab99447a65a1a3d46342318486bd1dd11b1e2 
DEBUG Fetching Metadata...                         
DEBUG Loading Metadata...                          
DEBUG   Loading Cluster ID...                      
DEBUG     Loading Install Config...                
DEBUG       Loading SSH Key...                     
DEBUG       Loading Base Domain...                 
DEBUG         Loading Platform...                  
DEBUG       Loading Cluster Name...                
DEBUG         Loading Base Domain...               
DEBUG         Loading Platform...                  
DEBUG       Loading Pull Secret...                 
DEBUG       Loading Platform...                    
FATAL failed to fetch Metadata: failed to load asset "Install Config": failed to generate OpenStack cloud info: failed to fetch machine subnet info: Resource not found 


I think my initial error was before the subnet was working before and not anymore so it was somewhere in cache or in a config file in the config directory.
So the current UX is fine enough to me.

Comment 3 Emilien Macchi 2021-12-01 13:52:02 UTC
I confirm the bug is present in 4.7: https://paste.opendev.org/show/bDOxRiX2cZN0wvvv8xEU/

Thanks Udi for your inputs.

I'll look at the backports.

Comment 4 ShiftStack Bugwatcher 2021-12-02 07:03:04 UTC
Removing the Triaged keyword because:
* the priority assessment is missing
* the QE automation assessment (flag qe_test_coverage) is missing

Comment 12 Udi Shkalim 2022-01-20 08:05:58 UTC
Verified:
[stack@undercloud-0 ~]$ openshift-install create cluster --dir ostest/
FATAL failed to fetch Metadata: failed to load asset "Install Config": platform.openstack.machinesSubnet: Not found: "14fcd285-494d-4bbf-ba9f-3980363fd616"

[stack@undercloud-0 ~]$ openshift-install version
openshift-install 4.7.0-0.nightly-2022-01-18-181356
built from commit b406013d9ee4ae679ca4a3ea39a494a54e39fd77
release image registry.ci.openshift.org/ocp/release@sha256:86dab1338560c116321e98228e4e0b8be71a58aa55d6d28f809a8acde46ecaa8

Comment 15 errata-xmlrpc 2022-02-03 05:18:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.7.42 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:0283