vim-cmd …
命令不直接支持此操作,但您可以通過編輯與該VM關聯的.vmsd文件來執行此任務。舉例來說,在服務器上:
# ls -1 /vmfs/volumes/Datastore/Debian7Generic/*[x,d]
/vmfs/volumes/Datastore/Debian7Generic/Debian7Generic.vmsd
/vmfs/volumes/Datastore/Debian7Generic/Debian7Generic.vmx
的的.vmx文件是主要結構; .vmsd文件描述了快照。後者有類似的內容:
.encoding = "UTF-8"
snapshot.lastUID = "19"
snapshot.current = "12"
snapshot0.uid = "1"
snapshot0.filename = "Debian7Generic-Snapshot1.vmsn"
snapshot0.displayName = "Fresh Install"
snapshot0.type = "1"
snapshot0.createTimeHigh = "331196"
snapshot0.createTimeLow = "1387465219"
snapshot0.numDisks = "1"
snapshot0.disk0.fileName = "Debian7Generic.vmdk"
snapshot0.disk0.node = "scsi0:0"
snapshot1.uid = "7"
snapshot1.filename = "Debian7Generic-Snapshot7.vmsn"
snapshot1.parent = "1"
snapshot1.displayName = "Fresh A"
snapshot1.type = "1"
snapshot1.createTimeHigh = "331234"
snapshot1.createTimeLow = "1435772305"
snapshot1.numDisks = "1"
snapshot1.disk0.fileName = "Debian7Generic-000001.vmdk"
snapshot1.disk0.node = "scsi0:0"
…
這不是一個美麗的方式來做到這一點,但你可以通過使用文本編輯器編輯該文件使用的sed重命名快照,或一個更自動化的方法。例如,你可以這樣做:
# sed -i -e 's|snapshot0.displayName = .*|snapshot0.displayName = "A different name"|' Debian7Generic.vmsd
.encoding = "UTF-8"
snapshot.lastUID = "19"
snapshot.current = "12"
snapshot0.uid = "1"
snapshot0.filename = "Debian7Generic-Snapshot1.vmsn"
snapshot0.displayName = "A different name"
snapshot0.type = "1"
snapshot0.createTimeHigh = "331196"
snapshot0.createTimeLow = "1387465219"
snapshot0.numDisks = "1"
snapshot0.disk0.fileName = "Debian7Generic.vmdk"
snapshot0.disk0.node = "scsi0:0"
snapshot1.uid = "7"
snapshot1.filename = "Debian7Generic-Snapshot7.vmsn"
…