posts - 167,  comments - 30,  trackbacks - 0
          使用開源云工具OpenNebula3.8.1在KVM環境下虛擬機遷移失敗問題解決。
          1、虛擬機遷移失敗1日志:
          Fri Mar  8 17:57:18 2013 [LCM][I]: New VM state is SAVE_MIGRATE
          Fri Mar  8 17:57:30 2013 [VMM][I]: ExitCode: 0
          Fri Mar  8 17:57:30 2013 [VMM][I]: Successfully execute virtualization driver operation: save.
          Fri Mar  8 17:57:30 2013 [VMM][I]: ExitCode: 0
          Fri Mar  8 17:57:30 2013 [VMM][I]: Successfully execute network driver operation: clean.
          Fri Mar  8 17:58:14 2013 [LCM][I]: New VM state is PROLOG_MIGRATE
          Fri Mar  8 17:58:14 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/42/disk.0
          Fri Mar  8 17:58:14 2013 [TM][I]: ExitCode: 0
          Fri Mar  8 18:02:28 2013 [TM][I]: mv: Moving bcec162:/one_images_3.8.1/0/42 to node153:/one_images_3.8.1/0/42
          Fri Mar  8 18:02:28 2013 [TM][I]: ExitCode: 0
          Fri Mar  8 18:02:29 2013 [LCM][I]: New VM state is BOOT
          Fri Mar  8 18:02:30 2013 [VMM][I]: ExitCode: 0
          Fri Mar  8 18:02:30 2013 [VMM][I]: Successfully execute network driver operation: pre.
          Fri Mar  8 18:02:33 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/42/checkpoint node153 42 node153
          Fri Mar  8 18:02:33 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/42/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/42/checkpoint
          Fri Mar  8 18:02:33 2013 [VMM][I]: error: unable to set user and group to '0:0' on '/one_images_3.8.1/0/42/disk.1': No such file or directory
          Fri Mar  8 18:02:33 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/42/checkpoint
          Fri Mar  8 18:02:33 2013 [VMM][I]: ExitCode: 1
          Fri Mar  8 18:02:33 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.
          Fri Mar  8 18:02:33 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/42/checkpoint
          Fri Mar  8 18:02:34 2013 [DiM][I]: New VM state is FAILED
          Sat Mar  9 09:23:46 2013 [DiM][I]: New VM state is DONE.
          Sat Mar  9 09:23:46 2013 [TM][W]: Ignored: LOG I 42 ExitCode: 0
          Sat Mar  9 09:23:47 2013 [TM][W]: Ignored: LOG I 42 delete: Deleting /one_images_3.8.1/0/42
          Sat Mar  9 09:23:47 2013 [TM][W]: Ignored: LOG I 42 ExitCode: 0
          Sat Mar  9 09:23:47 2013 [TM][W]: Ignored: TRANSFER SUCCESS 42 -
          解決方法:
          在mv腳本中TAR拷貝命令前面增加$SUDO命令.
          $ONE_LOCATION/var/remotes/tm/ssh/mv
          #!/bin/bash
          # -------------------------------------------------------------------------- #
          # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org)             #
          #                                                                            #
          # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
          # not use this file except in compliance with the License. You may obtain    #
          # a copy of the License at                                                   #
          #                                                                            #
          # http://www.apache.org/licenses/LICENSE-2.0                                 #
          #                                                                            #
          # Unless required by applicable law or agreed to in writing, software        #
          # distributed under the License is distributed on an "AS IS" BASIS,          #
          # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
          # See the License for the specific language governing permissions and        #
          # limitations under the License.                                             #
          #--------------------------------------------------------------------------- #
          # MV <hostA:system_ds/disk.i|hostB:system_ds/disk.i> vmid dsid
          #    <hostA:system_ds/|hostB:system_ds/>
          #   - hostX is the target host to deploy the VM
          #   - system_ds is the path for the system datastore in the host
          #   - vmid is the id of the VM
          #   - dsid is the target datastore (0 is the system datastore)
          SRC=$1
          DST=$2
          VMID=$3
          DSID=$4
          if [ -z "${ONE_LOCATION}" ]; then
              TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
          else
              TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
          fi
          . $TMCOMMON
          #-------------------------------------------------------------------------------
          # Return if moving a disk, we will move them when moving the whole system_ds
          # directory for the VM
          #-------------------------------------------------------------------------------
          SRC=`fix_dir_slashes $SRC`
          DST=`fix_dir_slashes $DST`
          SRC_PATH=`arg_path $SRC`
          DST_PATH=`arg_path $DST`
          SRC_HOST=`arg_host $SRC`
          DST_HOST=`arg_host $DST`
          DST_DIR=`dirname $DST_PATH`
          SRC_DS_DIR=`dirname  $SRC_PATH`
          SRC_VM_DIR=`basename $SRC_PATH`
          if [ `is_disk $DST_PATH` -eq 1 ]; then
              log "-------------------------$DST_PATH"
          exit 0
          fi
          if [ "$SRC" == "$DST" ]; then
              exit 0
          fi
          ssh_make_path "$DST_HOST" "$DST_DIR"
          log "Moving $SRC to $DST"
          ssh_exec_and_log "$DST_HOST" "rm -rf '$DST_PATH'" \
              "Error removing target path to prevent overwrite errors"
          TAR_COPY="$SSH $SRC_HOST '$SUDO $TAR -C $SRC_DS_DIR -cf - $SRC_VM_DIR'"
          TAR_COPY="$TAR_COPY | $SSH $DST_HOST '$TAR -C $DST_DIR -xf -'"
          exec_and_log "eval $TAR_COPY" "Error copying disk directory to target host"
          exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"
          exit 0
          -------------------------------------------------------------------------------------------
          2、虛擬機遷移失敗2日志:
          Sat Mar  9 09:34:12 2013 [LCM][I]: New VM state is SAVE_MIGRATE
          Sat Mar  9 09:34:24 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 09:34:24 2013 [VMM][I]: Successfully execute virtualization driver operation: save.
          Sat Mar  9 09:34:24 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 09:34:24 2013 [VMM][I]: Successfully execute network driver operation: clean.
          Sat Mar  9 09:34:25 2013 [LCM][I]: New VM state is PROLOG_MIGRATE
          Sat Mar  9 09:34:25 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/43/disk.0
          Sat Mar  9 09:34:25 2013 [TM][I]: ExitCode: 0
          Sat Mar  9 09:36:38 2013 [TM][I]: mv: Moving node153:/one_images_3.8.1/0/43 to bcec162:/one_images_3.8.1/0/43
          Sat Mar  9 09:36:38 2013 [TM][I]: mv: -------------------target copyy
          Sat Mar  9 09:36:38 2013 [TM][I]: mv: ++++++++++++++++++++++end copy
          Sat Mar  9 09:36:38 2013 [TM][I]: ExitCode: 0
          Sat Mar  9 09:36:38 2013 [LCM][I]: New VM state is BOOT
          Sat Mar  9 09:36:38 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 09:36:38 2013 [VMM][I]: Successfully execute network driver operation: pre.
          Sat Mar  9 09:36:42 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/43/checkpoint bcec162 43 bcec162
          Sat Mar  9 09:36:42 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/43/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 09:36:42 2013 [VMM][I]: error: internal error process exited while connecting to monitor: Supported machines are:
          Sat Mar  9 09:36:42 2013 [VMM][I]: pc         RHEL 6.0.0 PC (alias of rhel6.0.0)
          Sat Mar  9 09:36:42 2013 [VMM][I]: rhel6.0.0  RHEL 6.0.0 PC (default)
          Sat Mar  9 09:36:42 2013 [VMM][I]: rhel5.5.0  RHEL 5.5.0 PC
          Sat Mar  9 09:36:42 2013 [VMM][I]: rhel5.4.4  RHEL 5.4.4 PC
          Sat Mar  9 09:36:42 2013 [VMM][I]: rhel5.4.0  RHEL 5.4.0 PC
          Sat Mar  9 09:36:42 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 09:36:42 2013 [VMM][I]: ExitCode: 1
          Sat Mar  9 09:36:42 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.
          Sat Mar  9 09:36:42 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 09:36:42 2013 [DiM][I]: New VM state is FAILED
          登陸到節點:
          [root@bcec162 43]# virsh restore checkpoint 
          錯誤:從 checkpoint 恢復域失敗
          錯誤:internal error process exited while connecting to monitor: Supported machines are:
          pc         RHEL 6.0.0 PC (alias of rhel6.0.0)
          rhel6.0.0  RHEL 6.0.0 PC (default)
          rhel5.5.0  RHEL 5.5.0 PC
          rhel5.4.4  RHEL 5.4.4 PC
          rhel5.4.0  RHEL 5.4.0 PC
          修改了bcec162節點的/etc/libvirt/qemu.conf文件:
          # The user ID for QEMU processes run by the system instance
          user = "root"
          # The group ID for QEMU processes run by the system instance
          group = "root"
          # Whether libvirt should dynamically change file ownership
          # to match the configured user/group above. Defaults to 1.
          # Set to 0 to disable file ownership changes.
          #dynamic_ownership = 0
          bcec162節點遷移到node153節點成功。
          [root@node153 43]# ll
          total 5075464
          -rw-r--r-- 1 root     root  287215779 Mar  8 11:11 checkpoint
          -rw-r--r-- 1 oneadmin kvm   283538737 Mar  9 09:34 checkpoint.1362712278
          -rw-r--r-- 1 oneadmin kvm         920 Mar  9 09:26 deployment.0
          -rw-r--r-- 1 root     root 4621008896 Mar  9 10:14 disk.0
          -rw-r----- 1 root     root     401408 Mar  9 09:26 disk.1
          lrwxrwxrwx 1 oneadmin kvm          29 Mar  9 10:09 disk.1.iso -> /one_images_3.8.1/0/43/disk.1
          --------------------------------------------------------------------------------------------------------
          3、僅修改node152節點的/etc/libvirt/qemu.conf文件:
          # The user ID for QEMU processes run by the system instance
          #user = "root"
          # The group ID for QEMU processes run by the system instance
          #group = "root"
          # Whether libvirt should dynamically change file ownership
          # to match the configured user/group above. Defaults to 1.
          # Set to 0 to disable file ownership changes.
          dynamic_ownership = 0
          從bcec162節點遷移到node152不成功,日志如下:
          Sat Mar  9 10:31:47 2013 [LCM][I]: New VM state is SAVE_MIGRATE
          Sat Mar  9 10:31:54 2013 [VMM][I]: save: Moving old checkpoint file /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 10:31:54 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 10:31:54 2013 [VMM][I]: Successfully execute virtualization driver operation: save.
          Sat Mar  9 10:31:54 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 10:31:54 2013 [VMM][I]: Successfully execute network driver operation: clean.
          Sat Mar  9 10:31:55 2013 [LCM][I]: New VM state is PROLOG_MIGRATE
          Sat Mar  9 10:31:55 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/43/disk.0
          Sat Mar  9 10:31:55 2013 [TM][I]: ExitCode: 0
          Sat Mar  9 10:35:02 2013 [TM][I]: mv: Moving bcec162:/one_images_3.8.1/0/43 to node152:/one_images_3.8.1/0/43
          Sat Mar  9 10:35:02 2013 [TM][I]: mv: -------------------target copyy
          Sat Mar  9 10:35:02 2013 [TM][I]: mv: ++++++++++++++++++++++end copy
          Sat Mar  9 10:35:02 2013 [TM][I]: ExitCode: 0
          Sat Mar  9 10:35:02 2013 [LCM][I]: New VM state is BOOT
          Sat Mar  9 10:35:03 2013 [VMM][I]: ExitCode: 0
          Sat Mar  9 10:35:03 2013 [VMM][I]: Successfully execute network driver operation: pre.
          Sat Mar  9 10:35:07 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/43/checkpoint node152 43 node152
          Sat Mar  9 10:35:07 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/43/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 10:35:07 2013 [VMM][I]: error: operation failed: failed to retrieve chardev info in qemu with 'info chardev'
          Sat Mar  9 10:35:07 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 10:35:07 2013 [VMM][I]: ExitCode: 1
          Sat Mar  9 10:35:07 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.
          Sat Mar  9 10:35:07 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/43/checkpoint
          Sat Mar  9 10:35:07 2013 [DiM][I]: New VM state is FAILED
          登陸到node152節點執行restore命令:
          [root@node152 43]# virsh restore checkpoint
          error: Failed to restore domain from checkpoint
          error: internal error process exited while connecting to monitor: qemu: could not open disk image /one_images_3.8.1/0/43/disk.0: Permission denied
          將/etc/libvirt/qemu.conf文件中注釋掉dynamic_ownership=0,開啟user=root和group=root. 
          如果開啟dynamic_ownership則恢復虛擬機也會報出上面的錯誤信息。
          在node152節點上恢復虛擬機:
          [root@node152 43]# virsh restore checkpoint
          Domain restored from checkpoint
          [root@node152 43]# virsh list
           Id Name                 State
          ----------------------------------
          117 one-43               running
          參考文章:
          https://wiki.archlinux.org/index.php/QEMU_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
          http://hi.baidu.com/juacm/item/f1fc3f98d8428ad07a7f01e2

          轉載請保持原鏈接:http://www.aygfsteel.com/ldwblog/archive/2013/03/08/396187.html
          posted on 2013-03-08 12:03 David1228 閱讀(764) 評論(0)  編輯  收藏 所屬分類: 云計算、虛擬化

          <2013年3月>
          242526272812
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(4)

          隨筆分類

          隨筆檔案

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          Java

          Linux知識相關

          Spring相關

          云計算/Linux/虛擬化技術/

          友情博客

          多線程并發編程

          開源技術

          持久層技術相關

          搜索

          •  

          積分與排名

          • 積分 - 359129
          • 排名 - 154

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 潮安县| 化隆| 榆树市| 贡嘎县| 信丰县| 安图县| 商洛市| 兴国县| 河源市| SHOW| 宁城县| 龙州县| 宁安市| 兴国县| 临邑县| 海南省| 勐海县| 台中县| 正阳县| 临清市| 山东省| 加查县| 思茅市| 疏勒县| 扶绥县| 松溪县| 阿克苏市| 贡觉县| 新蔡县| 铜陵市| 顺平县| 青河县| 广丰县| 葵青区| 惠东县| 沙雅县| 汾西县| 乐陵市| 乡宁县| 九台市| 松滋市|