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

machines: Move reusable code to libvirt-common.es6 #9692

Closed
wants to merge 19 commits into from

Conversation

KKoukiou
Copy link
Contributor

Splitting #9240 into smaller pieces to make merge process quicker.

KKoukiou added 19 commits July 19, 2018 10:10
…libvirt-common

libvirt-common file will contain all functions that will be shared amongst
libvirt providers.

Signed-off-by: Katerina Koukiou <[email protected]>
All dependent functions were also moved.

Signed-off-by: Katerina Koukiou <[email protected]>
vm.status is not defined, we need to check vm.state value.

Signed-off-by: Katerina Koukiou <[email protected]>
All these functions are going to be reused by the libvirtDBus provider
that will be added in following patch.

Signed-off-by: Katerina Koukiou <[email protected]>
This function will be reused in LibvirtDBus provider but
there we 'll need to overwrite the 'id' attribute.
Thus the extra optional parameter 'id_overwrite' was added.
When not passed the function will keep its current behavior.

Signed-off-by: Katerina Koukiou <[email protected]>
…common

The following functions were moved and stored in libvirt-common in alphabetical order:
- canConsole,
- canDelete,
- canInstall,
- canReset,
- canRun,
- canSendNMI,
- canShutdown,
- isRunning,
- serialConsoleCommand,

Signed-off-by: Katerina Koukiou <[email protected]>
@KKoukiou
Copy link
Contributor Author

All these functions that I moved can be reused in other provider files.
More fined grained splitting can be done instead of putting everything into libvirt-common file if needed.

@@ -64,7 +64,7 @@ class VmDisksTabLibvirt extends React.Component {
return null;
}

if (vm.status === 'running') {
if (vm.state === 'running') {
Copy link
Member

Choose a reason for hiding this comment

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

There's a similar thing here:

pkg/kubernetes/scripts/virtual-machines/components/VmsListingRow.jsx:    const phase = (vm.status && vm.status.phase) || _("n/a");

but there vm.status seems to be an object, while here it's a string. Are these two different statuses really?

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 am not familiar with k8s package, I am not sure if it's problem that there as well.

For the commit here we need to check the vm.state string as set here, https://github.com/cockpit-project/cockpit/blob/master/pkg/machines/libvirt.es6#L1048

vm.status is clearly a typo, not initialized anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, thanks! Sorry, I totally missed the /kubernetes, I just saw the "machines" there :)

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Looks all fine to me, and the justification is #9240 -- we are going to need both providers at least for some time. I just have one question, but it's unrelated to this PR.

@KKoukiou KKoukiou deleted the move-reusable-code branch November 29, 2018 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants