• Apollon Oikonomopoulos's avatar
    KVM: use running HVPs to calc blockdev options · 918baead
    Apollon Oikonomopoulos authored
    Commit 0fe22ad2
    
     moved the call to _GenerateKVMBlockDevicesOptions() from
    _GenerateKVMRuntime() to _ExecuteKvmRuntime. However, while in
    _GenerateKVMRuntime() there is only one set of HVPs, those of the
    instance's configuration, in _ExecuteKVMRuntime there are two sets of
    HVPs:
    
      - The instance's configured HVPs
      - The HVPs the instance used when it was started
    
    Currently, _GenerateKVMBlockDevicesOptions() uses the first set of HVPs
    only, meaning that it will always read the configured HVPs. Since
    _ExecuteKVMRuntime() is also called at migration time, it should use the
    instance's running HVPs, otherwise migration while fail.
    
    The following scenario will lead to a crash on migration:
    
     1. Start the instance (assuming 'paravirtual' disk_type)
     2. gnt-instance modify -H disk_type=scsi <instance_name>
     3. gnt-instance migrate <instance_name>
    
    Step 3 will start the instance on the remote node with all disks
    configured as 'scsi' and qemu will crash post-migration.
    
    We fix this by making sure _GenerateKVMBlockDevicesOptions gets the
    running HVPs as well.
    Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
    Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
    Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
    918baead
hv_kvm.py 99.2 KB