[libvirt] [PATCH 3/4] parallels: Switch on DHCP for newly created network adapters

Mikhail Feoktistov mfeoktistov at virtuozzo.com
Mon Jun 15 18:26:36 UTC 2015


Let network adapter use DHCP server to get network configuration.
To do this we use PrlVmDevNet_SetConfigureWithDhcp to enable it and
PrlVmDevNet_SetAutoApply to makes necessary settings within guest OS
In linux case it creates network startup scripts
/etc/sysconfig/network-scripts/ifcfg-ethN and fills it with necessary
parameters.
---
 src/parallels/parallels_sdk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 1d982c5..4c3d1eb 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2815,6 +2815,12 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom,
     pret = PrlVmDevNet_SetMacAddress(sdknet, macstr);
     prlsdkCheckRetGoto(pret, cleanup);
 
+    pret = PrlVmDevNet_SetConfigureWithDhcp(sdknet, true);
+    prlsdkCheckRetGoto(pret, cleanup);
+
+    pret = PrlVmDevNet_SetAutoApply(sdknet, true);
+    prlsdkCheckRetGoto(pret, cleanup);
+
     if (isCt) {
         if (net->model)
              VIR_WARN("Setting network adapter for containers is not "
-- 
1.7.1




More information about the libvir-list mailing list