[libvirt] [PATCH] qemu:Delete sockets which act as UNIX domain socket server
by Wangyufei (A)
When I shutdown a vm, I found sockets which act as UNIX domain socket server were not deleted. When I add the following code, it work out.
Signed-off-by: WangYufei <james.wangyufei(a)huawei.com<mailto:james.wangyufei@huawei.com>>
---
src/qemu/qemu_process.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3d5e8f6..e794f37 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4086,6 +4086,13 @@ void qemuProcessStop(virQEMUDriverPtr driver,
priv->monConfig = NULL;
}
+ /* remove socket which acts as UNIX domain socket server */
+ for (i = 0; i < vm->def->nchannels; i++) {
+ if ((vm->def->channels[i]->source.type == VIR_DOMAIN_CHR_TYPE_UNIX) &&
+ vm->def->channels[i]->source.data.nix.listen)
+ unlink(vm->def->channels[i]->source.data.nix.path);
+ }
+
/* shut it off for sure */
ignore_value(qemuProcessKill(vm,
VIR_QEMU_PROCESS_KILL_FORCE|
--
1.7.3.1.msysgit.0
Best Regards,
-WangYufei
11 years, 5 months
[libvirt] [PATCH] virsh: fix change-media bug on disk block type
by Guannan Ren
Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=923053
When cdrom is block type, the virsh change-media failed to insert
source info because virsh uses "<source block='/dev/sdb'/>" while
the correct name of the attribute for block disks is "dev".
---
tools/virsh-domain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 606bcdf..8cafce4 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9866,8 +9866,10 @@ vshPrepareDiskXML(xmlNodePtr disk_node,
if (source) {
new_node = xmlNewNode(NULL, BAD_CAST "source");
- xmlNewProp(new_node, (const xmlChar *)disk_type,
- (const xmlChar *)source);
+ if (STREQ(disk_type, "block"))
+ xmlNewProp(new_node, BAD_CAST "dev", BAD_CAST source);
+ else
+ xmlNewProp(new_node, BAD_CAST disk_type, BAD_CAST source);
xmlAddChild(disk_node, new_node);
} else if (type == VSH_PREPARE_DISK_XML_INSERT) {
vshError(NULL, _("No source is specified for inserting media"));
--
1.8.3.1
11 years, 5 months
[libvirt] [PATCH] tests: Free test at the end of GetDeviceAliases JSON test
by Jiri Denemark
Commit 58b147ad07c9432b53e66ca20aff74d812647c57 added a test for
qemuMonitorGetDeviceAliases but forgot to free the test object at the
end which causes all sort of weird errors and failures when new tests
are added after the GetDeviceAliases.
---
tests/qemumonitorjsontest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 4061a0c..9e66059 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -938,6 +938,7 @@ testQemuMonitorJSONGetDeviceAliases(const void *data)
cleanup:
virStringFreeList(aliases);
+ qemuMonitorTestFree(test);
return ret;
}
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH] doc: Fix copy-paste-error in virNodeGetMemoryStats
by Philipp Hahn
The description seems to be copied from virNodeGetCpuState.
Change wrong 'cpu' to 'memory'.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/libvirt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index bc1694a..12f9c41 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -7521,7 +7521,7 @@ error:
* @flags: extra flags; not used yet, so callers should always pass 0
*
* This function provides memory stats of the node.
- * If you want to get total cpu statistics of the node, you must specify
+ * If you want to get total memory statistics of the node, you must specify
* VIR_NODE_MEMORY_STATS_ALL_CELLS to @cellNum.
* The @params array will be filled with the values equal to the number of
* stats suggested by @nparams
--
1.7.10.4
11 years, 5 months
[libvirt] [PATCH] bridge driver: s/network_driver/virNetworkDriverState/
by Roman Bogorodskiy
This is another cleanup before extracting platform-specific
parts from bridge_driver.
Rename struct network_driver to _virNetworkDriverState and
add appropriate typedefs: virNetworkDriverState and
virNetworkDriverStatePtr.
This will help us to avoid potential problems when moving
this struct to the .h file.
---
src/network/bridge_driver.c | 110 ++++++++++++++++++++++----------------------
1 file changed, 56 insertions(+), 54 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index a7ff602..8b50659 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -70,7 +70,7 @@
#define VIR_FROM_THIS VIR_FROM_NETWORK
/* Main driver state */
-struct network_driver {
+struct _virNetworkDriverState {
virMutex lock;
virNetworkObjList networks;
@@ -84,45 +84,47 @@ struct network_driver {
dnsmasqCapsPtr dnsmasqCaps;
};
+typedef struct _virNetworkDriverState virNetworkDriverState;
+typedef virNetworkDriverState *virNetworkDriverStatePtr;
-static void networkDriverLock(struct network_driver *driver)
+static void networkDriverLock(virNetworkDriverStatePtr driver)
{
virMutexLock(&driver->lock);
}
-static void networkDriverUnlock(struct network_driver *driver)
+static void networkDriverUnlock(virNetworkDriverStatePtr driver)
{
virMutexUnlock(&driver->lock);
}
static int networkStateCleanup(void);
-static int networkStartNetwork(struct network_driver *driver,
+static int networkStartNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static int networkShutdownNetwork(struct network_driver *driver,
+static int networkShutdownNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static int networkStartNetworkVirtual(struct network_driver *driver,
+static int networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static int networkShutdownNetworkVirtual(struct network_driver *driver,
+static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static int networkStartNetworkExternal(struct network_driver *driver,
+static int networkStartNetworkExternal(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static int networkShutdownNetworkExternal(struct network_driver *driver,
+static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
-static void networkReloadIptablesRules(struct network_driver *driver);
-static void networkRefreshDaemons(struct network_driver *driver);
+static void networkReloadIptablesRules(virNetworkDriverStatePtr driver);
+static void networkRefreshDaemons(virNetworkDriverStatePtr driver);
static int networkPlugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface);
static int networkUnplugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface);
-static struct network_driver *driverState = NULL;
+static virNetworkDriverStatePtr driverState = NULL;
static char *
networkDnsmasqLeaseFileNameDefault(const char *netname)
@@ -169,7 +171,7 @@ networkRadvdConfigFileName(const char *netname)
/* do needed cleanup steps and remove the network from the list */
static int
-networkRemoveInactive(struct network_driver *driver,
+networkRemoveInactive(virNetworkDriverStatePtr driver,
virNetworkObjPtr net)
{
char *leasefile = NULL;
@@ -256,7 +258,7 @@ networkBridgeDummyNicName(const char *brname)
}
static void
-networkFindActiveConfigs(struct network_driver *driver)
+networkFindActiveConfigs(virNetworkDriverStatePtr driver)
{
size_t i;
@@ -308,7 +310,7 @@ networkFindActiveConfigs(struct network_driver *driver)
static void
-networkAutostartConfigs(struct network_driver *driver) {
+networkAutostartConfigs(virNetworkDriverStatePtr driver) {
size_t i;
for (i = 0; i < driver->networks.count; i++) {
@@ -327,7 +329,7 @@ networkAutostartConfigs(struct network_driver *driver) {
static DBusHandlerResult
firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusMessage *message, void *user_data) {
- struct network_driver *_driverState = user_data;
+ virNetworkDriverStatePtr _driverState = user_data;
if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
"NameOwnerChanged") ||
@@ -1025,7 +1027,7 @@ cleanup:
}
static int
-networkStartDhcpDaemon(struct network_driver *driver,
+networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
virCommandPtr cmd = NULL;
@@ -1112,7 +1114,7 @@ cleanup:
* Returns 0 on success, -1 on failure.
*/
static int
-networkRefreshDhcpDaemon(struct network_driver *driver,
+networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
int ret = -1;
@@ -1180,7 +1182,7 @@ cleanup:
* Returns 0 on success, -1 on failure.
*/
static int
-networkRestartDhcpDaemon(struct network_driver *driver,
+networkRestartDhcpDaemon(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
/* if there is a running dnsmasq, kill it */
@@ -1324,7 +1326,7 @@ cleanup:
}
static int
-networkStartRadvd(struct network_driver *driver ATTRIBUTE_UNUSED,
+networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
virNetworkObjPtr network)
{
char *pidfile = NULL;
@@ -1410,7 +1412,7 @@ cleanup:
}
static int
-networkRefreshRadvd(struct network_driver *driver ATTRIBUTE_UNUSED,
+networkRefreshRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
virNetworkObjPtr network)
{
char *radvdpidbase;
@@ -1449,7 +1451,7 @@ networkRefreshRadvd(struct network_driver *driver ATTRIBUTE_UNUSED,
#if 0
/* currently unused, so it causes a build error unless we #if it out */
static int
-networkRestartRadvd(struct network_driver *driver,
+networkRestartRadvd(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
char *radvdpidbase;
@@ -1478,7 +1480,7 @@ networkRestartRadvd(struct network_driver *driver,
* This should be called when libvirtd is restarted.
*/
static void
-networkRefreshDaemons(struct network_driver *driver)
+networkRefreshDaemons(virNetworkDriverStatePtr driver)
{
size_t i;
@@ -2097,7 +2099,7 @@ networkRemoveIptablesRules(virNetworkObjPtr network)
}
static void
-networkReloadIptablesRules(struct network_driver *driver)
+networkReloadIptablesRules(virNetworkDriverStatePtr driver)
{
size_t i;
@@ -2373,7 +2375,7 @@ networkAddRouteToBridge(virNetworkObjPtr network,
}
static int
-networkStartNetworkVirtual(struct network_driver *driver,
+networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
size_t i;
@@ -2552,7 +2554,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
return -1;
}
-static int networkShutdownNetworkVirtual(struct network_driver *driver ATTRIBUTE_UNUSED,
+static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
virNetworkObjPtr network)
{
virNetDevBandwidthClear(network->def->bridge);
@@ -2600,7 +2602,7 @@ static int networkShutdownNetworkVirtual(struct network_driver *driver ATTRIBUTE
}
static int
-networkStartNetworkExternal(struct network_driver *driver ATTRIBUTE_UNUSED,
+networkStartNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
virNetworkObjPtr network ATTRIBUTE_UNUSED)
{
/* put anything here that needs to be done each time a network of
@@ -2611,7 +2613,7 @@ networkStartNetworkExternal(struct network_driver *driver ATTRIBUTE_UNUSED,
return 0;
}
-static int networkShutdownNetworkExternal(struct network_driver *driver ATTRIBUTE_UNUSED,
+static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
virNetworkObjPtr network ATTRIBUTE_UNUSED)
{
/* put anything here that needs to be done each time a network of
@@ -2623,7 +2625,7 @@ static int networkShutdownNetworkExternal(struct network_driver *driver ATTRIBUT
}
static int
-networkStartNetwork(struct network_driver *driver,
+networkStartNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
int ret = 0;
@@ -2682,7 +2684,7 @@ error:
return ret;
}
-static int networkShutdownNetwork(struct network_driver *driver,
+static int networkShutdownNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network)
{
int ret = 0;
@@ -2726,7 +2728,7 @@ static int networkShutdownNetwork(struct network_driver *driver,
static virNetworkPtr networkLookupByUUID(virConnectPtr conn,
const unsigned char *uuid) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
virNetworkObjPtr network;
virNetworkPtr ret = NULL;
@@ -2752,7 +2754,7 @@ cleanup:
static virNetworkPtr networkLookupByName(virConnectPtr conn,
const char *name) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
virNetworkObjPtr network;
virNetworkPtr ret = NULL;
@@ -2797,7 +2799,7 @@ static int networkClose(virConnectPtr conn) {
static int networkConnectNumOfNetworks(virConnectPtr conn) {
int nactive = 0;
size_t i;
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
if (virConnectNumOfNetworksEnsureACL(conn) < 0)
return -1;
@@ -2817,7 +2819,7 @@ static int networkConnectNumOfNetworks(virConnectPtr conn) {
}
static int networkConnectListNetworks(virConnectPtr conn, char **const names, int nnames) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
int got = 0;
size_t i;
@@ -2852,7 +2854,7 @@ static int networkConnectListNetworks(virConnectPtr conn, char **const names, in
static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) {
int ninactive = 0;
size_t i;
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
return -1;
@@ -2872,7 +2874,7 @@ static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) {
}
static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
int got = 0;
size_t i;
@@ -2908,7 +2910,7 @@ networkConnectListAllNetworks(virConnectPtr conn,
virNetworkPtr **nets,
unsigned int flags)
{
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
@@ -2928,7 +2930,7 @@ cleanup:
static int networkIsActive(virNetworkPtr net)
{
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr obj;
int ret = -1;
@@ -2953,7 +2955,7 @@ cleanup:
static int networkIsPersistent(virNetworkPtr net)
{
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr obj;
int ret = -1;
@@ -2978,7 +2980,7 @@ cleanup:
static int
-networkValidate(struct network_driver *driver,
+networkValidate(virNetworkDriverStatePtr driver,
virNetworkDefPtr def,
bool check_active)
{
@@ -3127,7 +3129,7 @@ networkValidate(struct network_driver *driver,
}
static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
virNetworkDefPtr def;
virNetworkObjPtr network = NULL;
virNetworkPtr ret = NULL;
@@ -3169,7 +3171,7 @@ cleanup:
}
static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml) {
- struct network_driver *driver = conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
virNetworkDefPtr def = NULL;
bool freeDef = true;
virNetworkObjPtr network = NULL;
@@ -3227,7 +3229,7 @@ cleanup:
static int
networkUndefine(virNetworkPtr net) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
int ret = -1;
bool active = false;
@@ -3284,7 +3286,7 @@ networkUpdate(virNetworkPtr net,
const char *xml,
unsigned int flags)
{
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network = NULL;
int isActive, ret = -1;
size_t i;
@@ -3430,7 +3432,7 @@ cleanup:
}
static int networkCreate(virNetworkPtr net) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
int ret = -1;
@@ -3456,7 +3458,7 @@ cleanup:
}
static int networkDestroy(virNetworkPtr net) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
int ret = -1;
@@ -3500,7 +3502,7 @@ cleanup:
static char *networkGetXMLDesc(virNetworkPtr net,
unsigned int flags)
{
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
virNetworkDefPtr def;
char *ret = NULL;
@@ -3534,7 +3536,7 @@ cleanup:
}
static char *networkGetBridgeName(virNetworkPtr net) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
char *bridge = NULL;
@@ -3568,7 +3570,7 @@ cleanup:
static int networkGetAutostart(virNetworkPtr net,
int *autostart) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
int ret = -1;
@@ -3595,7 +3597,7 @@ cleanup:
static int networkSetAutostart(virNetworkPtr net,
int autostart) {
- struct network_driver *driver = net->conn->networkPrivateData;
+ virNetworkDriverStatePtr driver = net->conn->networkPrivateData;
virNetworkObjPtr network;
char *configFile = NULL, *autostartLink = NULL;
int ret = -1;
@@ -3794,7 +3796,7 @@ finish:
int
networkAllocateActualDevice(virDomainNetDefPtr iface)
{
- struct network_driver *driver = driverState;
+ virNetworkDriverStatePtr driver = driverState;
enum virDomainNetType actualType = iface->type;
virNetworkObjPtr network = NULL;
virNetworkDefPtr netdef = NULL;
@@ -4192,7 +4194,7 @@ error:
int
networkNotifyActualDevice(virDomainNetDefPtr iface)
{
- struct network_driver *driver = driverState;
+ virNetworkDriverStatePtr driver = driverState;
enum virDomainNetType actualType = virDomainNetGetActualType(iface);
virNetworkObjPtr network;
virNetworkDefPtr netdef;
@@ -4370,7 +4372,7 @@ error:
int
networkReleaseActualDevice(virDomainNetDefPtr iface)
{
- struct network_driver *driver = driverState;
+ virNetworkDriverStatePtr driver = driverState;
enum virDomainNetType actualType = virDomainNetGetActualType(iface);
virNetworkObjPtr network;
virNetworkDefPtr netdef;
@@ -4525,7 +4527,7 @@ int
networkGetNetworkAddress(const char *netname, char **netaddr)
{
int ret = -1;
- struct network_driver *driver = driverState;
+ virNetworkDriverStatePtr driver = driverState;
virNetworkObjPtr network;
virNetworkDefPtr netdef;
virNetworkIpDefPtr ipdef;
--
1.7.11.5
11 years, 5 months
[libvirt] [PATCH] cpu: Let explicit features override model features
by Jiri Denemark
Until now CPU features inherited from a specified CPU model could only
be overridden with 'disable' policy. With this patch, any explicitly
specified feature always overrides the same feature inherited from a CPU
model regardless on the specified policy.
The CPU in x86-exact-force-Haswell.xml would previously be incompatible
with x86-host-SandyBridge.xml CPU even though x86-host-SandyBridge.xml
provides all features required by x86-exact-force-Haswell.xml.
---
src/cpu/cpu_x86.c | 5 +++++
tests/cputest.c | 1 +
tests/cputestdata/x86-exact-force-Haswell.xml | 15 +++++++++++++++
tests/cputestdata/x86-host-SandyBridge.xml | 6 ++++++
4 files changed, 27 insertions(+)
create mode 100644 tests/cputestdata/x86-exact-force-Haswell.xml
create mode 100644 tests/cputestdata/x86-host-SandyBridge.xml
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 4564bd4..a388f0f 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1223,6 +1223,11 @@ x86Compute(virCPUDefPtr host,
goto out;
}
+ /* first remove features that were inherited from the CPU model and were
+ * explicitly forced, disabled, or made optional
+ */
+ x86DataSubtract(cpu_require->data, cpu_force->data);
+ x86DataSubtract(cpu_require->data, cpu_optional->data);
x86DataSubtract(cpu_require->data, cpu_disable->data);
result = x86ModelCompare(host_model, cpu_require);
if (result == SUBSET || result == UNRELATED) {
diff --git a/tests/cputest.c b/tests/cputest.c
index d3865c4..803e395 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -581,6 +581,7 @@ mymain(void)
DO_TEST_COMPARE("x86", "host", "pentium3-amd", VIR_CPU_COMPARE_INCOMPATIBLE);
DO_TEST_COMPARE("x86", "host-amd", "pentium3-amd", VIR_CPU_COMPARE_SUPERSET);
DO_TEST_COMPARE("x86", "host-worse", "nehalem-force", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE("x86", "host-SandyBridge", "exact-force-Haswell", VIR_CPU_COMPARE_IDENTICAL);
/* guest updates for migration
* automatically compares host CPU with the result */
diff --git a/tests/cputestdata/x86-exact-force-Haswell.xml b/tests/cputestdata/x86-exact-force-Haswell.xml
new file mode 100644
index 0000000..614ed7e
--- /dev/null
+++ b/tests/cputestdata/x86-exact-force-Haswell.xml
@@ -0,0 +1,15 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>Haswell</model>
+ <feature policy='force' name='pcid'/>
+ <feature policy='force' name='rtm'/>
+ <feature policy='force' name='invpcid'/>
+ <feature policy='force' name='erms'/>
+ <feature policy='force' name='bmi2'/>
+ <feature policy='optional' name='smep'/>
+ <feature policy='optional' name='avx2'/>
+ <feature policy='optional' name='hle'/>
+ <feature policy='force' name='bmi1'/>
+ <feature policy='force' name='fsgsbase'/>
+ <feature policy='disable' name='movbe'/>
+ <feature policy='disable' name='fma'/>
+</cpu>
diff --git a/tests/cputestdata/x86-host-SandyBridge.xml b/tests/cputestdata/x86-host-SandyBridge.xml
new file mode 100644
index 0000000..7f26b7b
--- /dev/null
+++ b/tests/cputestdata/x86-host-SandyBridge.xml
@@ -0,0 +1,6 @@
+<cpu>
+ <arch>x86_64</arch>
+ <model>SandyBridge</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+</cpu>
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH 0/3] Several cleanups for cpu driver
by Jiri Denemark
Jiri Denemark (3):
cpu_x86: Use x86-specific CPU data structure
Replace union cpuData with virCPUData
cpu: Store arch in virCPUData
src/cpu/cpu.c | 31 +++--
src/cpu/cpu.h | 62 ++++-----
src/cpu/cpu_arm.c | 8 +-
src/cpu/cpu_powerpc.c | 12 +-
src/cpu/cpu_s390.c | 8 +-
src/cpu/cpu_x86.c | 301 +++++++++++++++++++++++++++----------------
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_command.c | 9 +-
src/vmware/vmware_conf.c | 5 +-
tests/cputest.c | 10 +-
10 files changed, 264 insertions(+), 186 deletions(-)
--
1.8.3.2
11 years, 5 months
[libvirt] [RFC PATCH] qemu: Shorten SCSI hostdev alias to avoid QEMU failure
by Viktor Mihajlovski
The alias for hostdevs of type SCSI can be too long for QEMU if
larger LUNs are encountered. Here's a real life example:
<hostdev mode='subsystem' type='scsi' managed='no'>
<source>
<adapter name='scsi_host0'/>
<address bus='0' target='19' unit='1088634913'/>
</source>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
this results in a too long drive id, resulting in QEMU yelling
Property 'scsi-generic.drive' can't find value 'drive-hostdev-scsi_host0-0-19-1088634913'
This commit changes the alias back to the default hostdev$(index)
scheme.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
Actually this is highlighting a larger issue. Apparently QEMU ids
are limited to a length of 32 bytes. This means that SCSI based
drives are also in danger to exceed this limit.
We should consider to use a drive index for controller-attached
disks for alias generation instead of the verbose
drive-$bustype-$busaddress schema.
src/qemu/qemu_command.c | 10 +---------
.../qemuxml2argv-hostdev-scsi-boot.args | 4 ++--
.../qemuxml2argv-hostdev-scsi-lsi.args | 4 ++--
.../qemuxml2argv-hostdev-scsi-readonly.args | 4 ++--
.../qemuxml2argv-hostdev-scsi-virtio-scsi.args | 4 ++--
5 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 879aed8..8c8bef2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -818,16 +818,8 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev
}
}
- if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
- if (virAsprintf(&hostdev->info->alias, "hostdev-%s-%d-%d-%d",
- hostdev->source.subsys.u.scsi.adapter,
- hostdev->source.subsys.u.scsi.bus,
- hostdev->source.subsys.u.scsi.target,
- hostdev->source.subsys.u.scsi.unit) < 0)
- return -1;
- } else if (virAsprintf(&hostdev->info->alias, "hostdev%d", idx) < 0) {
+ if (virAsprintf(&hostdev->info->alias, "hostdev%d", idx) < 0)
return -1;
- }
return 0;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args
index cd22672..ba1e6c6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi \
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb \
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/sg0,if=none,id=drive-hostdev-scsi_host0-0-0-0 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev-scsi_host0-0-0-0,id=hostdev-scsi_host0-0-0-0,bootindex=1 \
+-drive file=/dev/sg0,if=none,id=drive-hostdev0 \
+-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev0,id=hostdev0,bootindex=1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi.args
index 06f7938..2cbf9be 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi.args
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-device lsi,id=scsi0,bus=pci.0,addr=0x3 -usb \
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/sg0,if=none,id=drive-hostdev-scsi_host0-0-0-0 \
--device scsi-generic,bus=scsi0.0,scsi-id=7,drive=drive-hostdev-scsi_host0-0-0-0,id=hostdev-scsi_host0-0-0-0 \
+-drive file=/dev/sg0,if=none,id=drive-hostdev0 \
+-device scsi-generic,bus=scsi0.0,scsi-id=7,drive=drive-hostdev0,id=hostdev0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args
index ea2f7af..8c274a9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb \
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/sg0,if=none,id=drive-hostdev-scsi_host0-0-0-0,readonly=on \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev-scsi_host0-0-0-0,id=hostdev-scsi_host0-0-0-0 \
+-drive file=/dev/sg0,if=none,id=drive-hostdev0,readonly=on \
+-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev0,id=hostdev0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-scsi.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-scsi.args
index b92afc7..a7d6789 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-scsi.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-scsi.args
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb \
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/sg0,if=none,id=drive-hostdev-scsi_host0-0-0-0 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev-scsi_host0-0-0-0,id=hostdev-scsi_host0-0-0-0 \
+-drive file=/dev/sg0,if=none,id=drive-hostdev0 \
+-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev0,id=hostdev0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
--
1.7.9.5
11 years, 5 months
[libvirt] [PATCH] Split up platfrom specifics from bridge driver
by Roman Bogorodskiy
This is a second step for making bridge_driver more portable.
This one splits up bridge driver into platform specific and general
parts. Platform specifc parts are mostly firewalling stuff.
So the support for new platforms should be added by implementing
bridge_driver_$platform.c
However, you might notice I didn't move some ports of the
platform specific code. E.g. I left networkEnableIpForwarding
in bridge_driver.c because it feels like the implementation for
e.g. all BSDs would be the same (while firewalling stuff would
be different on BSDs) to avoid code copy/paste.
Roman Bogorodskiy (1):
Split up platfrom specifics from bridge driver
po/POTFILES.in | 1 +
src/Makefile.am | 5 +-
src/network/bridge_driver.c | 729 +---------------------------------
src/network/bridge_driver_linux.c | 709 +++++++++++++++++++++++++++++++++
src/network/bridge_driver_noop.c | 80 ++++
src/network/bridge_driver_platform.c | 32 ++
src/network/bridge_driver_platform.h | 77 ++++
7 files changed, 915 insertions(+), 718 deletions(-)
create mode 100644 src/network/bridge_driver_linux.c
create mode 100644 src/network/bridge_driver_noop.c
create mode 100644 src/network/bridge_driver_platform.c
create mode 100644 src/network/bridge_driver_platform.h
--
1.7.9.5
11 years, 5 months