-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1829542: Add mount guest agent tools to vm wizard #5490
Changes from 2 commits
7b54b96
d046361
2ec411c
6750c7a
37cd478
9341363
eac892b
7ab0ad2
51130d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,22 +153,23 @@ const osUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions) => { | |
if (iGetCommonData(state, id, VMWizardProps.isProviderImport)) { | ||
return; | ||
} | ||
if (iGetCommonData(state, id, VMWizardProps.isProviderImport)) { | ||
return; | ||
} | ||
if (!hasVMSettingsValueChanged(prevState, state, id, VMSettingsField.OPERATING_SYSTEM)) { | ||
return; | ||
} | ||
|
||
const os = iGetVmSettingValue(state, id, VMSettingsField.OPERATING_SYSTEM); | ||
const isWindows = os?.startsWith('win'); | ||
const windowsTools = getStorages(state, id).find( | ||
(storage) => !!isWinToolsImage(getVolumeContainerImage(storage.volume)), | ||
); | ||
|
||
if (isWindows && !windowsTools) { | ||
dispatch(vmWizardInternalActions[InternalActionType.UpdateStorage](id, windowsToolsStorage)); | ||
} | ||
if (!isWindows && windowsTools) { | ||
dispatch(vmWizardInternalActions[InternalActionType.RemoveStorage](id, windowsTools.id)); | ||
} | ||
dispatch( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, we should also consider the vm import part here. can we change the value to false when isProviderImport? But keep it visible in case some import providers (possibly vmWare) wish to use it. In case of ovirt provider it is actually impossible to use this field so can we hide it in We should also register field reset for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have an env to test and check this scenarios ... @suomiy can you take it as a follow up PR ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be few lines, just use vmFieldUpdate in the same way like for other VM fields and also register isHidden in ovirt provider in the same spot/update. I can test your PR, once you have it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added a gate to not mount when in import view |
||
vmWizardInternalActions[InternalActionType.UpdateVmSettingsField]( | ||
id, | ||
VMSettingsField.MOUNT_WINDOWS_GUEST_TOOLS, | ||
{ isHidden: asHidden(!isWindows, VMSettingsField.OPERATING_SYSTEM), value: isWindows }, | ||
), | ||
); | ||
}; | ||
|
||
const baseImageUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions) => { | ||
|
@@ -211,6 +212,31 @@ const baseImageUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions) | |
); | ||
}; | ||
|
||
const windowsToolsUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good, but we should move this updater to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved to storage 👍 |
||
const state = getState(); | ||
if (iGetCommonData(state, id, VMWizardProps.isProviderImport)) { | ||
return; | ||
} | ||
if (!hasVMSettingsValueChanged(prevState, state, id, VMSettingsField.MOUNT_WINDOWS_GUEST_TOOLS)) { | ||
return; | ||
} | ||
const mountWindowsGuestTools = iGetVmSettingValue( | ||
state, | ||
id, | ||
VMSettingsField.MOUNT_WINDOWS_GUEST_TOOLS, | ||
); | ||
const windowsTools = getStorages(state, id).find( | ||
(storage) => !!isWinToolsImage(getVolumeContainerImage(storage.volume)), | ||
); | ||
|
||
if (mountWindowsGuestTools && !windowsTools) { | ||
dispatch(vmWizardInternalActions[InternalActionType.UpdateStorage](id, windowsToolsStorage)); | ||
} | ||
if (!mountWindowsGuestTools && windowsTools) { | ||
dispatch(vmWizardInternalActions[InternalActionType.RemoveStorage](id, windowsTools.id)); | ||
} | ||
}; | ||
|
||
const cloneCommonBaseDiskImageUpdater = ({ id, prevState, dispatch, getState }: UpdateOptions) => { | ||
const state = getState(); | ||
if (iGetCommonData(state, id, VMWizardProps.isProviderImport)) { | ||
|
@@ -305,6 +331,7 @@ export const updateVmSettingsState = (options: UpdateOptions) => | |
osUpdater, | ||
baseImageUpdater, | ||
cloneCommonBaseDiskImageUpdater, | ||
windowsToolsUpdater, | ||
workloadConsistencyUpdater, | ||
provisioningSourceUpdater, | ||
nativeK8sUpdater, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ export const OSFlavor: React.FC<OSFlavorProps> = React.memo( | |
userTemplate, | ||
operatinSystemField, | ||
cloneBaseDiskImageField, | ||
mountWindowsGuestToolsField, | ||
flavorField, | ||
workloadProfile, | ||
cnvBaseImages, | ||
|
@@ -60,6 +61,7 @@ export const OSFlavor: React.FC<OSFlavorProps> = React.memo( | |
const display = iGet(operatinSystemField, 'display'); | ||
const displayOnly = !!display; | ||
const cloneBaseDiskImage = iGetFieldValue(cloneBaseDiskImageField); | ||
const mountWindowsGuestTools = iGetFieldValue(mountWindowsGuestToolsField); | ||
|
||
const params = { | ||
userTemplate, | ||
|
@@ -184,21 +186,34 @@ export const OSFlavor: React.FC<OSFlavorProps> = React.memo( | |
onChange={(v) => onChange(VMSettingsField.CLONE_COMMON_BASE_DISK_IMAGE, v)} | ||
/> | ||
</FormField> | ||
{cloneBaseDiskImage && ( | ||
<Text> | ||
View the cloned disk in the{' '} | ||
<Button | ||
isDisabled={!goToStorageStep} | ||
isInline | ||
onClick={goToStorageStep} | ||
variant={ButtonVariant.link} | ||
> | ||
<strong>storage</strong> | ||
</Button>{' '} | ||
step | ||
</Text> | ||
)} | ||
</FormFieldRow> | ||
<FormFieldRow | ||
field={mountWindowsGuestToolsField} | ||
fieldType={FormFieldType.INLINE_CHECKBOX} | ||
loadingResources={loadingResources} | ||
> | ||
<FormField> | ||
<Checkbox | ||
className="kv-create-vm__input-checkbox" | ||
id={getFieldId(VMSettingsField.MOUNT_WINDOWS_GUEST_TOOLS)} | ||
onChange={(v) => onChange(VMSettingsField.MOUNT_WINDOWS_GUEST_TOOLS, v)} | ||
/> | ||
</FormField> | ||
</FormFieldRow> | ||
{(cloneBaseDiskImage || mountWindowsGuestTools) && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not having the Virtualized HW step simplifies things a bit :) |
||
<Text className="kv-create-vm__input-checkbox"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i know it works, but the name does not reflect the reality :) either
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :-) yea There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any reason you can't use |
||
View the mounted disk in the{' '} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we probably should pluralize this depending on the number of checkboxes checked There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pluralized 🥞 |
||
<Button | ||
isDisabled={!goToStorageStep} | ||
isInline | ||
onClick={goToStorageStep} | ||
variant={ButtonVariant.link} | ||
> | ||
<strong>storage</strong> | ||
</Button>{' '} | ||
step | ||
</Text> | ||
)} | ||
<FormFieldRow | ||
field={flavorField} | ||
fieldType={FormFieldType.SELECT} | ||
|
@@ -228,6 +243,7 @@ type OSFlavorProps = { | |
flavorField: any; | ||
operatinSystemField: any; | ||
cloneBaseDiskImageField: any; | ||
mountWindowsGuestToolsField: any; | ||
userTemplate: string; | ||
workloadProfile: string; | ||
cnvBaseImages: any; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanted to be extra sure :-) , removed 👍