Skip to content

Add Nested Virtualization & fix VRAMSize attribute missing error#187

Merged
h6w merged 9 commits into
phpvirtualbox:developfrom
chotaire:chot-nested-virtualization
Jan 29, 2020
Merged

Add Nested Virtualization & fix VRAMSize attribute missing error#187
h6w merged 9 commits into
phpvirtualbox:developfrom
chotaire:chot-nested-virtualization

Conversation

@chotaire

@chotaire chotaire commented Sep 7, 2019

Copy link
Copy Markdown
Contributor

This pull request adds the option to select Nested Virtualization if supported by the CPU. This will allow hypervisors to be run inside hypervisors which is very helpful for QA and testing setups.

Coded by @pasha1st - his pull request #167 got legitimately rejected due to several issues so I am lending a helping hand and split this into multiple pull requests. This needs tested and finally merged, we need to move forward.

@chotaire

chotaire commented Sep 7, 2019

Copy link
Copy Markdown
Contributor Author

I've tested that phpvirtualbox does properly write and remove this setting from the VM config. I am unable to test if this feature actually works because it is currently only supported on AMD CPUs, which I don't have. See https://forums.virtualbox.org/viewtopic.php?f=1&t=90831 for more info about limitations with Nested Virtualization on VirtualBox. The actual commits look proper to me and I guess this can be merged.

@ZIM555

ZIM555 commented Sep 8, 2019

Copy link
Copy Markdown

Tested on AMD Phenom 9650. This function working

@chotaire

chotaire commented Sep 8, 2019

Copy link
Copy Markdown
Contributor Author

@ZIM555 thank you for testing. @h6w anything else needs done before merge?

@KrakenTyio

Copy link
Copy Markdown
Contributor

Nested VM are supported also for Intel in VBox 6.1

@h6w

h6w commented Jan 29, 2020

Copy link
Copy Markdown
Contributor

Sorry for the delay. Excellent work @chotaire . Thanks for bringing the good stuff in from @pasha1st's work. :-)

Oh, before I accept it, can you have a look at why the entire of vboxconnector.php is now in conflict?

@chotaire

chotaire commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

a) I merged current vboxconnector.php https://github.com/phpvirtualbox/phpvirtualbox/blob/develop/endpoints/lib/vboxconnector.php from develop branch into my PR.
b) I merged the previously proposed nested Virtualization patches again.
c) Fixed typo reported by trasherdk (in now superceded PR #217)
d) Would still give a merge conflict on the entire file. I diffed it externally, saw nothing wrong, chose my new version, resolved conflict. I have actually no idea what suddenly made Github report a conflict. My only guesses are either line endings ignored by my diff tools or a github error.
e) Diffed vboxconnector.php from bc88fca again with current vboxconnector.php from develop branch, looks like proper changes to me.

vboxconnector php compare

@h6w: If preferred, I can delete and create a new PR, should only take a few minutes.
PS. And no, I use VS Code, not this editor. I just quickly used it for diffing.

@chotaire

chotaire commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

I just checked, this file is using CRLF, like all other random files I tested in endpoints/lib so this doesn't seem to be an issue that needs to be corrected.

Testers, go ahead and see if this works. I will join you guys shortly and update to VirtualBox 6.1. This PR has been updated to work with the current develop branch as of January 29, 2020.
This zip file has both: https://github.com/chotaire/phpvirtualbox/archive/chot-nested-virtualization.zip

@chotaire
chotaire requested a review from h6w January 29, 2020 13:13
@Polve

Polve commented Jan 29, 2020

Copy link
Copy Markdown

I installed vbox 6.1 and tried branch "develop", but when I click on my VM I get an "Attribute does not exist" error:

