存储与备份

解决VMWARE:在数据存储区的当前状态下不允许执行该操作

· 1376 字 · 约 3 分钟

问题现象

在客户现场,我们在他们的 VMware vSphere 环境中安装了 NetApp AFF A220。一个非常不错的全闪存阵列,具有大量的功能和性能。为了制作可靠的虚拟机快照,我们安装了虚拟存储控制台和 NetApp Data Broker 虚拟设备。但是在安装和配置之后,出现了一个奇怪的问题。 在某些数据存储上创建虚拟机后,任务失败并显示错误"the operation is not allowed in the current state of the datastore"。在调查过程中,我注意到虽然几乎 50%的可用空间仍然可用,但有关的数据存储已超量配置。显然,所有出色的 NetApp 存储效率功能(如重复数据删除,压缩和压缩)对于 VMware 来说都是至关重要的。 当我在寻找解决方案时,我偶然发现了一篇VMware KB 文章,该文章建议禁用 vCenter 中的 NetApp 组件。显然,禁用 NetApp 虚拟存储控制台和 SnapCenter 插件并不能解决问题。解决方案也不是完全删除它们。

排查定位

经过进一步调查,我发现数据存储区获得了一个额外的标志,称为thin_prov_space_flag。以下是进行自我检查的说明。

解决办法

首先启用对您的 vCenter Appliance 的 SSH 访问(如果尚未启用): 浏览至 https:\ <您的vcenter ip或主机名>:5480,使用登录 root 并启用 SSH 接下来,使用 SSH 客户端(例如 Putty)与设备建立 SSH 连接,然后再次使用登录 root。运行 shell 命令以启用 bash-shell。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
login as: root
VMware vCenter Server Appliance 6.5.0.21000
Type: vCenter Server with an embedded Platform Services Controller
Using keyboard-interactive authentication.
Password:
Last login: Tue Jan 21 xx:xx:xx 2020 from x.x.x.x
Connected to service
    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"
Command> shell
Shell access is granted to root
root@<vcenter server> [ ~ ]#

在停止服务之前,您可能需要检查这是否也是您的问题。 找出您的数据库密码:cat /etc/vmware-vpx/vcdb.properties并连接到数据库:/opt/vmware/vpostgres/current/bin/psql -d VCDB -U vc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
root@<vcenter server> [ ~ ]# cat /etc/vmware-vpx/vcdb.properties
driver = org.postgresql.Driver
dbtype = PostgreSQL
url = jdbc:postgresql://localhost:5432/VCDB
username = vc
password = <your db password>
password.encrypted = false
root@<vcenter server>[ ~ ]# /opt/vmware/vpostgres/current/bin/psql -d VCDB -U vc
Password for user vc:
psql.bin (9.4.15 (VMware Postgres 9.4.15.0-7748409 release))
Type "help" for help.
VCDB=>

运行命令以查看thin_prov_space_flag数据存储的:(select id,thin_prov_space_flag from vpx_datastore; 不要忘了最后的分号)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
VCDB=> select id,thin_prov_space_flag from vpx_datastore;
  id  | thin_prov_space_flag
------+----------------------
  151 |                    0
  163 |                    0
  157 |                    0
  143 |                    0
  169 |                    0
 3159 |                    1
 3160 |                    1
   15 |                    0
 3161 |                    1
 3134 |                    0
(10 rows)

VCDB=>

thin_prov_space_flag问题数据存储区下带有“ 1”的数据存储区。“ 1”阻止创建虚拟机。现在输入/q以退出 Postgress 提示符并返回到 bash shell。之后,停止 Vmware 服务(service-control --stop vmware-vpxd)

1
2
3
4
5
6
VCDB=> \q
root@<vcenter server> [ ~ ]# service-control --stop vmware-vpxd
Perform stop operation. vmon_profile=None, svc_names=['vmware-vpxd'], include_coreossvcs=False, include_leafossvcs=False

Successfully stopped service vpxd
root@<vcenter server>[ ~ ]#

再次输入 PSQL 提示。连接后,将 tha 数据存储区的值从 1 更改为 0 :(update vpx_datastore set thin_prov_space_flag=0 where id=<datastore id>; 同样不要忘记分号),并在必要时重复。完成使用后 /q ,离开 Postgress 提示符并返回 bash shell。之后,启动 Vmware 服务(service-control --start vmware-vpxd)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
root@<vcenter server>[ ~ ]# /opt/vmware/vpostgres/current/bin/psql -d VCDB -U vc
Password for user vc:
psql.bin (9.4.15 (VMware Postgres 9.4.15.0-7748409 release))
Type "help" for help.
VCDB=> update vpx_datastore set thin_prov_space_flag=0 where id=3159;
UPDATE 1
VCDB=> \q
root@<vcenter server> [ ~ ]# service-control --start vmware-vpxd
Perform start operation. vmon_profile=None, svc_names=['vmware-vpxd'], include_coreossvcs=False, include_leafossvcs=False
xxxx-xx-xxTxx:16:50.306Z   Service vpxd state STOPPED
Successfully started service vpxd
root@<vcenter server> [ ~ ]#

验证结果

(可选)您可以在离开 Postgress 提示符之前检查该标志是否正确设置为零。 select id,thin_prov_space_flag from vpx_datastore;

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
VCDB=> select id,thin_prov_space_flag from vpx_datastore;
  id  | thin_prov_space_flag
------+----------------------
  151 |                    0
  163 |                    0
  157 |                    0
  143 |                    0
  169 |                    0
 3159 |                    0
 3160 |                    0
 3161 |                    0
   15 |                    0
 3134 |                    0
(10 rows)

VCDB=> \q
root@<vcenter server> [ ~ ]#

总结

现在可以再次创建虚拟机。因此,请回到您的 vCenter Server 并开始配置。