NAUbackup / VmBackup

XenServer simple backup script
228 stars 62 forks source link

vdi-export fails #68

Closed maliskovik closed 6 years ago

maliskovik commented 6 years ago

Description: vdi-export fails with the following error:

2018-03-14-(07:37:15) - ************ vdi-export= ***************
2018-03-14-(07:37:15) - *** vdi-export begin <VM_NAME>
2018-03-14-(07:37:15) - vdi-export - vm_name: <VM_NAME> max_backups: 2
2018-03-14-(07:37:15) - new backup_dir: <VM_BACKUP_DIR>
2018-03-14-(07:37:15) - Exporting VM metadata XML info
2018-03-14-(07:37:15) - *** vm-export metadata end
2018-03-14-(07:37:15) - Writing disk info
2018-03-14-(07:37:15) - vbd: OpaqueRef:d8fec991-ff35-7c5b-0b56-1f3c355eca9a
2018-03-14-(07:37:15) - vbd: OpaqueRef:0071322e-0bd3-49d9-15fe-a740ea2d32ce
2018-03-14-(07:37:15) - disk: <VM DISK> - begin
2018-03-14-(07:37:15) - vbd: OpaqueRef:8ce3f9e0-517b-8408-9699-fd2f17c8b620
2018-03-14-(07:37:15) - disk: <VM-DISK> - begin
2018-03-14-(07:37:15) - Writing VIF info
2018-03-14-(07:37:15) - Writing VIF: 0
global name 'xvda_uuid' is not defined
2018-03-14-(07:37:15) - ***ERROR EXCEPTION - <type 'exceptions.NameError'>
2018-03-14-(07:37:15) - ***ERROR NOTE: see VmBackup output for details
Traceback (most recent call last):
  File "VmBackup.py", line 1491, in <module>
    main(session)
  File "VmBackup.py", line 177, in main
    if xvda_uuid == '':
NameError: global name 'xvda_uuid' is not defined

note: <VM*> tags are name replacements.

Looking at the script, it seems these variables were deprecated and commented out. Should these checks on lines #177 and #184 still be performed or is there another way to handle this error? I see that deprecation is due to errors with strange characters. Can this be handled another way?

If there is no plan for this I can take a look at it, I just need to get the general idea about the deprecation.

NAUbackup commented 6 years ago

Hi, Lovrenca: I will take a look at this. There are no provisions to deal with VM names containing special characters and that may be the issue, but I'd like to take a look first. Because the directories and files created to hold the backups are based on the VM names, they need to be pretty standardized, which may require restricting choices, in particular involving non-English alphabets. Let me get back to you on this after I have a chance to take a first look. --Tobias

NAUbackup commented 6 years ago

Are you running v3.22? (v 3.22 2017/11/11 Add full VM metadata dump to XML file to replace VM metadata backup that could fail if special characters encountered). I believe those globals got added back in to cover VDI exports.

--Tobias

maliskovik commented 6 years ago

Yes, it's v3.22.

NAUbackup commented 6 years ago

Thanks, I'll need to investigate further then. Can you tell me the name of the VM and the name_label of the VDI in question?

maliskovik commented 6 years ago

The VM name is is "zimbra.cosylab.com" name label is "zimbra - ubuntu - root disk"

NAUbackup commented 6 years ago

Thanks. I can see where such names could lead to issues. I will take a closer look given this additional information. Thank you again.

maliskovik commented 6 years ago

Thanky you :)

NAUbackup commented 6 years ago

ouch --- just noticed I ran this with an older backup script. Will need to redo the tests with the 3.22 version. Sorry! Stay tuned ...

I was able to reproduce your error. Will investigate further.

--Tobias

NAUbackup commented 6 years ago

Fixed and verified. Just need to uncomment the four lines as follow to fix this. Sorry, these got inadvertently commented out somehow during the latest update. Will incorporate into a fix or new release soon. Thank you for finding this. --Tobias

560,561c560,561
<     global xvda_uuid
<     global xvda_name_label
---
> #    global xvda_uuid
> #    global xvda_name_label
563,564c563,564
<     xvda_uuid = ''
<     xvda_name_label = ''
---
> #    xvda_uuid = ''
> #    xvda_name_label = ''
maliskovik commented 6 years ago

Glad to hear it wasn't a complicated issue, I fixed it the same way for the mean time.

NAUbackup commented 6 years ago

I've updated the repository meanwhile and added one other quick addition (a UNICODE encoding snippet). Regards, --Tobias