Category: virtualization

虚拟化技术

  • vmware 无法删除快照

    vmware无法删除快照.

    使用vcenter 6.0 测试,关机情况下备份,出现:创建快照层次过深.
    尝试删除快照出现错误:

    A general system error occurred: vim.fault.GenericVmConfigFault

    解决方法

    1. 打开存储进入虚拟机所在目录.
    2. 创建临时目录,备份快照文件.
      mkdir ./tmp/
      mv *.vmsn ./tmp/
      mv *.vmsd ./tmp/
    3. 界面上点击删除全部快照.如果失败,重试
    4. 如果步骤3成功.进行磁盘整合.

    (more…)

  • 厚置备与精简置备

    厚置备延迟置零

    以默认的厚格式创建虚拟磁盘。创建虚拟磁盘时分配虚拟磁盘所需的空间。创建过程中不会清除物理设备上保留的数据,但以后首次从虚拟机写入时则会按需置零。

    厚置备置零

    一种厚虚拟磁盘类型,可支持群集功能,如 Fault Tolerance。在创建时为虚拟磁盘分配所需的空间。与厚置备延迟置零格式相反,创建虚拟磁盘时,会将物理设备上保留的数据置零。创建这种格式的磁盘所需的时间可能会比创建其他类型的磁盘长。

    精简置备

    使用此格式可节省存储空间。对于精简磁盘,可以根据输入的磁盘大小值置备磁盘所需的任意数据存储空间。但是,精简磁盘开始时很小,只使用与初始操作所需的大小完全相同的存储空间。

    关于虚拟磁盘置备策略

  • OpenStack使用ceph存储时,glance 上传镜像输出

    [root@node2 ~(keystone_admin)]# glance image-create --name bc_win2012 --disk-format qcow2 --container-format ovf --f /meta/iso/bc_win2012.qcow2 
    +------------------+----------------------------------------------------------------------------------+
    | Property         | Value                                                                            |
    +------------------+----------------------------------------------------------------------------------+
    | checksum         | 13422230096bef83fade0418d64e9890                                                 |
    | container_format | ovf                                                                              |
    | created_at       | 2020-02-26T12:03:58Z                                                             |
    | direct_url       | rbd://d484bdf2-c9ba-4e1f-a69f-86586e0dc8ad/images/b9168a42-244f-4642-b08f-       |
    |                  | 3e6fdc05645e/snap                                                                |
    | disk_format      | qcow2                                                                            |
    | id               | b9168a42-244f-4642-b08f-3e6fdc05645e                                             |
    | min_disk         | 0                                                                                |
    | min_ram          | 0                                                                                |
    | name             | bc_win2012                                                                       |
    | os_hash_algo     | sha512                                                                           |
    | os_hash_value    | 30025e558627c60e7cd88aab01f193c2ca38fb73454c4fcd8c5bfc9b38cd23e963fa33aac3089f55 |
    |                  | 8de746524a290d3c9e2dd87a1e919c60928fa51b9646e18d                                 |
    | os_hidden        | False                                                                            |
    | owner            | 504fb6fa98c443899288ec9e35b487a8                                                 |
    | protected        | False                                                                            |
    | size             | 8959033344                                                                       |
    | status           | active                                                                           |
    | tags             | []                                                                               |
    | updated_at       | 2020-02-26T12:10:15Z                                                             |
    | virtual_size     | Not available                                                                    |
    | visibility       | shared                                                                           |
    +------------------+----------------------------------------------------------------------------------+
    
    
  • virsh 虚拟机xml信息,留个记录

    virsh dumpxml domain
    
    虚拟机dumpxml例,可以参考格式

    xml
    <domain type='kvm' id='12'>
    <name>ceph-node3</name>
    <uuid>4f52f828-f538-45cb-9f02-eeb555e96020</uuid>
    <memory unit='KiB'>8388608</memory>
    <currentMemory unit='KiB'>8388608</currentMemory>
    <vcpu placement='static'>2</vcpu>
    <resource>
    <partition>/machine</partition>
    </resource>
    <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>
    </os>
    <features>
    <acpi/>
    <apic/>
    </features>
    <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Haswell-IBRS</model>
    <feature policy='disable' name='hle'/>
    <feature policy='disable' name='rtm'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='xsaveopt'/>
    </cpu>
    <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    </clock>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>destroy</on_crash>
    <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
    </pm>
    <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2'/>
    <source file='/ceph2/images/ceph_node3.qcow2'/>
    <backingStore/>
    <target dev='vda' bus='virtio'/>
    <alias name='virtio-disk0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2' cache='none'/>
    <source file='/ceph2/images/ceph_node3_storage.qcow2'/>
    <backingStore/>
    <target dev='vdb' bus='virtio'/>
    <alias name='virtio-disk1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
    <driver name='qemu'/>
    <target dev='hda' bus='ide'/>
    <readonly/>
    <alias name='ide0-0-0'/>
    <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
    <alias name='usb'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
    <alias name='usb'/>
    <master startport='0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
    <alias name='usb'/>
    <master startport='2'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
    <alias name='usb'/>
    <master startport='4'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
    <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
    <alias name='ide'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
    <alias name='virtio-serial0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <interface type='bridge'>
    <mac address='52:54:00:94:b4:fe'/>
    <source bridge='br0'/>
    <target dev='vnet2'/>
    <model type='virtio'/>
    <alias name='net0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
    <source path='/dev/pts/5'/>
    <target type='isa-serial' port='0'>
    <model name='isa-serial'/>
    </target>
    <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
    <source path='/dev/pts/5'/>
    <target type='serial' port='0'/>
    <alias name='serial0'/>
    </console>
    <channel type='unix'>
    <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-12-ceph-node3/org.qemu.guest_agent.0'/>
    <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
    <alias name='channel0'/>
    <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
    <alias name='input0'/>
    <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
    <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
    <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5902' autoport='yes' listen='0.0.0.0'>
    <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
    <model type='cirrus' vram='16384' heads='1' primary='yes'/>
    <alias name='video0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
    <alias name='balloon0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
    <rng model='virtio'>
    <backend model='random'>/dev/urandom</backend>
    <alias name='rng0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </rng>
    </devices>
    <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c21,c647</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c21,c647</imagelabel>
    </seclabel>
    <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+107:+107</label>
    <imagelabel>+107:+107</imagelabel>
    </seclabel>
    </domain>

  • esxi 查询磁盘情况

    查询主机vsan 磁盘

    [root@esxi81:~] esxcli vsan storage list 
    t10.ATA_____ST2000DM0062D2DM164__________________________________W4Z4FCNV
       Device: t10.ATA_____ST2000DM0062D2DM164__________________________________W4Z4FCNV
       Display Name: t10.ATA_____ST2000DM0062D2DM164__________________________________W4Z4FCNV
       Is SSD: false
       VSAN UUID: 525ea6a3-4652-a155-776e-8f4d58b76918
       VSAN Disk Group UUID: 52713c13-17df-3858-c503-fef6bc2db464
       VSAN Disk Group Name: t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Used by this host: true
       In CMMDS: true
       Checksum: 4109026058915579745
       Checksum OK: true
       Emulated DIX/DIF Enabled: false
    
    t10.ATA_____ST2000DM0062D2DM164__________________________________Z4ZA9DT7
       Device: t10.ATA_____ST2000DM0062D2DM164__________________________________Z4ZA9DT7
       Display Name: t10.ATA_____ST2000DM0062D2DM164__________________________________Z4ZA9DT7
       Is SSD: false
       VSAN UUID: 5265a8bb-d04d-9344-9dcf-83baa2c0fb23
       VSAN Disk Group UUID: 52713c13-17df-3858-c503-fef6bc2db464
       VSAN Disk Group Name: t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Used by this host: true
       In CMMDS: true
       Checksum: 15102757417397371480
       Checksum OK: true
       Emulated DIX/DIF Enabled: false
    
    t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Device: t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Display Name: t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Is SSD: true
       VSAN UUID: 52713c13-17df-3858-c503-fef6bc2db464
       VSAN Disk Group UUID: 52713c13-17df-3858-c503-fef6bc2db464
       VSAN Disk Group Name: t10.ATA_____INTEL_SSDSC2KW480H6_____________________CVLT61630BLC480EGN__
       Used by this host: true
       In CMMDS: true
       Checksum: 6410776831392425856
       Checksum OK: true
       Emulated DIX/DIF Enabled: false
    

    (more…)