Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to handle pool names that have characters in them #5

Open
TadiosAbebe opened this issue May 21, 2024 · 0 comments
Open

Unable to handle pool names that have characters in them #5

TadiosAbebe opened this issue May 21, 2024 · 0 comments

Comments

@TadiosAbebe
Copy link

First, thank you for this awesome piece of script; it is well written and can be understood easily. That being said, for me, I had to make some tweaks for it to work in my environment, and perhaps it might be helpful to implement it in your code if it helps someone else. Without any tweaks, when I ran the script, I got the following error:

ACTION: Onlinemirror
Start mirror 2024-05-20 17:48:07
Local Ceph Version: 17.2.7, Remote Ceph Version: 17.2.7
VM 101 - Starting mirror for dummy02
VM 101 - Checking for VM 101 on destination cluster pve01ceph01 /etc/pve/nodes/*/qemu-server
VM 101 - Transmitting Config for VM 101 to destination pve01ceph01 VMID 101
VM 101 - locked 101 [rc:0] on source
VM 101 - locked 101 [rc:0] on destination
VM 101 - Creating snapshot default_ssd/vm-101-disk-0@mirror-20240520174807
ERROR: VM 101 - QEMU-Guest could not fsunfreeze on guest.
VM 101 - unlocked source VM 101 [rc:0]
specified image /vm-101-disk-0 is not found.
rbd: du failed: (2) No such file or directory
pv: -s: integer argument expected
rbd: error opening image /vm-101-disk-0: (2) No such file or directory
VM 101 - created snapshot on 101 [rc:0]
VM 101 - Disk Summary: Took 1 Seconds to transfer 0 Bytes in a full run
VM 101 - Unlocking destination VM 101
Finnished mirror 2024-05-20 17:49:07
Job Summary: Bytes transferred 0 Bytes for 1 Disks on 1 VMs in 00 hours 01 minutes 00 seconds
VM Freeze OK/failed.......: 0/0
RBD Snapshot OK/failed....: 1/0
RBD export-full OK/failed.: 1/0
RBD export-diff OK/failed.: 0/0
Full xmitted..............: 0 Bytes
Differential Bytes .......: 0 Bytes

The above is happening because i have an underscore(_) in my pool name(default_ssd) and the regex pattern on the following line

declare -r recephimg='([a-zA-Z0-9]+)\:(.*)'
was'nt handling the pool name properly(i suppose). so i had to modify that line to

declare -r recephimg='([a-zA-Z0-9._-]+)\:(.*)'

and on a similar note i also had to modify the following line

cat "$oldconfig" | sed -r -e "s/^(efidisk|virtio|ide|scsi|sata|mp)([0-9]+):\s([a-zA-Z0-9]+):(.*)-([0-9]+)-disk-([0-9]+).*,(.*)$/\1\2: $newpool:\4-$newvmid-disk-\6-\3,\7/g" | $sedcmd | sed -e '/^$/,$d' | sed -e '/ide[0-9]:.*-cloudinit,media=cdrom.*/d' | grep -v "^parent:\s.*$" | ssh "$dst" "cat - >$newconfig"
as such

cat "$oldconfig" | sed -r -e "s/^(efidisk|virtio|ide|scsi|sata|mp)([0-9]+):\s([a-zA-Z0-9._-]+):(.*)-([0-9]+)-disk-([0-9]+).*,(.*)$/\1\2: $newpool:\4-$newvmid-disk-\6,\7/g" | $sedcmd | sed -e '/^$/,$d' | sed -e '/ide[0-9]:.*-cloudinit,media=cdrom.*/d' | grep -v "^parent:\s.*$" | ssh "$dst" "cat - >$newconfig"

and Again thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant