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

Assertion error after disk discovery #44

Closed
captainfresh opened this issue May 22, 2022 · 4 comments
Closed

Assertion error after disk discovery #44

captainfresh opened this issue May 22, 2022 · 4 comments

Comments

@captainfresh
Copy link

captainfresh commented May 22, 2022

Im trying to run a test migration before committing to this solution but unable to get it to work - please see command and debug below.

root@ansible-ct:~/proxmove-main# proxmove cl-freshnet Freshnet nuc1 local-lvm pve-mail --no-verify-ssl --debug
2022-05-22 07:27:04,771: DEBUG: Parsing config file: ~/.proxmoverc
2022-05-22 07:27:04,772: DEBUG: (api) Connecting to dell-pve.freshnet.local
2022-05-22 07:27:05,139: DEBUG: (api) Connecting to nuc1.freshnet.local
2022-05-22 07:27:05,210: DEBUG: (api) 'Freshnet' nodes: [{'level': '', 'node': 'nuc1', 'disk': 4708163584, 'id': 'node/nuc1', 'maxdisk': 100861726720, 'ssl_fingerprint': xxxxxxxx, 'mem': 2295193600, 'uptime': 7378, 'type': 'node', 'maxcpu': 8, 'maxmem': 67322433536, 'cpu': 0.00581238172479048, 'status': 'online'}, {'uptime': 7238, 'type': 'node', 'maxcpu': 8, 'ssl_fingerprint': xxxxxxxx, 'mem': 2077593600, 'status': 'online', 'cpu': 0.00619684082624544, 'maxmem': 67322548224, 'level': '', 'id': 'node/nuc3', 'disk': 3895869440, 'node': 'nuc3', 'maxdisk': 62297829376}, {'maxdisk': 62297829376, 'id': 'node/nuc2', 'node': 'nuc2', 'disk': 3896066048, 'level': '', 'status': 'online', 'cpu': 0.00721536015653663, 'maxmem': 67322552320, 'maxcpu': 8, 'uptime': 7327, 'type': 'node', 'mem': 2116997120, 'ssl_fingerprint': 'xxxxxxxxx'}]
2022-05-22 07:27:05,210: DEBUG: Sanity checks and preparation
2022-05-22 07:27:05,210: DEBUG: Checking VMs existence on source and destination
2022-05-22 07:27:05,232: DEBUG: Checking for problematic config in 1 VMs to move
2022-05-22 07:27:05,238: DEBUG: (exec) ssh [email protected] /bin/true
[email protected]'s password:
2022-05-22 07:27:27,138: DEBUG: (exec) ssh [email protected] ls -l /dev/pve/vm-103-disk-0
[email protected]'s password:
Traceback (most recent call last):
  File "/usr/local/bin/proxmove", line 2374, in <module>
    main()
  File "/usr/local/bin/proxmove", line 2364, in main
    vmmover.prepare()
  File "/usr/local/bin/proxmove", line 1866, in prepare
    self.prepare_vm_config()
  File "/usr/local/bin/proxmove", line 1949, in prepare_vm_config
    self.prepare_vm_config_volumes(vm)
  File "/usr/local/bin/proxmove", line 1958, in prepare_vm_config_volumes
    elif volume.get_size('guest') is None:
  File "/usr/local/bin/proxmove", line 1688, in get_size
    assert size == size_property, (size, size_property)
AssertionError: (None, 8589934592)

~/.proxmoverc

[pve:cl-freshnet]
api=https://root@pam:[email protected]:8006

  [storage:cl-freshnet:local-lvm@dell-pve] ; local disk on node1 only
  [email protected]
  path=/dev/pve

; Example cluster named "the-new-cluster" with 2 storage devices; both
; storage devices exist on the respective nodes only.
[pve:Freshnet]
api=https://root@pam:[email protected]:8006

  [storage:Freshnet:local-lvm@nuc1]
  [email protected]
  path=/dev/pve

From the source the command
ssh [email protected] ls -l /dev/pve/vm-103-disk-0

produces...

lrwxrwxrwx 1 root root 8 May 14 17:37 /dev/pve/vm-103-disk-0 -> ../dm-16

Any help would be appreciated - thanks :)

@wdoekes
Copy link
Member

wdoekes commented May 24, 2022

Apparently you're ending up here:

proxmove/proxmove

Lines 913 to 927 in 6935ecf

def get_volume_size(self, image_location):
"""
Read header bytes from qcow/qcow2 image to determine volume size.
(The size observed by the VM guest.)
"""
if image_location.endswith('.raw'):
# Raw image? Then its size is equal to the file size.
return self.get_physical_size(image_location)
elif image_location.endswith(('.qcow', '.qcow2')):
# Extract the filesystem size from the qcow/qcow2 image below.
pass
else:
# No support yet for other formats.
return None

And then here:

proxmove/proxmove

Lines 895 to 909 in 6935ecf

if image_location not in self._get_physical_size:
path = os.path.join(self.path, image_location)
# Use ls -l instead of stat because stat %s/%z is not
# standardized across BSD/GNU.
try:
data = self.ssh_command(
['ls', '-l', path], hide_stderr=True)
except subprocess.CalledProcessError:
log.warning(
'Could not get image size from plain storage {!r}'.format(
path))
exact_size = None
else:
exact_size = int(data.split()[4].decode('ascii', 'replace'))
self._get_physical_size[image_location] = exact_size

Which should be:

2022-05-22 07:27:27,138: DEBUG: (exec) ssh [email protected] ls -l /dev/pve/vm-103-disk-0

Which results in:

lrwxrwxrwx 1 root root 8 May 14 17:37 /dev/pve/vm-103-disk-0 -> ../dm-16

Which gets split and should become 8:

>>> data = b'lrwxrwxrwx 1 root root 8 May 14 17:37 /dev/pve/vm-103-disk-0 -> ../dm-16'
>>> int(data.split()[4].decode('ascii', 'replace'))
8

Which is useless, because we don't want the size of the symlink... but it shouldn't be None 🤔

For your dm-16, we'd probably need something like this instead of ls -l:

$ lsblk -bdno SIZE /dev/disk/by-id/dm-name-nvme0n1p3_crypt
511058116608

But, this should likely not be done by the ProxmoxStoragePlain class at all...

What does your vm config look like, and then specifically the configuration for the vm-103-disk-0 disk?

I cannot explain why:

  • it would do an ls -l in the first place, as image_location.endswith('raw') should be False;
  • so I'd expect a return None immediately (No support yet for other formats.);
  • and when the ls -l is done, I would've expected 8 and not None; or a warning, which I don't see.

Did you change some code by any chance?

@captainfresh
Copy link
Author

captainfresh commented May 25, 2022 via email

@wdoekes
Copy link
Member

wdoekes commented May 25, 2022

Well. Then it looks like you're either in the need for this:
#33
or this:
#27
which are both marked as Wontfix, as I use neither.

I'm sorry. I don't have any quick fixes for you.

@captainfresh
Copy link
Author

captainfresh commented May 25, 2022 via email

@wdoekes wdoekes closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2022
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

2 participants