Skip to content

Commit 5f20dd8

Browse files
committed
Revert "ch: pass TAP device name to CLH instead of fds"
This reverts commit 3a246c5. Use of fds instead of device names is now supported fully in cloud-hypervisor so go back to that approach.
1 parent 6429bd9 commit 5f20dd8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/ch/ch_domain.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct _virCHDomainObjPrivate {
8888

8989
size_t tapfdSize;
9090
int *tapfd;
91-
char *tapName;
9291

9392
virThread vmThreadWatcher;
9493
int vmThreadWatcherStop;

src/ch/ch_monitor.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ virCHMonitorBuildNetJson(virDomainObjPtr vm, virJSONValuePtr nets, virDomainNetD
315315
char macaddr[VIR_MAC_STRING_BUFLEN];
316316
virCHDomainObjPrivatePtr priv = vm->privateData;
317317
virJSONValuePtr net;
318+
virJSONValuePtr clh_tapfds = NULL;
319+
int i = 0;
318320
net = virJSONValueNewObject();
319321

320322
switch (netType) {
@@ -385,12 +387,18 @@ virCHMonitorBuildNetJson(virDomainObjPtr vm, virJSONValuePtr nets, virDomainNetD
385387
goto cleanup;
386388
}
387389

388-
if (virJSONValueObjectAppendString(net, "tap", priv->tapName) < 0)
390+
clh_tapfds = virJSONValueNewArray();
391+
for (i=0; i< priv->tapfdSize; i++) {
392+
virJSONValueArrayAppend(clh_tapfds, virJSONValueNewNumberUint(priv->tapfd[i]));
393+
}
394+
395+
if (virJSONValueObjectAppend(net, "fds", clh_tapfds) < 0)
389396
goto cleanup;
390397

391398
if (virJSONValueObjectAppendString(net, "mac", virMacAddrFormat(&netdef->mac, macaddr)) < 0)
392399
goto cleanup;
393400

401+
394402
if (netdef->virtio != NULL) {
395403
if (netdef->virtio->iommu == VIR_TRISTATE_SWITCH_ON) {
396404
if (virJSONValueObjectAppendBoolean(net, "iommu", true) < 0)

src/ch/ch_process.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "virjson.h"
3939
#include "virlog.h"
4040
#include "virpidfile.h"
41-
#include "virstring.h"
4241

4342
#define VIR_FROM_THIS VIR_FROM_CH
4443

@@ -608,20 +607,14 @@ chProcessNetworkPrepareDevices(virCHDriverPtr driver, virDomainObjPtr vm)
608607
// This info will be used while generating Network Json
609608
priv->tapfd = g_steal_pointer(&tapfd);
610609
priv->tapfdSize = tapfdSize;
611-
priv->tapName = g_new(char, IFNAMSIZ);
612-
if (virStrcpy(priv->tapName, net->ifname, IFNAMSIZ) < 0) {
613-
virReportError(VIR_ERR_INTERNAL_ERROR,
614-
_("net->ifname %s too big for destination"), net->ifname);
615-
goto cleanup;
616-
}
617610
}
618611
}
619612

620613
return 0;
621614

622615
cleanup:
623616
g_free(tapfd);
624-
return -1;
617+
return 0;
625618
}
626619

627620

0 commit comments

Comments
 (0)