2014-10-31 90 views
1

如何使用命令行更改VMware快照的顯示名稱或將一個快照移動到另一個快照? vim-cmd實用程序在vmsvc/下有以下子命令,但它們似乎無法做到這一點。是否可以使用vim-cmd更改vmware快照的名稱

snapshot.create 
snapshot.dumpoption 
snapshot.get 
snapshot.remove 
snapshot.removeall 
snapshot.revert 
snapshot.setoption 

使用GUI,我正在編輯名稱。我可以在命令行上使用哪些命令或命令組合來實現此目的?

回答

1

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" 
… 
相關問題