- 26 11月, 2019 2 次提交
-
-
由 Michal Privoznik 提交于
There are two daemons that wait for acquiring their pid files: virtnetworkd and virtstoraged. This is undesirable as the idea is to quit early if unable to acquire the pid file. Fixes: v5.6.0-rc1~207. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Laine Stump 提交于
In the past the network driver was (mistakenly) being called for all interfaces, not just those of type='network', and so it had a chance to validate all interface configs after the actual type of the interface was known. But since the network driver has been more completely/properly separated from qemu, the network driver isn't called during the startup of any interfaces except those with type='network', so this validation no longer takes place for, e.g. <interface type='bridge'> (or direct, etc). This in turn meant that a config could erroneously specify a vlan tag, or bandwidth settings, for a type of interface that didn't support it, and the domain would start without complaint, just silently ignoring those settings. This patch moves those validation checks out of the network driver, and into virDomainActualNetDefValidate() so they will be done for all interfaces, not just type='network'. https://bugzilla.redhat.com/1741121Signed-off-by: NLaine Stump <laine@redhat.com> Reviewed-by: NCole Robinson <crobinso@redhat.com>
-
- 25 11月, 2019 1 次提交
-
-
由 Erik Skultety 提交于
This reverts commit f4db846c. This patch results in the following error when trying to start essentially any VM with default network: unsupported configuration: QOS must be defined for network 'default' Coverity didn't see that the bandwidth == NULL it complained about in virNetDevBandwidthPlug was already checked properly in networkCheckBandwidth, thus causing networkPlugBandwidth to return 0 and finish before a call to virNetDevBandwidthPlug would have been even made. Signed-off-by: NErik Skultety <eskultet@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 19 11月, 2019 2 次提交
-
-
由 John Ferlan 提交于
If networkAllocatePort calls networkPlugBandwidth eventually the port->bandwidth would be passed to virNetDevBandwidthPlug which requires that the parameter is non-NULL. Coverity additionally notes that since (!port->bandwidth) is checked earlier in the networkAllocatePort method that the subsequent call to blindly use if for a function that requires it needs to check. Signed-off-by: NJohn Ferlan <jferlan@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
由 John Ferlan 提交于
We go through the trouble of checking {old|new}Bandwidth[->in] and storing the result in local @old_floor and @new_floor, but then we don't use them. Instead we make derefs to the longer name. This caused Coverity to note dereferencing newBandwidth->in without first checking @newBandwidth like was done for new_floor could cause a NULL dereference. Signed-off-by: NJohn Ferlan <jferlan@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
- 13 11月, 2019 1 次提交
-
-
由 Daniel Henrique Barboza 提交于
Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 12 11月, 2019 1 次提交
-
-
由 Michal Privoznik 提交于
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
- 08 11月, 2019 1 次提交
-
-
由 Laine Stump 提交于
When libvirt first implemented a stable and configurable MAC address for the bridges created for libvirt virtual networks (commit 5754dbd5, in libvirt v0.8.8) most distro stable releases didn't support explicitly setting the MAC address of a bridge; the bridge just always assumed the lowest numbered MAC of all attached interfaces. Because of this, we stabilized the bridge MAC address by creating a "dummy" tap interface with a MAC address guaranteed to be lower than any of the guest tap devices' MACs (which all started with 0xFE, so it's not difficult to do) and attached it to the bridge - this was the inception of the "virbr0-nic" device that has confused so many people over the years. Even though the linux kernel had recently gained support for explicitly setting a bridge MAC, we deemed it unnecessary to set the MAC that way, because the other (indirect) method worked everywhere. But recently there have been reports that the bridge MAC address was not following the setting in the network config, and mismatched the MAC of the dummy tap device (which was still correct). It turns out that this is due to a change in systemd-242 that persists whatever MAC address is set for a bridge when it's initially started. According to the systemd NEWS file entry for version 242 (https://github.com/systemd/systemd/blob/master/NEWS): "if a bridge interface is created without any slaves, and gains a slave later, then now the bridge does not inherit slave's MAC." This change was the result of: https://github.com/systemd/systemd/issues/3374 (apparently if there is no MAC saved for a bridge by the name of a bridge being created, the random MAC generated during creation is saved, and then that same MAC is used to explicitly set the MAC each time it is created). Once a bridge has an explicitly set MAC, the "use the lowest numbered MAC of attached devices" rule is ignored, so our dummy tap device is like the goggles - it does nothing! (well, almost). We could whine about changes in default behavior, etc. etc., but because the change was in response to actual user problems, that seems likely a fruitless task. Fortunately, time has marched on, and even distro releases that are old enough that they are no longer supported by upstream libvirt (e.g. RHEL6) have support for explicitly setting a bridge device MAC address, either during creation or with a separate ioctl after creation, so we can now do that. To enable explicitly setting the mac during bridge creation, we add a mac arg to virNetDevBridgeCreate(). In the case of platforms where the bridge is created with a netlink RTM_NEWLINK message, we just add that mac to the message. For platforms that still use an ioctl (either SIOCBRADDBR or SIOCIFCREATE2), we make a separate call to virNetDevSetMAC() after creating the bridge. (NB: I was unable to test the calling of virNetDevSetMAC() from the SIOCIFCREATE2 (BSD) version of virNetDevBridgeCreate(); even though I managed to get a FreeBSD system setup and libvirt built there, when I tried to start the default network the SIOCIFCREATE2 ioctl itself failed, so it never even got to the virNetDevSetMAC(). That leaves the FreeBSD implementation untested.) This makes the dummy tap pointless for purposes of setting the MAC address, but it is still useful for IPv6 DAD initialization (which apparently requires at least one interface to be attached to the bridge and online), as well as for setting an initial MTU for the bridge, so it hasn't been removed. (NB: we can safely *always* call virNetDevBridgeCreate() with &def->mac from the network driver because, in spite of the existence of a "mac_specified" bool in the config suggesting that it may not always be present, in reality a mac address will always be added to any network that doesn't have one - this is guaranteed in all cases by commit a47ae7c0) https://bugzilla.redhat.com/show_bug.cgi?id=1760851Signed-off-by: NLaine Stump <laine@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
- 25 10月, 2019 1 次提交
-
-
由 Peter Krempa 提交于
The function now does not return an error so we can drop it fully. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 24 10月, 2019 1 次提交
-
-
由 Michal Privoznik 提交于
In few places we have the following code pattern: int ret; ... /* @ret is not accessed here */ ret = f(...); return ret; This pattern can be written less verbose: ... return f(...); This patch was generated with following coccinelle spatch: @@ type T; constant C; expression f; identifier ret; @@ -T ret = C; ... when != ret -ret = f; -return ret; +return f; Afterwards I needed to fix a few places, e.g. comment in virDomainNetIPParseXML() was removed too because coccinelle thinks it refers to @ret while in fact it doesn't. Also in few places it replaced @ret declaration with a few spaces instead of removing the line. But nothing terribly wrong. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
- 21 10月, 2019 2 次提交
-
-
由 Ján Tomko 提交于
Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a = g_strdup(b); Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Ján Tomko 提交于
Replace all the occurrences of ignore_value(VIR_STRDUP(a, b)); with a = g_strdup(b); Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 16 10月, 2019 3 次提交
-
-
由 Ján Tomko 提交于
Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Ján Tomko 提交于
Since commit 44e7f029 util: rewrite auto cleanup macros to use glib's equivalent VIR_AUTOPTR aliases to g_autoptr. Replace all of its use by the GLib macro version. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Ján Tomko 提交于
Since commit 44e7f029 util: rewrite auto cleanup macros to use glib's equivalent VIR_AUTOFREE is just an alias for g_autofree. Use the GLib macros directly instead of our custom aliases. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 15 10月, 2019 2 次提交
-
-
由 Ján Tomko 提交于
Also define the macro for building with GLib older than 2.60 Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Ján Tomko 提交于
Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 14 10月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
The usleep function was missing on older mingw versions, but we can rely on it existing everywhere these days. It may only support times upto 1 second in duration though, so we'll prefer to use g_usleep instead. The commandhelper program is not changed since that can't link to glib. Fortunately it doesn't need to build on Windows platforms either. Reviewed-by: NJán Tomko <jtomko@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 08 10月, 2019 1 次提交
-
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1755303 With the recent work in daemon split and socket activation daemons can come and go. They can and will be started many times during a session which results in objects being autostarted multiple times. This is not optimal. Use virDriverShouldAutostart() to determine if autostart should be done or not. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 27 9月, 2019 2 次提交
-
-
由 Laine Stump 提交于
define a VIR_DEFINE_AUTOPTR_FUNC() to autofree virNetworkPortDefs, and convert all uses of virNetworkPortDefPtr that are appropriate to use it. This coincidentally fixes multiple potential memory leaks (in failure cases) in networkPortCreateXML() Signed-off-by: NLaine Stump <laine@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Daniel Henrique Barboza 提交于
Reviewed-by: NCole Robinson <crobinso@redhat.com> Suggested-by: NCole Robinson <crobinso@redhat.com> Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
- 14 9月, 2019 3 次提交
-
-
由 Daniel P. Berrangé 提交于
To aid in troubleshooting add some debug messages wrt bandwidth settings and networks. Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Daniel P. Berrangé 提交于
We previously allowed bandwidth settings when attaching NICs to networks with forward mode=bridge: commit 42a92ee9 Author: Daniel P. Berrangé <berrange@redhat.com> Date: Tue Nov 20 11:30:05 2018 +0000 network: add missing bandwidth limits for bridge forward type In the case of a network with forward=bridge, which has a bridge device listed, we are capable of setting bandwidth limits but fail to call the function to register them. Reviewed-by: NCole Robinson <crobinso@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com> Unfortunately the wrong version of this patch was posted and reviewed and thus it lacked the code to actually apply the bandwidth settings to the bridge itself. Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Daniel P. Berrangé 提交于
Since the introduction of the virNetworkPort object, the network driver has a persistent record of ports that have been created against the networks. Thus the hypervisor drivers no longer communicate to the network driver during libvirtd restart. This change, however, meant that the connection usage counts were no longer re-initialized during a libvirtd restart. To deal with this we must iterate over all virNetworkPortDefPtr objects we have and invoke the notify callback to record the connection usage count. Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 27 8月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
All code using LOCALSTATEDIR "/run" is updated to use RUNSTATEDIR instead. The exception is the remote driver client which still uses LOCALSTATEDIR "/run". The client needs to connect to remote machines which may not be using /run, so /var/run is more portable due to the /var/run -> /run symlink. Some duplicate paths in the apparmor code are also purged. There's no functional change by default yet since both expressions expand to the same value. Reviewed-by: NMichal Privoznik <mprivozn@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 21 8月, 2019 5 次提交
-
-
由 Ján Tomko 提交于
Store the namespace URI as const char*, instead of in a function. Suggested-by: NJiri Denemark <jdenemar@redhat.com> Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
由 Ján Tomko 提交于
Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
由 Ján Tomko 提交于
Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
由 Ján Tomko 提交于
Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
由 Ján Tomko 提交于
There is no need to copy and paste the same types pointing to void all over the place. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
- 16 8月, 2019 2 次提交
-
-
由 Laine Stump 提交于
virErrorPreserveLast()/virErrorRestore() (added in commit 8333e745 back in 2017), do a better better job of saving and restoring the last libvirt error than virSaveLastError()/virErrorRestore() (they're simpler, and they also save/restore the system errno). Signed-off-by: NLaine Stump <laine@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Laine Stump 提交于
During networkPortCreateXML, if networkAllocatePort() failed, networkReleasePort() would be called, which would (in the case of network pools of macvtap passthrough devices) attempt to find the allocated device by comparing port->plug.direct.linkdev to each device in the pool. Since port->plug.direct.linkdev was still NULL, the attempted strcmp would result in a SEGV. Calling networkReleasePort() during error cleanup is something that should only be done if networkAllocatePort() has already succeeded. It turns out there is one other possible error exit from networkPortCreateXML() that happens after networkAllocatePort() has succeeded, so the code to call networkReleasePort() was just moved down to there. Resolves: https://bugzilla.redhat.com/1741390Signed-off-by: NLaine Stump <laine@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 09 8月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
When running in libvirtd, we are happy for any of the drivers to simply skip their initialization in virStateInitialize, as other drivers are still potentially useful. When running in per-driver daemons though, we want the daemon to abort startup if the driver cannot initialize itself, as the daemon will be useless without it. Reviewed-by: NAndrea Bolognani <abologna@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 08 8月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
Use the correct enum constant when validating vlan usage. This fixes a merge error in commit 6cb0ec48 Author: Daniel P. Berrangé <berrange@redhat.com> Date: Mon Sep 3 17:34:22 2018 +0100 network: convert networkAllocateActualDevice to virNetworkPortDef Reviewed-by: NMichal Privoznik <mprivozn@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 18 7月, 2019 4 次提交
-
-
由 Cole Robinson 提交于
This maps to XML like: <network xmlns:dnsmasq='http://libvirt.org/schemas/network/dnsmasq/1.0'> ... <dnsmasq:options> <dnsmasq:option value="foo=bar"/> <dnsmasq:option value="cname=*.foo.example.com,master.example.com"/> </dnsmasq:options> </network> To dnsmasq config options ... foo=bar cname=*.foo.example.com,master.example.com Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
Just the plumbing, no real implementation yet Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
Pass an xmlopt argument through all the needed network conf functions, like is done for domain XML handling. No functional change for now Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
Just a stub for now that is unused. Add init+cleanup plumbing and demostrate it in bridge_driver.c Reviewed-by: NLaine Stump <laine@laine.org> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 11 7月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
When we allow multiple instances of the driver for the same user account, using a separate root directory, we need to ensure mutual exclusion. Use a pidfile to guarantee this. In privileged libvirtd this ends up locking /var/run/libvirt/network/driver.pid In unprivileged libvirtd this ends up locking /run/user/$UID/libvirt/network/run/driver.pid NB, the latter can vary depending on $XDG_RUNTIME_DIR Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 26 6月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
The sys/sysctl.h header is only needed on BSD platforms to get the sysctlbyname() function declaration. On Linux we talk to procfs instead to change sysctls. Unfortunately a legacy sys/sysctl.h header does exist on Linux and including it has recently started triggering a deprecation warning from glibc. Protect its inclusion with a HAVE_SYSCTLBYNAME check instead so that it only gets used on platforms where we need that function declaration. Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-