Skip to content

Commit

Permalink
CD removed from New VM dialog
Browse files Browse the repository at this point in the history
Problem: If a new VM was based on a template with disks then
`createNewVm` saga first sent a request to create a VM which was
immediately locked for the time of disk image copying. Then the saga
fired a request to set a CD image. However the request failed because
the VM was locked.

Solution: CD image can no longer be customized from New VM page, it is
possible only from Edit VM page.
  • Loading branch information
jniederm committed Feb 22, 2018
1 parent e6f8c1f commit 0343e8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
30 changes: 17 additions & 13 deletions src/components/VmDialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,23 @@ class VmDialog extends React.Component {
min={1}
step={1} />
</dd>
<dt>
<span className='pficon pficon-storage-domain' />
&nbsp;
<FieldHelp content={msg.changeCd()} text={msg.cd()} />
</dt>
<dd className={style['field-overflow-visible']}>
<SelectBox
onChange={this.onChangeCD}
selected={cdromFileId}
items={files}
idPrefix='select-changecd'
/>
</dd>
{ isEdit && (
<div> {/* this <div> is ugly anti-pattern and should be replaced by React.Fragment as soon as upgraded to React 16 */}
<dt>
<span className='pficon pficon-storage-domain' />
&nbsp;
<FieldHelp content={msg.changeCd()} text={msg.cd()} />
</dt>
<dd className={style['field-overflow-visible']}>
<SelectBox
onChange={this.onChangeCD}
selected={cdromFileId}
items={files}
idPrefix='select-changecd'
/>
</dd>
</div>
)}

<dt>
<FieldHelp content={msg.bootMenuTooltip()} text={msg.bootMenu()} />
Expand Down
15 changes: 2 additions & 13 deletions src/components/VmDialog/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,8 @@ import Api from '../../ovirtapi'
function* createNewVm (sagas, action) {
const result = yield sagas.callExternalAction('addNewVm', Api.addNewVm, action)
if (!result.error) {
const vm = Api.vmToInternal({ vm: result })
const result2 = yield sagas.callExternalAction('changeCD', Api.changeCD, {
type: 'CHANGE_CD',
payload: {
vmId: vm.id,
cdrom: action.payload.vm.cdrom,
running: false,
},
})
if (!result2.error) {
yield put(refresh({ page: action.payload.page }))
yield put(setSavedVm({ vm: Api.vmToInternal({ vm: result }) }))
}
yield put(refresh({ page: action.payload.page }))
yield put(setSavedVm({ vm: Api.vmToInternal({ vm: result }) }))
}
}

Expand Down

0 comments on commit 0343e8f

Please sign in to comment.