Skip to contentSkip to conversation

no digit beginning name?

DISCUSSION Tim Freeman 1 participant 1 message Jul 3, 2005

lore
Share & tools
lore
#0 lore raw

In XendDomainInfo.py --> check_name() there is a restriction in place that a domain can not begin with a digit. If I comment out this check:

if name[0] in string.digits:
raise VmError('invalid vm name')

... I can start and stop a domain whose name starts with a digit just fine. Is there a reason this restriction is in place?

And actually, the way the logic goes here:

if name[0] in string.digits:
raise VmError('invalid vm name')
for c in name:
if c in string.digits: continue if c in '_-.:/+': continue
if c in string.ascii_letters: continue raise VmError('invalid vm name')

... you could have "+-5ac" as a name but not "5ac". (the intent is maybe "if name[0] not in string.ascii_letters"?).

Anyhow, I'm using UUIDs, and currently (to avoid needing to patch Xend) just stripping any incoming UUIDs of digits in the beginning, but this is a little unsavory, so I was curious if it was possible to change it upstream if there is no reason for the check?

Is there some use of the domain name I am missing that bars digits?

Thanks,
Tim

Another thing:

"+-5ac" works but actually when I tried "+-/5ac" (which passes the validity check too), xm create fails with "Error: invalid domain:+-" and xm list reports no dom0 but just this:

Name Id Mem(MB) CPU State Time(s) Console
Error: invalid domain:+-

Rebooting xend has no effect, needed to reboot the node.