[libvirt] [PATCH] virsh: Update list of shutdown/reboot modes
by Michal Privoznik
As of 76d9f65644 we are supporting two new modes: initctl and signal.
However, these are missing in help listing.
---
tools/virsh-domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c088468..bd6192e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4568,7 +4568,7 @@ static const vshCmdOptDef opts_shutdown[] = {
},
{.name = "mode",
.type = VSH_OT_STRING,
- .help = N_("shutdown mode: acpi|agent")
+ .help = N_("shutdown mode: acpi|agent|initctl|signal")
},
{.name = NULL}
};
@@ -4654,7 +4654,7 @@ static const vshCmdOptDef opts_reboot[] = {
},
{.name = "mode",
.type = VSH_OT_STRING,
- .help = N_("shutdown mode: acpi|agent")
+ .help = N_("shutdown mode: acpi|agent|initctl|signal")
},
{.name = NULL}
};
--
1.8.1.5
11 years, 7 months
[libvirt] [libvirt-designer][PATCH] Don't redefine _FORTIFY_SOURCE macro
by Michal Privoznik
If the _FORTIFY_SOURCE has been already defined, we unconditionally
redefine it, leaving us with warning/error thrown at compilation time.
---
m4/virt-compile-warnings.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 913abca..1c58ebe 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -86,7 +86,7 @@ AC_DEFUN([LIBVIRT_DESIGNER_COMPILE_WARNINGS],[
# Use improved glibc headers
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings. */
- #if defined __OPTIMIZE__ && __OPTIMIZE__
+ #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
# define _FORTIFY_SOURCE 2
#endif
])
--
1.8.1.5
11 years, 7 months
[libvirt] [libvirt-designer][PATCH] test: Adapt to new gvir_designer_domain_new signature
by Michal Privoznik
After 46be1aed the signature of gvir_designer_domain_new has changed.
The OsinfoDb parameter appeared there. However, the test suite hasn't
been adapted.
---
libvirt-designer/test-designer-domain.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libvirt-designer/test-designer-domain.c b/libvirt-designer/test-designer-domain.c
index a3d62b6..bbd5a28 100644
--- a/libvirt-designer/test-designer-domain.c
+++ b/libvirt-designer/test-designer-domain.c
@@ -129,12 +129,14 @@ static const gchar *capslxcxml =
static void test_domain_machine_setup(GVirDesignerDomain **design, gconstpointer opaque)
{
OsinfoOs *os = osinfo_os_new("http://myoperatingsystem/amazing/4.2");
+ OsinfoDb *db = osinfo_db_new();
OsinfoPlatform *platform = osinfo_platform_new("http://myhypervisor.org/awesome/6.6.6");
GVirConfigCapabilities *caps = gvir_config_capabilities_new_from_xml(capsqemuxml, NULL);
- *design = gvir_designer_domain_new(os, platform, caps);
+ *design = gvir_designer_domain_new(db, os, platform, caps);
g_object_unref(os);
+ g_object_unref(db);
g_object_unref(platform);
g_object_unref(caps);
}
@@ -143,12 +145,14 @@ static void test_domain_machine_setup(GVirDesignerDomain **design, gconstpointer
static void test_domain_container_setup(GVirDesignerDomain **design, gconstpointer opaque)
{
OsinfoOs *os = osinfo_os_new("http://myoperatingsystem/amazing/4.2");
+ OsinfoDb *db = osinfo_db_new();
OsinfoPlatform *platform = osinfo_platform_new("http://myhypervisor.org/awesome/6.6.6");
GVirConfigCapabilities *caps = gvir_config_capabilities_new_from_xml(capslxcxml, NULL);
- *design = gvir_designer_domain_new(os, platform, caps);
+ *design = gvir_designer_domain_new(db, os, platform, caps);
g_object_unref(os);
+ g_object_unref(db);
g_object_unref(platform);
g_object_unref(caps);
}
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] bridge: add the firewalld zone support
by Federico Simoncelli
This patch adds the support for the firewalld zones in the virtual
bridges managed by libvirt allowing to configure the rules as for
all the other interfaces.
After assigning a fwzone to the bridge it is then possible to
configure the firewall rules through the firwalld daemon, e.g.
enabling or disabling connections to certain services located on
the host.
The firewalld events (e.g. restart, reload) are managed with the
preexisting infrastructure that is already in place to reinstate
the general iptables rules.
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
docs/formatnetwork.html.in | 5 +-
docs/schemas/network.rng | 6 +++
src/conf/network_conf.c | 8 +++-
src/conf/network_conf.h | 1 +
src/network/bridge_driver.c | 114 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 131 insertions(+), 3 deletions(-)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index 4dd0415..e6d7d9c 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -69,7 +69,7 @@
<pre>
...
- <bridge name="virbr0" stp="on" delay="5"/>
+ <bridge name="virbr0" fwzone="internal" stp="on" delay="5"/>
<domain name="example.com"/>
<forward mode="nat" dev="eth0"/>
...</pre>
@@ -91,6 +91,9 @@
is 'on' or 'off' (default is
'on'). Attribute <code>delay</code> sets the bridge's forward
delay value in seconds (default is 0).
+ Attribute <code>fwzone</code> specifies the firewalld zone to use
+ for the bridge device (the default is no zone and firewalld will
+ configure the device with its default zone).
<span class="since">Since 0.3.0</span>
</dd>
<dt><code>domain</code></dt>
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 6c3fae2..2f92cfc 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -66,6 +66,12 @@
</attribute>
</optional>
+ <optional>
+ <attribute name="fwzone">
+ <ref name="genericName"/>
+ </attribute>
+ </optional>
+
</element>
</optional>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 968cf11..cf163e0 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1749,6 +1749,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
def->bridge = virXPathString("string(./bridge[1]/@name)", ctxt);
stp = virXPathString("string(./bridge[1]/@stp)", ctxt);
def->stp = (stp && STREQ(stp, "off")) ? 0 : 1;
+ def->fwzone = virXPathString("string(./bridge[1]/@fwzone)", ctxt);
if (virXPathULong("string(./bridge[1]/@delay)", ctxt, &def->delay) < 0)
def->delay = 0;
@@ -1880,9 +1881,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
}
/* fall through to next case */
case VIR_NETWORK_FORWARD_BRIDGE:
- if (def->delay || stp) {
+ if (def->delay || stp || def->fwzone) {
virReportError(VIR_ERR_XML_ERROR,
- _("bridge delay/stp options only allowed in route, nat, and isolated mode, not in %s (network '%s')"),
+ _("bridge delay/stp/fwzone options only allowed in "
+ "route, nat, and isolated mode, not in %s (network '%s')"),
virNetworkForwardTypeToString(def->forward.type),
def->name);
goto error;
@@ -2370,6 +2372,8 @@ virNetworkDefFormatInternal(virBufferPtr buf,
virBufferAddLit(buf, "<bridge");
if (def->bridge)
virBufferEscapeString(buf, " name='%s'", def->bridge);
+ if (def->fwzone)
+ virBufferEscapeString(buf, " fwzone='%s'", def->fwzone);
virBufferAsprintf(buf, " stp='%s' delay='%ld' />\n",
def->stp ? "on" : "off",
def->delay);
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 6ce9a00..80ee75f 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -194,6 +194,7 @@ struct _virNetworkDef {
char *bridge; /* Name of bridge device */
char *domain;
+ char *fwzone; /* The firewalld zone */
unsigned long delay; /* Bridge forward delay (ms) */
unsigned int stp :1; /* Spanning tree protocol */
virMacAddr mac; /* mac address of bridge device */
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e8b314a..4875bbc 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -76,6 +76,29 @@
#define VIR_FROM_THIS VIR_FROM_NETWORK
+#if HAVE_FIREWALLD
+static char *firewall_cmd_path = NULL;
+
+static int
+networkBridgeOnceInit(void)
+{
+ firewall_cmd_path = virFindFileInPath("firewall-cmd");
+ if (!firewall_cmd_path) {
+ VIR_INFO("firewall-cmd not found on system. "
+ "firewalld support disabled for firewall zones.");
+ /* no need to verify the firewalld state as the service might
+ * be available now but not later on when it is actually used to
+ * configure the zones, or the opposite: it might be available
+ * now but not when needed.
+ */
+ }
+ return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(networkBridge)
+
+#endif
+
/* Main driver state */
struct network_driver {
virMutex lock;
@@ -1893,6 +1916,75 @@ networkRemoveGeneralIp6tablesRules(struct network_driver *driver,
iptablesRemoveForwardRejectOut(driver->iptables, AF_INET6, network->def->bridge);
}
+#if HAVE_FIREWALLD
+static int
+networkAddInterfaceZone(virNetworkObjPtr network)
+{
+ int status;
+
+ if ((network->def->bridge == NULL) || (network->def->fwzone == NULL))
+ return 0;
+
+ networkBridgeInitialize();
+
+ if (firewall_cmd_path == NULL) {
+ VIR_WARN("firewall-cmd is missing cannot add interface '%s' to "
+ "firewall zone '%s'", network->def->bridge,
+ network->def->fwzone);
+ return -1;
+ }
+
+ virCommandPtr cmd = virCommandNew(firewall_cmd_path);
+ /* the --change-zone command is used (instead of --add-interface) to avoid
+ * errors if the device was already assigned to a different zone.
+ */
+ virCommandAddArgList(cmd, "--zone", network->def->fwzone,
+ "--change-zone", network->def->bridge, NULL);
+ if (virCommandRun(cmd, &status) < 0 || status != 0) {
+ VIR_ERROR("failed to add interface '%s' to firewall zone '%s'",
+ network->def->bridge, network->def->fwzone);
+ } else {
+ VIR_DEBUG("interface '%s' has been added to firewall zone '%s'",
+ network->def->bridge, network->def->fwzone);
+ }
+
+ virCommandFree(cmd);
+
+ return 0;
+}
+
+static void
+networkRemoveInterfaceZone(virNetworkObjPtr network)
+{
+ int status;
+
+ if (network->def->bridge == NULL)
+ return;
+
+ networkBridgeInitialize();
+
+ if (firewall_cmd_path == NULL) {
+ VIR_WARN("firewall-cmd is missing cannot remove interface '%s' "
+ "from its firewall zone", network->def->bridge);
+ return;
+ }
+
+ virCommandPtr cmd = virCommandNew(firewall_cmd_path);
+ /* not specifying a zone removes the interface from any zone */
+ virCommandAddArgList(cmd, "--remove-interface",
+ network->def->bridge, NULL);
+ if (virCommandRun(cmd, &status) < 0 || status != 0) {
+ VIR_ERROR("failed to remove interface '%s' from its firewall zone",
+ network->def->bridge);
+ } else {
+ VIR_DEBUG("interface '%s' has been removed from its firewall zone",
+ network->def->bridge);
+ }
+
+ virCommandFree(cmd);
+}
+#endif
+
static int
networkAddGeneralIptablesRules(struct network_driver *driver,
virNetworkObjPtr network)
@@ -2000,9 +2092,27 @@ networkAddGeneralIptablesRules(struct network_driver *driver,
goto err9;
}
+#if HAVE_FIREWALLD
+ if (networkAddInterfaceZone(network) < 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("failed to add interface '%s' to the firewall zone '%s'"),
+ network->def->bridge, network->def->fwzone);
+ goto err10;
+ }
+#else
+ if (network->def->fwzone != NULL)
+ VIR_WARN("firewalld support not compiled into this binary, interface "
+ "'%s' not added to firewall zone '%s'", network->def->bridge,
+ network->def->fwzone);
+#endif
+
return 0;
/* unwind in reverse order from the point of failure */
+#if HAVE_FIREWALLD
+err10:
+ networkRemoveGeneralIp6tablesRules(driver, network);
+#endif
err9:
iptablesRemoveForwardAllowCross(driver->iptables, AF_INET, network->def->bridge);
err8:
@@ -2032,6 +2142,10 @@ networkRemoveGeneralIptablesRules(struct network_driver *driver,
int ii;
virNetworkIpDefPtr ipv4def;
+#if HAVE_FIREWALLD
+ networkRemoveInterfaceZone(network);
+#endif
+
networkRemoveGeneralIp6tablesRules(driver, network);
for (ii = 0;
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH v3 1/3] Add NVRAM device
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
For pSeries guest in QEMU, NVRAM is one kind of spapr-vio device.
Users are allowed to specify spapr-vio devices'address.
But NVRAM is not supported in libvirt. So this patch is to
add NVRAM device to allow users to specify its address.
In QEMU, NVRAM device's address is specified by
"-global spapr-nvram.reg=xxxxx".
In libvirt, XML file is defined as the following:
<nvram>
<address type='spapr-vio' reg='0x3000'/>
</nvram>
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v3 -> v2:
* Add NVRAM in domaincommon.rng and formatdomain.xml.in suggested by Daniel P.Berrange
* Add NVRAM test cases suggested by Daniel P.Berrange
* Remove nvram allocation when it is not specified suggested by Daniel P.Berrange
* Add several error reports suggested by Daniel P.Berrange
v2 -> v1:
* Add NVRAM parameters parsing in qemuParseCommandLine
src/conf/domain_conf.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 10 +++++++
src/qemu/qemu_command.c | 67 +++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_command.h | 2 ++
4 files changed, 155 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3278e9c..c37487c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -190,6 +190,7 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"smartcard",
"chr",
"memballoon",
+ "nvram",
"rng")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
@@ -1515,6 +1516,16 @@ void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def)
VIR_FREE(def);
}
+void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def)
+{
+ if (!def)
+ return;
+
+ virDomainDeviceInfoClear(&def->info);
+
+ VIR_FREE(def);
+}
+
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
{
if (!def)
@@ -1678,6 +1689,7 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
break;
}
@@ -1869,6 +1881,7 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainWatchdogDefFree(def->watchdog);
virDomainMemballoonDefFree(def->memballoon);
+ virDomainNVRAMDefFree(def->nvram);
for (i = 0; i < def->nseclabels; i++)
virSecurityLabelDefFree(def->seclabels[i]);
@@ -2429,6 +2442,12 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
if (cb(def, &device, &def->rng->info, opaque) < 0)
return -1;
}
+ if (def->nvram) {
+ device.type = VIR_DOMAIN_DEVICE_NVRAM;
+ device.data.nvram = def->nvram;
+ if (cb(def, &device, &def->nvram->info, opaque) < 0)
+ return -1;
+ }
device.type = VIR_DOMAIN_DEVICE_HUB;
for (i = 0; i < def->nhubs ; i++) {
device.data.hub = def->hubs[i];
@@ -2460,6 +2479,7 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_RNG:
break;
@@ -7703,6 +7723,23 @@ error:
goto cleanup;
}
+static virDomainNVRAMDefPtr
+virDomainNVRAMDefParseXML(const xmlNodePtr node,
+ unsigned int flags)
+{
+ virDomainNVRAMDefPtr def;
+
+ if (VIR_ALLOC(def) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ if ( virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0 )
+ return NULL;
+
+ return def;
+}
+
static virSysinfoDefPtr
virSysinfoParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt)
@@ -10844,6 +10881,26 @@ virDomainDefParseXML(virCapsPtr caps,
VIR_FREE(nodes);
}
+ def->nvram = NULL;
+ if ((n = virXPathNodeSet("./devices/nvram", ctxt, &nodes)) < 0) {
+ goto error;
+ }
+
+ if (n > 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single nvram device is supported"));
+ goto error;
+ }
+
+ if (n > 0) {
+ virDomainNVRAMDefPtr nvram =
+ virDomainNVRAMDefParseXML(nodes[0], flags);
+ if (!nvram)
+ goto error;
+ def->nvram = nvram;
+ VIR_FREE(nodes);
+ }
+
/* analysis of the hub devices */
if ((n = virXPathNodeSet("./devices/hub", ctxt, &nodes)) < 0) {
goto error;
@@ -13854,6 +13911,21 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
}
static int
+virDomainNVRAMDefFormat(virBufferPtr buf,
+ virDomainNVRAMDefPtr def,
+ unsigned int flags)
+{
+ virBufferAsprintf(buf, " <nvram>\n");
+ if (virDomainDeviceInfoIsSet(&def->info, flags))
+ if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
+ return -1;
+
+ virBufferAddLit(buf, " </nvram>\n");
+
+ return 0;
+}
+
+static int
virDomainSysinfoDefFormat(virBufferPtr buf,
virSysinfoDefPtr def)
{
@@ -15161,6 +15233,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->rng)
virDomainRNGDefFormat(buf, def->rng, flags);
+ if (def->nvram)
+ virDomainNVRAMDefFormat(buf, def->nvram, flags);
+
virBufferAddLit(buf, " </devices>\n");
virBufferAdjustIndent(buf, 2);
@@ -16443,6 +16518,7 @@ virDomainDeviceDefCopy(virCapsPtr caps,
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Copying definition of '%d' type "
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 96f11ba..03b7c9a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -108,6 +108,9 @@ typedef virDomainChrDef *virDomainChrDefPtr;
typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
+typedef struct _virDomainNVRAMDef virDomainNVRAMDef;
+typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;
+
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
@@ -136,6 +139,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_SMARTCARD,
VIR_DOMAIN_DEVICE_CHR,
VIR_DOMAIN_DEVICE_MEMBALLOON,
+ VIR_DOMAIN_DEVICE_NVRAM,
VIR_DOMAIN_DEVICE_RNG,
VIR_DOMAIN_DEVICE_LAST
@@ -162,6 +166,7 @@ struct _virDomainDeviceDef {
virDomainSmartcardDefPtr smartcard;
virDomainChrDefPtr chr;
virDomainMemballoonDefPtr memballoon;
+ virDomainNVRAMDefPtr nvram;
virDomainRNGDefPtr rng;
} data;
};
@@ -1423,6 +1428,9 @@ struct _virDomainMemballoonDef {
virDomainDeviceInfo info;
};
+struct _virDomainNVRAMDef {
+ virDomainDeviceInfo info;
+};
enum virDomainSmbiosMode {
VIR_DOMAIN_SMBIOS_NONE = 0,
@@ -1883,6 +1891,7 @@ struct _virDomainDef {
/* Only 1 */
virDomainWatchdogDefPtr watchdog;
virDomainMemballoonDefPtr memballoon;
+ virDomainNVRAMDefPtr nvram;
virCPUDefPtr cpu;
virSysinfoDefPtr sysinfo;
virDomainRedirFilterDefPtr redirfilter;
@@ -2015,6 +2024,7 @@ int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def);
void virDomainSoundDefFree(virDomainSoundDefPtr def);
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
+void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
void virDomainVideoDefFree(virDomainVideoDefPtr def);
virDomainHostdevDefPtr virDomainHostdevDefAlloc(void);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4891b65..26c3001 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1169,6 +1169,15 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
goto cleanup;
}
+ if (def->nvram) {
+ if (def->os.arch == VIR_ARCH_PPC64 &&
+ STREQ(def->os.machine, "pseries"))
+ def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
+ if (qemuAssignSpaprVIOAddress(def, &def->nvram->info,
+ 0x3000ul) < 0)
+ goto cleanup;
+ }
+
/* No other devices are currently supported on spapr-vio */
ret = 0;
@@ -3809,6 +3818,32 @@ error:
return NULL;
}
+char *
+qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
+ dev->info.addr.spaprvio.has_reg) {
+ virBufferAsprintf(&buf, "spapr-nvram.reg=0x%llx",
+ dev->info.addr.spaprvio.reg);
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("NVRAM device address is not supported.\n"));
+ goto error;
+ }
+
+ if (virBufferError(&buf)) {
+ virReportOOMError();
+ goto error;
+ }
+
+ return virBufferContentAndReset(&buf);
+
+error:
+ virBufferFreeAndReset(&buf);
+ return NULL;
+}
char *
qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
@@ -7492,6 +7527,21 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
}
+ if (def->nvram) {
+ if (def->os.arch == VIR_ARCH_PPC64 &&
+ STREQ(def->os.machine, "pseries")) {
+ char *optstr;
+ virCommandAddArg(cmd, "-global");
+ optstr = qemuBuildNVRAMDevStr(def->nvram);
+ if (!optstr)
+ goto error;
+ if (optstr)
+ virCommandAddArg(cmd, optstr);
+ VIR_FREE(optstr);
+ } else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("NVRAM device is not supported"));
+ }
if (snapshot)
virCommandAddArgList(cmd, "-loadvm", snapshot->def->name, NULL);
@@ -9584,6 +9634,23 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
goto error;
}
+ } else if (STREQ(arg, "-global") &&
+ STRPREFIX(progargv[i + 1], "spapr-nvram.reg=")) {
+
+ WANT_VALUE();
+
+ if (VIR_ALLOC(def->nvram) < 0)
+ goto no_memory;
+
+ val += strlen("spapr-nvram.reg=");
+ if (virStrToLong_ull(val, NULL, 16,
+ &def->nvram->info.addr.spaprvio.reg) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value for spapr-nvram.reg :"
+ "'%s'"), val);
+ goto error;
+ }
+
} else if (STREQ(arg, "-S")) {
/* ignore, always added by libvirt */
} else {
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 17687f4..2b60997 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -118,6 +118,8 @@ char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
virQEMUCapsPtr qemuCaps);
+char * qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev);
+
char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
virQEMUCapsPtr qemuCaps);
--
1.7.10.1
11 years, 7 months
[libvirt] [PATCH] qemu: fix crash in qemuOpen
by Ján Tomko
If the path part of connection URI is not present, cfg is used
unitialized.
https://bugzilla.redhat.com/show_bug.cgi?id=950855
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2c0d7d1..0d41e39 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1025,16 +1025,16 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn,
_("qemu state driver is not active"));
goto cleanup;
}
+ cfg = virQEMUDriverGetConfig(qemu_driver);
if (conn->uri->path == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("no QEMU URI path given, try %s"),
cfg->uri);
goto cleanup;
}
- cfg = virQEMUDriverGetConfig(qemu_driver);
if (cfg->privileged) {
if (STRNEQ(conn->uri->path, "/system") &&
STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH v3] qemu: Set correct migrate host in client_migrate_info
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=920441
Currently, we are discarding listen attribute from qemu cookie even though
we strive to gather it. This result in not so cool bug: if user have
different networks, one for management/migration, and one for VNC/SPICE we
pass incorrect host to the qemu in client_migrate_info. What we actually
pass is remote hostname, while we should be passing remote listen address.
It doesn't matter as long as these two are the same, but they don't need
necessary to be like that.
---
src/conf/domain_conf.c | 4 +++-
src/qemu/qemu_migration.c | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 68f024f..6757738 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16557,8 +16557,10 @@ virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii)
virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, false);
+ /* even a network can have a listen address */
if (!listenInfo ||
- (listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS))
+ !(listenInfo->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
+ listenInfo->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
return NULL;
return listenInfo->address;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 41ad768..a263668 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1720,6 +1720,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
+ char *listenAddress = cookie->graphics->listen;
if (!cookie)
return 0;
@@ -1733,12 +1734,17 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
return 0;
+ if (!listenAddress ||
+ STREQ(listenAddress, "0.0.0.0") ||
+ STREQ(listenAddress, "::"))
+ listenAddress = cookie->remoteHostname;
+
ret = qemuDomainObjEnterMonitorAsync(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT);
if (ret == 0) {
ret = qemuMonitorGraphicsRelocate(priv->mon,
cookie->graphics->type,
- cookie->remoteHostname,
+ listenAddress,
cookie->graphics->port,
cookie->graphics->tlsPort,
cookie->graphics->tlsSubject);
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] conf: fix error for parallel port mismatch
by Ján Tomko
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 68f024f..36a46da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11940,7 +11940,7 @@ virDomainParallelDefCheckABIStability(virDomainChrDefPtr src,
{
if (src->target.port != dst->target.port) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target serial port %d does not match source %d"),
+ _("Target parallel port %d does not match source %d"),
dst->target.port, src->target.port);
return false;
}
--
1.8.1.5
11 years, 7 months
Re: [libvirt] [Autotest] [RFC] Autotest Project Weekly Hangout
by Amos Kong
CC: qemu-devel, kvm, libvirt-list
On Thu, Apr 11, 2013 at 4:43 AM, Lucas Meneghel Rodrigues <lmr(a)redhat.com>wrote:
> Hi guys,
>
> I'd like to propose yet another hipster-y initiative: A weekly hangout,
> where contributors from all affiliations that work on autotest/virt-tests
> or any project under the autotest umbrella get to talk about 30 minutes on
> issues, new features and similar stuff.
>
> The proposed date/time would be every Thursday, 12:00 PM UTC.
>
$ date -d 'Thursday, 12:00 PM UTC'
Thu Apr 11 20:00:00 CST 2013 (for +8000 timezone)
>
> So, what do you guys say?
>
> Cheers,
>
> Lucas
>
> ______________________________**_________________
> Autotest-kernel mailing list
> Autotest-kernel(a)redhat.com
> https://www.redhat.com/**mailman/listinfo/autotest-**kernel<https://www.redhat.com/mailman/listinfo/autotest-kernel>
>
11 years, 7 months
[libvirt] [PATCH 0/8] cleanup: Use bool type instead of bitfield
by Osier Yang
This changes all the bitfield into bool type in domain_conf.h,
except domain->autostart, domain->persistent, and domain->updated,
as the public APIs like virDomainIsPersistent returns domain->persistent
as integer, they can be changed internally, but not that deserved.
Osier Yang (8):
Cleanup: Change datatype of hostdev->managed to boolean
Cleanup: Change datatype of origstate's members into boolean
cleanup: Change datatype of hostdev->missing to boolean
cleanup: Change datatype of auth->expires to boolean
cleanup: Change datatype of disk->shared to boolean
cleanup: Change datatype of disk->transient to boolean
cleanup: Change datatype of disk->readonly to boolean
cleanup: Change datatype of fs->readonly to boolean
src/conf/domain_conf.c | 20 ++++++-------
src/conf/domain_conf.h | 20 ++++++-------
src/lxc/lxc_hostdev.c | 2 +-
src/parallels/parallels_driver.c | 2 +-
src/qemu/qemu_command.c | 10 +++----
src/qemu/qemu_hostdev.c | 2 +-
src/util/virpci.c | 64 ++++++++++++++++++++--------------------
src/util/virpci.h | 8 ++---
src/vbox/vbox_tmpl.c | 12 ++++----
src/xenxs/xen_sxpr.c | 8 ++---
src/xenxs/xen_xm.c | 8 ++---
11 files changed, 78 insertions(+), 78 deletions(-)
--
1.8.1.4
11 years, 7 months