`
Exception Object
(
[message:protected] => Attribute does not exist
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /usr/local/share/phpvirtualbox-git/endpoints/lib/vboxServiceWrappers.php
[line:protected] => 56
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /usr/local/share/phpvirtualbox-git/endpoints/lib/vboxconnector.php
[line] => 4225
[function] => __get
[class] => VBox_ManagedObject
[type] => ->
[args] => Array
(
[0] => VRAMSize
)

            )

        [1] => Array
            (
                [file] => /usr/local/share/phpvirtualbox-git/endpoints/lib/vboxconnector.php
                [line] => 3567
                [function] => _machineGetDetails
                [class] => vboxconnector
                [type] => ->
                [args] => Array
                    (
                        [0] => IMachine Object
                            (
                                [connection:protected] => SoapClient Object
                                    (
                                        [location] => http://127.0.0.1:18083/
                                        [_features] => 5
                                        [_connection_timeout] => 20
                                        [_stream_context] => Resource id #5
                                        [_soap_version] => 1
                                        [sdl] => Resource id #6
                                        [httpsocket] => Resource id #7
                                        [_use_proxy] => 0
                                        [httpurl] => Resource id #23
                                    )

                                [handle:protected] => b826cfc00a473451-0000000000000002
                            )

                    )

            )

        [2] => Array
            (
                [file] => /usr/local/share/phpvirtualbox-git/endpoints/lib/vboxconnector.php
                [line] => 951
                [function] => remote_machineGetDetails
                [class] => vboxconnector
                [type] => ->
                [args] => Array
                    (
                        [0] => Array
                            (
                                [vm] => 67052513-29c0-4e15-815b-a7692cac84b4
                            )

                    )

            )

        [3] => Array
            (
                [file] => /usr/local/share/phpvirtualbox-git/endpoints/api.php
                [line] => 316
                [function] => __call
                [class] => vboxconnector
                [type] => ->
                [args] => Array
                    (
                        [0] => machineGetDetails
                        [1] => Array
                            (
                                [0] => Array
                                    (
                                        [vm] => 67052513-29c0-4e15-815b-a7692cac84b4
                                    )

                                [1] => Array
                                    (
                                        [0] => Array
                                            (
                                                [data] => Array
                                                    (
                                                        [responseData] => Array
                                                            (
                                                            )

                                                    )

                                                [errors] => Array
                                                    (
                                                    )

                                                [persist] => Array
                                                    (
                                                    )

                                                [messages] => Array
                                                    (
                                                    )

                                            )

                                    )

                            )

                    )

            )

    )

[previous:Exception:private] => 

)
`

@chotaire

chotaire commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

@Polve Yep it is caused by a different PR. I am currently working on a fix. Gotta go shopping quickly then I will supply a patch.

@chotaire

chotaire commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

@Polve Please try the supplied fix. Thanks @cesium147 for the VirtualBox-6.1 patch.
Updated download: https://github.com/chotaire/phpvirtualbox/archive/chot-nested-virtualization.zip (current develop branch plus this PR).

@chotaire

chotaire commented Jan 29, 2020

Copy link
Copy Markdown
Contributor Author

After upgrading to VirtualBox 6.1, I've tried pretty much all features, creating, editing, deleting VMs and playing with most configuration parameters, creating, restoring, merging, deleting snapshots, changing VGA adapters (haven't tested if they actually work), setting Nested Virtualization feature on/off, installing guest additions. Even configuring multiple concurrent connections in remote display now works. From what I can see, everything works like a charme. This is awesome.

The only feature I haven't tried is Shared Folders.

@h6w Please review with most urgent priority as it fixes an issue that all VirtualBox 6.1 users will experience on current develop branch (throwing a fatal exception when simply clicking a VM). Once this is merged, VirtualBox 6.1 users should have a much more stable phpvirtualbox than 6.0 users ever had.

@chotaire chotaire changed the title Add Nested Virtualization (by pasha1st) Add Nested Virtualization & fix VRAMSize attribute missing error Jan 29, 2020
@Polve

Polve commented Jan 29, 2020

Copy link
Copy Markdown

@Polve Please try the supplied fix

It works fine for me, thanks!

@h6w

h6w commented Jan 29, 2020

Copy link
Copy Markdown
Contributor

Ok, so we're going back to the $m->GraphicsAdapter model. I must admit that raised an eyebrow when it was changed the first time. This seems a more sensible model. Thanks! :-)

@h6w
h6w merged commit 6f31e72 into phpvirtualbox:develop Jan 29, 2020
@chotaire

Copy link
Copy Markdown
Contributor Author

@h6w thanks for the quick action. I hope this will give developers a good base to work with in the future as we now have a really well working 6.1 version. I've tested it a lot today and decided to move it to production, it works so much better than master branch.

VirtualBox 5.2 goes out of support in July 2020. I hope you can keep an eye on this and merge develop to master in time. That would also stop confusing users wondering why there is no support for 6.0 and 6.1.

All eyes on @pasha1st and @cesium147 who made this huge step forward possible. ♥

@chotaire
chotaire deleted the chot-nested-virtualization branch January 30, 2020 00:08
@h6w

h6w commented Jan 30, 2020

Copy link
Copy Markdown
Contributor

Yep. Let's give it 14 days to settle in and then I'll release if there aren't any more reports of major issues. :-)

@chotaire

Copy link
Copy Markdown
Contributor Author

The VirtualBox dev team in Germany being thankful for the news is sure "that it will make people happy".

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.

5 participants