Portability issue - NIC names etc.

This is for discussing general topics about how to use VirtualBox.
Post Reply
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

Portability issue - NIC names etc.

Post by NeBlackCat »

Hi,

When moving VMs back and forth between Windows and Linux hosts, or using a dual boot configuration, you're faced with the issue that NIC names will be different. In Windows, VirtualBox uses the immutable Windows-assigned NIC names (eg. "Atheros AR8121/AR8113/AR8114 PCI-E Ethernet Controller(NDIS6.20)") in its .vbox files, not the user rename-able friendly names (eg. "LAN", or even "eth0"), so you can't make them the same.

Of course there are other differences too, for obvious reasons, such as filesystem references.

A solution to both would be to have a registry, say in VirtualBox.xml, which assigns aliases to things like these, and a UI for it in the main Virtualox config GUI. Or even put it into each .vbox file, if you don't like the central registry approach.

You then use the aliases in the meat part of the VM definitions (.vbox files), instead of the absolute references. It might then be possible to have a single .vbox file which defines the VM in both OSes.

Comments?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Portability issue - NIC names etc.

Post by Sasquatch »

If you want to move VMs between hosts constantly, you use a central storage system by using a NAS or SAN and use the Teleport feature. VB wasn't made to have a constant move between Windows and Linux hosts like how you do it. If you do want to do that, then put the VDI in a central location that you can move around and keep the config on the Host side and don't touch it, don't use snapshots and saved state.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

Re: Portability issue - NIC names etc.

Post by NeBlackCat »

Thanks but how would that prevent having to use different styles of filesystem reference (drive letters vs. mount points / slash direction) and NIC names, and what about the performance degradation it would cause?
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Portability issue - NIC names etc.

Post by Technologov »

I think it should be movable. This is the whole point of v4.0 release.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Portability issue - NIC names etc.

Post by Sasquatch »

But it never was the point to have a user constantly move a VM between hosts. E.g. you have two interfaces on your systems and always use the second one (wifi for example). When you add or import the VM, it will default to the wired interface instead. The user wants to avoid this step. Also, shared folder definitions are lost, he doesn't want that to happen either.
So with that in mind, you either just move the VDI and keep the settings on the Host itself and not use snapshots and such, or you use Teleport, or you keep adjusting the settings according to the Host you want to run it on with add and such.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Portability issue - NIC names etc.

Post by mpack »

NeBlackCat wrote:A solution to both would be to have a registry, say in VirtualBox.xml, which assigns aliases to things like these
I can see that simply moving the problem rather than solving it. I.e. the problem now becomes keeping the VirtualBox.xml file on different hosts synchronized. I think you have roughly the right idea, but the name resolution table needs to be in the VM settings file, not VBox.xml - let's learn the lessons of the past...

This thread ought really to be in "Suggestions".
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Portability issue - NIC names etc.

Post by Technologov »

I have opened it as Wish #8730. Feel free to add comments.
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

Re: Portability issue - NIC names etc.

Post by NeBlackCat »

Cheers!

Actually, now I think about it some more, this potentially overlaps with another suggestion I have (I'm busy collating a list of things I've jotted down over months, to submit):

As we know, VirtualBox has a nice API that you can use from, say, Python to do various things. Another suggestion was for the VirtualBox UI to provide a way to run any scripts that it finds in a certain place (say from a list in a submenu of the right-click menu, when you right-cick on a VM in the main UI), and on certain events, like loading a VM definition (.vbox file), starting a VM, etc, etc.

That could also be used to solve this problem. You could simply have a Python (or whatever) script that's automatically run as VirtualBox is about to load the .vbox file, that can modify it in any way you wish. For me, that would involve walking the XML tree and replacing NIC names/filesystem references with whatever they should be for a possibly different host or machine. Or just using direct VM-modifying API calls. Whatever.

Would that be a better way to crack the nut? I could actually do that now, just not automatically.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Portability issue - NIC names etc.

Post by Sasquatch »

You mean to actually extend the New and Add VM options to provide a way to modify a few settings while creating or adding a VM? That's certainly a good idea. You could make it optional in the New VM wizard and the Open File dialogue (edit settings) or something. You don't have to open the VM settings to change just a few things, like network option and shared folder definition. A little like the First Run wizard you get when starting a VM before you opened it's settings.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Portability issue - NIC names etc.

Post by Technologov »

Sas: you can add your idea to the wish I opened.
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

Re: Portability issue - NIC names etc.

Post by NeBlackCat »

Technologov wrote:Sas: you can your idea to the wish I opened.
Will do, I thought I'd ruminate here and then post something concise and hopefully sensible to the wish (and it seems I have to create a new account to access that).
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

Re: Portability issue - NIC names etc.

Post by NeBlackCat »

Sasquatch wrote:You mean to actually extend the New and Add VM options to provide a way to modify a few settings while creating or adding a VM? That's certainly a good idea. You could make it optional in the New VM wizard and the Open File dialogue (edit settings) or something. You don't have to open the VM settings to change just a few things, like network option and shared folder definition. A little like the First Run wizard you get when starting a VM before you opened it's settings.
Not exactly, I meant in VBox's normal operation, it would look for scripts in some predefined directory. if there are some, then it lets you run any of them by (say) right clicking on a VM in the main VM list. And it would also be possible (eg. by some naming convention) to have scripts automatically run on certain events, like Vbox startup, loading a VM (before processing its .vbox file, to give you a chance to change it), before starting a VM, before pausing a VM, before terminating a VM, etc.

In principle I could solve the original problem right now, manually, with a single Python script. I could have a single .vbox file for my VM, to be used under any host OS/hardware. I'd run the sccript before running VBox, and it would walk VirtualBox.xml, find all my <vm name>.vbox files, and substitute whatever was necessary for that host OS/hardware (NIC names, etc) in each of them.

But it would be nicer done in a more integrated way from VirtualBox itself, and I'd already had the idea of a general way of running scripts from the main VBox UI as stated above, so I just joined the two together.
Post Reply