Skip to contentSkip to conversation

create proper net device for hvm guests

PATCH In review Jim Fehlig 3 participants 4 messages Apr 4, 2008 – Apr 23, 2008

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 create proper net device for hvm guests

I've noticed that hvm guests using pv network device also get an emulated network device. Conversely, hvm guests using emulated network device also get pv network device. I'm surprised that this hasn't been fixed already, which makes me think there is some unforeseen issue that results from not providing both. I guess one drawback is that the guest config file must be edited to remove 'model=foo, type=ioemu' when using pv network device - but it seems the guest config file should be the place where these types of settings are explicitly stated.

I've attached a patch the creates either the emulated or pv network device (but not both) depending on setting in guest configuation, i.e. 'type=ioemu'. Please apply if my reasoning is sane. If not, please clarify reason for presenting both :-).

Cheers,
Jim

Create either the emulated or pv network device (but not both) depending on setting in guest configuation, i.e. 'type=ioemu'.

tools/python/xen/xend/image.py +1 -1
diff -r db943e8d1051 tools/python/xen/xend/image.py
@@ -571,7 +571,7 @@ class HVMImageHandler(ImageHandler):
 
         for devuuid in vmConfig['vif_refs']:
             devinfo = vmConfig['devices'][devuuid][1]
-            dtype = devinfo.get('type', 'ioemu')
+            dtype = devinfo.get('type', '')
             if dtype != 'ioemu':
                 continue
             nics += 1
tools/python/xen/xend/server/netif.py +7 -0
diff -r db943e8d1051 tools/python/xen/xend/server/netif.py
@@ -99,6 +99,13 @@ class NetifController(DevController):
     
     def __init__(self, vm):
         DevController.__init__(self, vm)
+
+    def createDevice(self, config):
+        typ = config.get('type', '')
+        if typ == 'ioemu':
+            return 0
+
+        DevController.createDevice(self, config)
 
     def getDeviceDetails(self, config):
         """@see DevController.getDeviceDetails"""

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines · Jim Fehlig

I've noticed that hvm guests using pv network device also get an emulated network device. Conversely, hvm guests using emulated network device also get pv network device. I'm surprised that this hasn't been fixed already, which makes me think there is some unforeseen issue that results from not providing both. I guess one drawback is that the guest config file must be edited to remove 'model=foo, type=ioemu' when using pv network device - but it seems the guest config file should be the place where these types of settings are explicitly stated.

Quoted 4 lines

I've attached a patch the creates either the emulated or pv network device (but not both) depending on setting in guest configuation, i.e. 'type=ioemu'. Please apply if my reasoning is sane. If not, please clarify reason for presenting both :-).

The guest administrator does not have control over the Dom0, and thus has no ability to change the config. Since installing Xen PV drivers is a post install task, you can't create the guest with pv-only mode straightaway, and nor can the guest admin change the config. Thus the presenting both the devices lets the guest admin choose between the two at will. They can easily blacklist the '8139too' driver in modprobe.conf if they only want to use the pv driver and prevent the 2nd nic from being mistakenly used.

IIRC, the logic is supposed to currently be:

- type=ioemu - only present emulated rtl8139 (or as per model=)
- type=netfront - only present the pv driver
- no type= setting - present both pv & rtl8139 nic

Regards,
Dan.

Signature · 4 lines
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
author
#2 lore raw
Quoted 17 lines · Daniel P. Berrange
Quoted 9 lines · Jim Fehlig

I've noticed that hvm guests using pv network device also get an emulated network device. Conversely, hvm guests using emulated network device also get pv network device. I'm surprised that this hasn't been fixed already, which makes me think there is some unforeseen issue that results from not providing both. I guess one drawback is that the guest config file must be edited to remove 'model=foo, type=ioemu' when using pv network device - but it seems the guest config file should be the place where these types of settings are explicitly stated.

Quoted 5 lines

I've attached a patch the creates either the emulated or pv network device (but not both) depending on setting in guest configuation, i.e. 'type=ioemu'. Please apply if my reasoning is sane. If not, please clarify reason for presenting both :-).

Quoted 4 lines

The guest administrator does not have control over the Dom0, and thus has no ability to change the config. Since installing Xen PV drivers is a post install task, you can't create the guest with pv-only mode straightaway, and nor can the guest admin change the config.

Yes, that was the drawback I noted above.

Quoted 11 lines

Thus the presenting both the
devices lets the guest admin choose between the two at will. They can easily blacklist the '8139too' driver in modprobe.conf if they only want to use the pv driver and prevent the 2nd nic from being mistakenly used.

IIRC, the logic is supposed to currently be:

- type=ioemu - only present emulated rtl8139 (or as per model=)
- type=netfront - only present the pv driver
- no type= setting - present both pv & rtl8139 nic

On 3.2 I observe

- type=ioemu - both emulated and pv presented
- type=netfront - only pv presented
- no type setting - both emulated and pv presented

The second hunk of this patch provides the behavior you described. However, when using it, I noticed that no vif entries are created in xenstore frontend/backend paths (DevController.createDevice is not called when 'type=ioemu'). Oddly, I don't see any ill affects from that though ;-).

The first hunk changes

-no type setting - both emulated and pv presented

to

-no type setting - only pv presented

so ignore that. I would suspect that many guests targeted for pv driver installation have 'type=ioemu' in their config, making the second hunk of this patch distasteful as well. Sigh ...

Jim

Quoted 3 lines

Regards,
Dan.

#3 lore raw
Quoted 4 lines · Jim Fehlig

However, when using it, I noticed that no vif entries are created in xenstore frontend/backend paths (DevController.createDevice is not called when 'type=ioemu'). Oddly, I don't see any ill affects from that though ;-).

This would break Solaris dom0, which relies on the existence of the backend paths in the ioemu case.