Skip to content
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 1801604: Add disk validation to virtual hardware on create-vm-wizard #4231

Merged

Conversation

irosenzw
Copy link
Contributor

@irosenzw irosenzw commented Feb 6, 2020

Add disk bus validation for the virtual hardware tab on create VM wizard

Signed-off-by: Ido Rosenzwig irosenzw@redhat.com

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/kubevirt Related to kubevirt-plugin labels Feb 6, 2020
const iStorages = iGetStorages(state, id);

const iStorages = iGetStorages(state, id).filter((iStorage) =>
iGetIn(iStorage, ['disk', 'disk']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this rather be everything except cdroms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory it can be LUN or FLOPPY, although it's highly unlikely I think we should still keep this filter to be sure we get only storage objects of type DISK.

Copy link
Member

@atiratree atiratree Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are showing all the other devices as well, so we should show the validations for them too IMO. Even if it is more unlikely to have them.

it should be a complement of the cdrom table so the user can see all the information

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree, we should show all the validations for all the types.

@@ -73,6 +73,18 @@ export class TemplateValidations {
});
};

// Return a valid bus, return the defaultBus if it's valid.
getAValidBus = (defaultBus?: DiskBus): DiskBus => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename it to getDefaultBus and have zero arguments here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep this method (we can change the name if you like)
the purpose is to verify the bus we are using as default, thus is has to have an argument.
I except the comment to have an additional method, with no arguments, to get the first valid bus

@irosenzw irosenzw force-pushed the cdrom-disk-validation branch 2 times, most recently from 7b00a8d to 7d5c87c Compare February 9, 2020 11:53
@irosenzw
Copy link
Contributor Author

irosenzw commented Feb 9, 2020

/retest

@irosenzw irosenzw changed the title Add disk validation to virtual hardware on create-vm-wizard Bug 1801604: Add disk validation to virtual hardware on create-vm-wizard Feb 11, 2020
@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Feb 11, 2020
@openshift-ci-robot
Copy link
Contributor

@irosenzw: This pull request references Bugzilla bug 1801604, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Bug 1801604: Add disk validation to virtual hardware on create-vm-wizard

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

const iStorages = iGetStorages(state, id);

const iStorages = iGetStorages(state, id).filter((iStorage) =>
iGetIn(iStorage, ['disk', 'disk']),
Copy link
Member

@atiratree atiratree Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are showing all the other devices as well, so we should show the validations for them too IMO. Even if it is more unlikely to have them.

it should be a complement of the cdrom table so the user can see all the information

@@ -73,6 +73,27 @@ export class TemplateValidations {
});
};

// Return a valid bus, return the defaultBus if it's valid.
getAValidBus = (defaultBus?: DiskBus): DiskBus => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getAValidBus = (defaultBus?: DiskBus): DiskBus => {
getAValidBus = (defaultBus = DiskBus.VIRTIO): DiskBus => {

could we use this approach?

return null;
};

getDefaultBus = (): DiskBus => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two methods are confusing and I am not sure which one I should use on the first look.

I am sorry, but can we revert this to the former state and have just one method called getDefaultBus?

@@ -138,8 +139,7 @@ export const validateDisk = (
validations.pvc = validatePVCName(pvcName, usedPVCNames);
}

// TODO: implement CDROM disk bus validation
if (disk.getType() === DiskType.DISK) {
if (diskType === DiskType.DISK || diskType === DiskType.CDROM) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is useful for LUN as well. Can we do this?

Suggested change
if (diskType === DiskType.DISK || diskType === DiskType.CDROM) {
if (disk.getType() !== DiskType.FLOPPY) {

@@ -73,6 +73,27 @@ export class TemplateValidations {
});
};

// Return a valid bus, return the defaultBus if it's valid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not entirely correct. Can we please remove the comment to lower the confusion?

@@ -73,6 +73,14 @@ export class TemplateValidations {
});
};

getDefaultBus = (defaultBus = DiskBus.VIRTIO): DiskBus => {
const allowedBuses = this.getAllowedBuses();
if (allowedBuses.size === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we should keep it here or just return the defaultBus here for the function consistency. As this branch should never execute

@irosenzw
Copy link
Contributor Author

/retest

@@ -71,6 +71,7 @@ export const validateStorages = (options: UpdateOptions) => {
export const setStoragesTabValidity = (options: UpdateOptions) => {
const { id, dispatch, getState } = options;
const state = getState();

const iStorages = iGetStorages(state, id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be everything except cdroms

Signed-off-by: Ido Rosenzwig <irosenzw@redhat.com>
@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 12, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: irosenzw, suomiy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2020
@openshift-merge-robot openshift-merge-robot merged commit bcb1fa3 into openshift:master Feb 12, 2020
@openshift-ci-robot
Copy link
Contributor

@irosenzw: All pull requests linked via external trackers have merged. Bugzilla bug 1801604 has been moved to the MODIFIED state.

In response to this:

Bug 1801604: Add disk validation to virtual hardware on create-vm-wizard

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link
Contributor

@irosenzw: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-console 57556b1 link /test e2e-gcp-console

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@spadgett spadgett added this to the v4.4 milestone Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/kubevirt Related to kubevirt-plugin lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants