dm: remove the assume of virtio-net device name
Now, the DM assumes the device name entered by user is dependent on the type. For example, the device of tap type is named tap_TAAG, this patch remove the above assumption. User could set any name, no matter the code of DM or actually created, it is represented by user input. Tracked-On: #6690 Acked-by: Wang, Yu1 <yu1.wang@intel.com> Signed-off-by: Chenli Wei<chenli.wei@linux.intel.com>
This commit is contained in:
parent
04eefc9516
commit
b9431b8da4
|
@ -820,7 +820,6 @@ virtio_net_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||
char nstr[80];
|
||||
char tname[MAXCOMLEN + 1];
|
||||
struct virtio_net *net;
|
||||
char fname[IFNAMSIZ];
|
||||
char *devopts = NULL;
|
||||
char *name = NULL;
|
||||
char *type = NULL;
|
||||
|
@ -911,23 +910,20 @@ virtio_net_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||
}
|
||||
|
||||
vtopts = tmp = strdup(opts);
|
||||
if ((strstr(tmp, "tap") != NULL)
|
||||
|| (strncmp(tmp, "vmnet",5) == 0)) {
|
||||
if (strncmp(tmp, "tap", 3) == 0) {
|
||||
type = strsep(&tmp, "=");
|
||||
name = strsep(&tmp, ",");
|
||||
}
|
||||
|
||||
if ((tmp != NULL) && (strncmp(tmp, "mac_seed",8) == 0)) {
|
||||
if ((tmp != NULL) && (strncmp(tmp, "mac_seed", 8) == 0)) {
|
||||
strsep(&tmp, "=");
|
||||
mac_seed = tmp;
|
||||
}
|
||||
|
||||
if ((type != NULL) && (name != NULL)) {
|
||||
snprintf(fname, IFNAMSIZ, "%s_%s", type, name);
|
||||
|
||||
if ((strstr(type, "tap") != NULL) ||
|
||||
(strncmp(type, "vmnet", 5) == 0)){
|
||||
virtio_net_tap_setup(net, fname);
|
||||
if (strcmp(type, "tap") == 0) {
|
||||
virtio_net_tap_setup(net, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue