@@ -1919,6 +1919,16 @@ func (p *ironicProvisioner) IsReady() (result bool, err error) {
19191919}
19201920
19211921func (p * ironicProvisioner ) HasCapacity () (result bool , err error ) {
1922+ bmcAccess , err := p .bmcAccess ()
1923+ if err != nil {
1924+ return false , err // shouldn't actually happen so late in the process
1925+ }
1926+
1927+ // If the current host uses virtual media, do not limit it. Virtual
1928+ // media deployments may work without DHCP and can share the same image.
1929+ if bmcAccess .SupportsISOPreprovisioningImage () {
1930+ return true , nil
1931+ }
19221932
19231933 hosts , err := p .loadBusyHosts ()
19241934 if err != nil {
@@ -1938,7 +1948,7 @@ func (p *ironicProvisioner) loadBusyHosts() (hosts map[string]struct{}, err erro
19381948
19391949 hosts = make (map [string ]struct {})
19401950 pager := nodes .List (p .client , nodes.ListOpts {
1941- Fields : []string {"uuid,name,provision_state,driver_internal_info,target_provision_state " },
1951+ Fields : []string {"uuid,name,provision_state,boot_interface " },
19421952 })
19431953
19441954 page , err := pager .AllPages ()
@@ -1958,7 +1968,11 @@ func (p *ironicProvisioner) loadBusyHosts() (hosts map[string]struct{}, err erro
19581968 nodes .Inspecting , nodes .InspectWait ,
19591969 nodes .Deploying , nodes .DeployWait ,
19601970 nodes .Deleting :
1961- hosts [node .Name ] = struct {}{}
1971+ // FIXME(dtantsur): this is a bit silly, but we don't have an easy way
1972+ // to reconstruct AccessDetails from a DriverInfo.
1973+ if ! strings .Contains (node .BootInterface , "virtual-media" ) {
1974+ hosts [node .Name ] = struct {}{}
1975+ }
19621976 }
19631977 }
19641978
0 commit comments