Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1846b80b
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1846b80b
编写于
12月 11, 2012
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert CPU APIs to use virArch
Signed-off-by:
N
Daniel P. Berrange
<
berrange@redhat.com
>
上级
c25c18f7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
81 addition
and
73 deletion
+81
-73
src/conf/cpu_conf.c
src/conf/cpu_conf.c
+15
-9
src/conf/cpu_conf.h
src/conf/cpu_conf.h
+2
-1
src/cpu/cpu.c
src/cpu/cpu.c
+20
-20
src/cpu/cpu.h
src/cpu/cpu.h
+6
-5
src/cpu/cpu_arm.c
src/cpu/cpu_arm.c
+1
-1
src/cpu/cpu_generic.c
src/cpu/cpu_generic.c
+6
-4
src/cpu/cpu_powerpc.c
src/cpu/cpu_powerpc.c
+7
-7
src/cpu/cpu_s390.c
src/cpu/cpu_s390.c
+1
-1
src/cpu/cpu_x86.c
src/cpu/cpu_x86.c
+9
-9
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.c
+5
-5
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+4
-4
src/vmware/vmware_conf.c
src/vmware/vmware_conf.c
+5
-7
未找到文件。
src/conf/cpu_conf.c
浏览文件 @
1846b80b
...
...
@@ -79,7 +79,6 @@ virCPUDefFree(virCPUDefPtr def)
if
(
!
def
)
return
;
VIR_FREE
(
def
->
arch
);
virCPUDefFreeModel
(
def
);
for
(
i
=
0
;
i
<
def
->
ncells
;
i
++
)
{
...
...
@@ -149,9 +148,7 @@ virCPUDefCopy(const virCPUDefPtr cpu)
copy
->
sockets
=
cpu
->
sockets
;
copy
->
cores
=
cpu
->
cores
;
copy
->
threads
=
cpu
->
threads
;
if
(
cpu
->
arch
&&
!
(
copy
->
arch
=
strdup
(
cpu
->
arch
)))
goto
no_memory
;
copy
->
arch
=
cpu
->
arch
;
if
(
virCPUDefCopyModel
(
copy
,
cpu
,
false
)
<
0
)
goto
error
;
...
...
@@ -273,12 +270,19 @@ virCPUDefParseXML(const xmlNodePtr node,
}
if
(
def
->
type
==
VIR_CPU_TYPE_HOST
)
{
def
->
arch
=
virXPathString
(
"string(./arch[1])"
,
ctxt
);
if
(
!
def
->
arch
)
{
char
*
arch
=
virXPathString
(
"string(./arch[1])"
,
ctxt
);
if
(
!
arch
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Missing CPU architecture"
));
goto
error
;
}
if
((
def
->
arch
=
virArchFromString
(
arch
))
==
VIR_ARCH_NONE
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unknown architecture %s"
),
arch
);
VIR_FREE
(
arch
);
goto
error
;
}
VIR_FREE
(
arch
);
}
if
(
!
(
def
->
model
=
virXPathString
(
"string(./model[1])"
,
ctxt
))
&&
...
...
@@ -554,7 +558,8 @@ virCPUDefFormatBufFull(virBufferPtr buf,
virBufferAddLit
(
buf
,
">
\n
"
);
if
(
def
->
arch
)
virBufferAsprintf
(
buf
,
" <arch>%s</arch>
\n
"
,
def
->
arch
);
virBufferAsprintf
(
buf
,
" <arch>%s</arch>
\n
"
,
virArchToString
(
def
->
arch
));
virBufferAdjustIndent
(
buf
,
2
);
if
(
virCPUDefFormatBuf
(
buf
,
def
,
flags
)
<
0
)
...
...
@@ -734,10 +739,11 @@ virCPUDefIsEqual(virCPUDefPtr src,
goto
cleanup
;
}
if
(
STRNEQ_NULLABLE
(
src
->
arch
,
dst
->
arch
)
)
{
if
(
src
->
arch
!=
dst
->
arch
)
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
_
(
"Target CPU arch %s does not match source %s"
),
NULLSTR
(
dst
->
arch
),
NULLSTR
(
src
->
arch
));
virArchToString
(
dst
->
arch
),
virArchToString
(
src
->
arch
));
goto
cleanup
;
}
...
...
src/conf/cpu_conf.h
浏览文件 @
1846b80b
...
...
@@ -28,6 +28,7 @@
# include "buf.h"
# include "xml.h"
# include "bitmap.h"
# include "virarch.h"
# define VIR_CPU_VENDOR_ID_LENGTH 12
...
...
@@ -104,7 +105,7 @@ struct _virCPUDef {
int
type
;
/* enum virCPUType */
int
mode
;
/* enum virCPUMode */
int
match
;
/* enum virCPUMatch */
char
*
arch
;
virArch
arch
;
char
*
model
;
char
*
vendor_id
;
/* vendor id returned by CPUID in the guest */
int
fallback
;
/* enum virCPUFallback */
...
...
src/cpu/cpu.c
浏览文件 @
1846b80b
...
...
@@ -48,12 +48,12 @@ static struct cpuArchDriver *drivers[] = {
static
struct
cpuArchDriver
*
cpuGetSubDriver
(
const
char
*
arch
)
cpuGetSubDriver
(
virArch
arch
)
{
unsigned
int
i
;
unsigned
int
j
;
if
(
arch
==
NULL
)
{
if
(
arch
==
VIR_ARCH_NONE
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"undefined hardware architecture"
));
return
NULL
;
...
...
@@ -61,7 +61,7 @@ cpuGetSubDriver(const char *arch)
for
(
i
=
0
;
i
<
NR_DRIVERS
-
1
;
i
++
)
{
for
(
j
=
0
;
j
<
drivers
[
i
]
->
narch
;
j
++
)
{
if
(
STREQ
(
arch
,
drivers
[
i
]
->
arch
[
j
])
)
if
(
arch
==
drivers
[
i
]
->
arch
[
j
]
)
return
drivers
[
i
];
}
}
...
...
@@ -120,7 +120,7 @@ cpuCompare(virCPUDefPtr host,
if
(
driver
->
compare
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot compare CPUs of %s architecture"
),
host
->
arch
);
virArchToString
(
host
->
arch
)
);
return
VIR_CPU_COMPARE_ERROR
;
}
...
...
@@ -163,7 +163,7 @@ cpuDecode(virCPUDefPtr cpu,
if
(
driver
->
decode
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot decode CPU data for %s architecture"
),
cpu
->
arch
);
virArchToString
(
cpu
->
arch
)
);
return
-
1
;
}
...
...
@@ -172,7 +172,7 @@ cpuDecode(virCPUDefPtr cpu,
int
cpuEncode
(
const
char
*
arch
,
cpuEncode
(
virArch
arch
,
const
virCPUDefPtr
cpu
,
union
cpuData
**
forced
,
union
cpuData
**
required
,
...
...
@@ -185,7 +185,7 @@ cpuEncode(const char *arch,
VIR_DEBUG
(
"arch=%s, cpu=%p, forced=%p, required=%p, "
"optional=%p, disabled=%p, forbidden=%p, vendor=%p"
,
NULLSTR
(
arch
),
cpu
,
forced
,
required
,
virArchToString
(
arch
),
cpu
,
forced
,
required
,
optional
,
disabled
,
forbidden
,
vendor
);
if
((
driver
=
cpuGetSubDriver
(
arch
))
==
NULL
)
...
...
@@ -194,7 +194,7 @@ cpuEncode(const char *arch,
if
(
driver
->
encode
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot encode CPU data for %s architecture"
),
arch
);
virArchToString
(
arch
)
);
return
-
1
;
}
...
...
@@ -204,12 +204,12 @@ cpuEncode(const char *arch,
void
cpuDataFree
(
const
char
*
arch
,
cpuDataFree
(
virArch
arch
,
union
cpuData
*
data
)
{
struct
cpuArchDriver
*
driver
;
VIR_DEBUG
(
"arch=%s, data=%p"
,
NULLSTR
(
arch
),
data
);
VIR_DEBUG
(
"arch=%s, data=%p"
,
virArchToString
(
arch
),
data
);
if
(
data
==
NULL
)
return
;
...
...
@@ -220,7 +220,7 @@ cpuDataFree(const char *arch,
if
(
driver
->
free
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot free CPU data for %s architecture"
),
arch
);
virArchToString
(
arch
)
);
return
;
}
...
...
@@ -229,11 +229,11 @@ cpuDataFree(const char *arch,
union
cpuData
*
cpuNodeData
(
const
char
*
arch
)
cpuNodeData
(
virArch
arch
)
{
struct
cpuArchDriver
*
driver
;
VIR_DEBUG
(
"arch=%s"
,
NULLSTR
(
arch
));
VIR_DEBUG
(
"arch=%s"
,
virArchToString
(
arch
));
if
((
driver
=
cpuGetSubDriver
(
arch
))
==
NULL
)
return
NULL
;
...
...
@@ -241,7 +241,7 @@ cpuNodeData(const char *arch)
if
(
driver
->
nodeData
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot get node CPU data for %s architecture"
),
arch
);
virArchToString
(
arch
)
);
return
NULL
;
}
...
...
@@ -265,7 +265,7 @@ cpuGuestData(virCPUDefPtr host,
if
(
driver
->
guestData
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot compute guest CPU data for %s architecture"
),
host
->
arch
);
virArchToString
(
host
->
arch
)
);
return
VIR_CPU_COMPARE_ERROR
;
}
...
...
@@ -391,7 +391,7 @@ cpuBaseline(virCPUDefPtr *cpus,
if
(
driver
->
baseline
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot compute baseline CPU of %s architecture"
),
cpus
[
0
]
->
arch
);
virArchToString
(
cpus
[
0
]
->
arch
)
);
return
NULL
;
}
...
...
@@ -413,7 +413,7 @@ cpuUpdate(virCPUDefPtr guest,
if
(
driver
->
update
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot update guest CPU data for %s architecture"
),
host
->
arch
);
virArchToString
(
host
->
arch
)
);
return
-
1
;
}
...
...
@@ -421,14 +421,14 @@ cpuUpdate(virCPUDefPtr guest,
}
int
cpuHasFeature
(
const
char
*
arch
,
cpuHasFeature
(
virArch
arch
,
const
union
cpuData
*
data
,
const
char
*
feature
)
{
struct
cpuArchDriver
*
driver
;
VIR_DEBUG
(
"arch=%s, data=%p, feature=%s"
,
arch
,
data
,
feature
);
virArchToString
(
arch
)
,
data
,
feature
);
if
((
driver
=
cpuGetSubDriver
(
arch
))
==
NULL
)
return
-
1
;
...
...
@@ -436,7 +436,7 @@ cpuHasFeature(const char *arch,
if
(
driver
->
hasFeature
==
NULL
)
{
virReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"cannot check guest CPU data for %s architecture"
),
arch
);
virArchToString
(
arch
)
);
return
-
1
;
}
...
...
src/cpu/cpu.h
浏览文件 @
1846b80b
...
...
@@ -26,6 +26,7 @@
# include "virterror_internal.h"
# include "datatypes.h"
# include "virarch.h"
# include "conf/cpu_conf.h"
# include "cpu_x86_data.h"
# include "cpu_ppc_data.h"
...
...
@@ -88,7 +89,7 @@ typedef int
struct
cpuArchDriver
{
const
char
*
name
;
const
char
*
*
arch
;
const
virArch
*
arch
;
unsigned
int
narch
;
cpuArchCompare
compare
;
cpuArchDecode
decode
;
...
...
@@ -118,7 +119,7 @@ cpuDecode (virCPUDefPtr cpu,
const
char
*
preferred
);
extern
int
cpuEncode
(
const
char
*
arch
,
cpuEncode
(
virArch
arch
,
const
virCPUDefPtr
cpu
,
union
cpuData
**
forced
,
union
cpuData
**
required
,
...
...
@@ -128,11 +129,11 @@ cpuEncode (const char *arch,
union
cpuData
**
vendor
);
extern
void
cpuDataFree
(
const
char
*
arch
,
cpuDataFree
(
virArch
arch
,
union
cpuData
*
data
);
extern
union
cpuData
*
cpuNodeData
(
const
char
*
arch
);
cpuNodeData
(
virArch
arch
);
extern
virCPUCompareResult
cpuGuestData
(
virCPUDefPtr
host
,
...
...
@@ -157,7 +158,7 @@ cpuUpdate (virCPUDefPtr guest,
const
virCPUDefPtr
host
);
extern
int
cpuHasFeature
(
const
char
*
arch
,
cpuHasFeature
(
virArch
arch
,
const
union
cpuData
*
data
,
const
char
*
feature
);
...
...
src/cpu/cpu_arm.c
浏览文件 @
1846b80b
...
...
@@ -28,7 +28,7 @@
#define VIR_FROM_THIS VIR_FROM_CPU
static
const
char
*
archs
[]
=
{
"armv7l"
};
static
const
virArch
archs
[]
=
{
VIR_ARCH_ARMV7L
};
static
union
cpuData
*
ArmNodeData
(
void
)
...
...
src/cpu/cpu_generic.c
浏览文件 @
1846b80b
...
...
@@ -64,7 +64,8 @@ genericCompare(virCPUDefPtr host,
unsigned
int
i
;
unsigned
int
reqfeatures
;
if
((
cpu
->
arch
&&
STRNEQ
(
host
->
arch
,
cpu
->
arch
))
||
if
(((
cpu
->
arch
!=
VIR_ARCH_NONE
)
&&
(
host
->
arch
!=
cpu
->
arch
))
||
STRNEQ
(
host
->
model
,
cpu
->
model
))
return
VIR_CPU_COMPARE_INCOMPATIBLE
;
...
...
@@ -139,11 +140,11 @@ genericBaseline(virCPUDefPtr *cpus,
}
if
(
VIR_ALLOC
(
cpu
)
<
0
||
!
(
cpu
->
arch
=
strdup
(
cpus
[
0
]
->
arch
))
||
!
(
cpu
->
model
=
strdup
(
cpus
[
0
]
->
model
))
||
VIR_ALLOC_N
(
features
,
cpus
[
0
]
->
nfeatures
)
<
0
)
goto
no_memory
;
cpu
->
arch
=
cpus
[
0
]
->
arch
;
cpu
->
type
=
VIR_CPU_TYPE_HOST
;
count
=
nfeatures
=
cpus
[
0
]
->
nfeatures
;
...
...
@@ -153,10 +154,11 @@ genericBaseline(virCPUDefPtr *cpus,
for
(
i
=
1
;
i
<
ncpus
;
i
++
)
{
virHashTablePtr
hash
;
if
(
STRNEQ
(
cpu
->
arch
,
cpus
[
i
]
->
arch
)
)
{
if
(
cpu
->
arch
!=
cpus
[
i
]
->
arch
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"CPUs have incompatible architectures: '%s' != '%s'"
),
cpu
->
arch
,
cpus
[
i
]
->
arch
);
virArchToString
(
cpu
->
arch
),
virArchToString
(
cpus
[
i
]
->
arch
));
goto
error
;
}
...
...
src/cpu/cpu_powerpc.c
浏览文件 @
1846b80b
...
...
@@ -36,7 +36,7 @@
#define VIR_FROM_THIS VIR_FROM_CPU
static
const
char
*
archs
[]
=
{
"ppc64"
};
static
const
virArch
archs
[]
=
{
VIR_ARCH_PPC64
};
struct
cpuPowerPC
{
const
char
*
name
;
...
...
@@ -417,7 +417,8 @@ static virCPUCompareResult
PowerPCCompare
(
virCPUDefPtr
host
,
virCPUDefPtr
cpu
)
{
if
((
cpu
->
arch
&&
STRNEQ
(
host
->
arch
,
cpu
->
arch
))
||
if
((
cpu
->
arch
!=
VIR_ARCH_NONE
&&
(
host
->
arch
!=
cpu
->
arch
))
||
STRNEQ
(
host
->
model
,
cpu
->
model
))
return
VIR_CPU_COMPARE_INCOMPATIBLE
;
...
...
@@ -589,9 +590,10 @@ PowerPCBaseline(virCPUDefPtr *cpus,
goto
error
;
}
if
(
VIR_ALLOC
(
cpu
)
<
0
||
!
(
cpu
->
arch
=
strdup
(
cpus
[
0
]
->
arch
)))
goto
no_memory
;
if
(
VIR_ALLOC
(
cpu
)
<
0
)
goto
no_memory
;
cpu
->
arch
=
cpus
[
0
]
->
arch
;
cpu
->
type
=
VIR_CPU_TYPE_GUEST
;
cpu
->
match
=
VIR_CPU_MATCH_EXACT
;
...
...
@@ -610,8 +612,6 @@ PowerPCBaseline(virCPUDefPtr *cpus,
if
(
!
outputModel
)
VIR_FREE
(
cpu
->
model
);
VIR_FREE
(
cpu
->
arch
);
cleanup:
ppcModelFree
(
base_model
);
ppcMapFree
(
map
);
...
...
src/cpu/cpu_s390.c
浏览文件 @
1846b80b
...
...
@@ -29,7 +29,7 @@
#define VIR_FROM_THIS VIR_FROM_CPU
static
const
char
*
archs
[]
=
{
"s390"
,
"s390x"
};
static
const
virArch
archs
[]
=
{
VIR_ARCH_S390
,
VIR_ARCH_S390X
};
static
union
cpuData
*
s390NodeData
(
void
)
...
...
src/cpu/cpu_x86.c
浏览文件 @
1846b80b
...
...
@@ -40,7 +40,7 @@
static
const
struct
cpuX86cpuid
cpuidNull
=
{
0
,
0
,
0
,
0
,
0
};
static
const
char
*
archs
[]
=
{
"i686"
,
"x86_64"
};
static
const
virArch
archs
[]
=
{
VIR_ARCH_I686
,
VIR_ARCH_X86_64
};
struct
x86_vendor
{
char
*
name
;
...
...
@@ -1165,22 +1165,23 @@ x86Compute(virCPUDefPtr host,
enum
compare_result
result
;
unsigned
int
i
;
if
(
cpu
->
arch
!=
NULL
)
{
if
(
cpu
->
arch
!=
VIR_ARCH_NONE
)
{
bool
found
=
false
;
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
archs
);
i
++
)
{
if
(
STREQ
(
archs
[
i
],
cpu
->
arch
)
)
{
if
(
archs
[
i
]
==
cpu
->
arch
)
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
VIR_DEBUG
(
"CPU arch %s does not match host arch"
,
cpu
->
arch
);
VIR_DEBUG
(
"CPU arch %s does not match host arch"
,
virArchToString
(
cpu
->
arch
));
if
(
message
&&
virAsprintf
(
message
,
_
(
"CPU arch %s does not match host arch"
),
cpu
->
arch
)
<
0
)
virArchToString
(
cpu
->
arch
)
)
<
0
)
goto
no_memory
;
return
VIR_CPU_COMPARE_INCOMPATIBLE
;
}
...
...
@@ -1643,9 +1644,10 @@ x86Baseline(virCPUDefPtr *cpus,
if
(
!
(
base_model
=
x86ModelFromCPU
(
cpus
[
0
],
map
,
VIR_CPU_FEATURE_REQUIRE
)))
goto
error
;
if
(
VIR_ALLOC
(
cpu
)
<
0
||
!
(
cpu
->
arch
=
strdup
(
cpus
[
0
]
->
arch
)))
if
(
VIR_ALLOC
(
cpu
)
<
0
)
goto
no_memory
;
cpu
->
arch
=
cpus
[
0
]
->
arch
;
cpu
->
type
=
VIR_CPU_TYPE_GUEST
;
cpu
->
match
=
VIR_CPU_MATCH_EXACT
;
...
...
@@ -1713,8 +1715,6 @@ x86Baseline(virCPUDefPtr *cpus,
if
(
!
outputVendor
)
VIR_FREE
(
cpu
->
vendor
);
VIR_FREE
(
cpu
->
arch
);
cleanup:
x86ModelFree
(
base_model
);
x86MapFree
(
map
);
...
...
src/qemu/qemu_capabilities.c
浏览文件 @
1846b80b
...
...
@@ -811,14 +811,14 @@ qemuCapsInitCPU(virCapsPtr caps,
union
cpuData
*
data
=
NULL
;
virNodeInfo
nodeinfo
;
int
ret
=
-
1
;
const
char
*
archstr
=
virArchToString
(
arch
);
if
(
VIR_ALLOC
(
cpu
)
<
0
||
!
(
cpu
->
arch
=
strdup
(
archstr
)))
{
if
(
VIR_ALLOC
(
cpu
)
<
0
)
{
virReportOOMError
();
goto
error
;
}
cpu
->
arch
=
arch
;
if
(
nodeGetInfo
(
NULL
,
&
nodeinfo
))
goto
error
;
...
...
@@ -828,14 +828,14 @@ qemuCapsInitCPU(virCapsPtr caps,
cpu
->
threads
=
nodeinfo
.
threads
;
caps
->
host
.
cpu
=
cpu
;
if
(
!
(
data
=
cpuNodeData
(
arch
str
))
if
(
!
(
data
=
cpuNodeData
(
arch
))
||
cpuDecode
(
cpu
,
data
,
NULL
,
0
,
NULL
)
<
0
)
goto
cleanup
;
ret
=
0
;
cleanup:
cpuDataFree
(
arch
str
,
data
);
cpuDataFree
(
arch
,
data
);
return
ret
;
...
...
src/qemu/qemu_command.c
浏览文件 @
1846b80b
...
...
@@ -4409,10 +4409,10 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
virBufferAddLit
(
&
buf
,
"host"
);
}
else
{
if
(
VIR_ALLOC
(
guest
)
<
0
||
!
(
guest
->
arch
=
strdup
(
host
->
arch
))
||
(
cpu
->
vendor_id
&&
!
(
guest
->
vendor_id
=
strdup
(
cpu
->
vendor_id
))))
goto
no_memory
;
guest
->
arch
=
host
->
arch
;
if
(
cpu
->
match
==
VIR_CPU_MATCH_MINIMUM
)
preferred
=
host
->
model
;
else
...
...
@@ -8204,13 +8204,13 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
union
cpuData
*
cpuData
=
NULL
;
int
ret
;
ret
=
cpuEncode
(
"x86_64"
,
cpu
,
NULL
,
&
cpuData
,
ret
=
cpuEncode
(
VIR_ARCH_X86_64
,
cpu
,
NULL
,
&
cpuData
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
<
0
)
goto
error
;
is_32bit
=
(
cpuHasFeature
(
"x86_64"
,
cpuData
,
"lm"
)
!=
1
);
cpuDataFree
(
"x86_64"
,
cpuData
);
is_32bit
=
(
cpuHasFeature
(
VIR_ARCH_X86_64
,
cpuData
,
"lm"
)
!=
1
);
cpuDataFree
(
VIR_ARCH_X86_64
,
cpuData
);
}
else
if
(
model
)
{
is_32bit
=
STREQ
(
model
,
"qemu32"
);
}
...
...
src/vmware/vmware_conf.c
浏览文件 @
1846b80b
...
...
@@ -63,7 +63,6 @@ vmwareCapsInit(void)
virCapsGuestPtr
guest
=
NULL
;
virCPUDefPtr
cpu
=
NULL
;
union
cpuData
*
data
=
NULL
;
const
char
*
hostarch
=
NULL
;
if
((
caps
=
virCapabilitiesNew
(
virArchFromHost
(),
0
,
0
))
==
NULL
)
...
...
@@ -91,8 +90,7 @@ vmwareCapsInit(void)
goto
error
;
}
hostarch
=
virArchToString
(
caps
->
host
.
arch
);
if
(
!
(
cpu
->
arch
=
strdup
(
hostarch
)))
{
if
(
!
(
cpu
->
arch
=
caps
->
host
.
arch
))
{
virReportOOMError
();
goto
error
;
}
...
...
@@ -109,9 +107,9 @@ vmwareCapsInit(void)
* - Host CPU is x86_64 with virtualization extensions
*/
if
(
caps
->
host
.
arch
==
VIR_ARCH_X86_64
||
(
cpuHasFeature
(
host
arch
,
data
,
"lm"
)
&&
(
cpuHasFeature
(
host
arch
,
data
,
"vmx"
)
||
cpuHasFeature
(
host
arch
,
data
,
"svm"
))))
{
(
cpuHasFeature
(
caps
->
host
.
arch
,
data
,
"lm"
)
&&
(
cpuHasFeature
(
caps
->
host
.
arch
,
data
,
"vmx"
)
||
cpuHasFeature
(
caps
->
host
.
arch
,
data
,
"svm"
))))
{
if
((
guest
=
virCapabilitiesAddGuest
(
caps
,
"hvm"
,
...
...
@@ -129,7 +127,7 @@ vmwareCapsInit(void)
cleanup:
virCPUDefFree
(
cpu
);
cpuDataFree
(
host
arch
,
data
);
cpuDataFree
(
caps
->
host
.
arch
,
data
);
return
caps
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录