DNA viruses like bacteriophages and herpes viruses have rigid capsids. The viral DNA is densely packed inside, and the internal pressure is 1~2 orders of magnitude higher than the atmospheric pressure. When the capsids open, the viral DNA is pumped out by the pressure. Considering that DNA is not easily compressible like gas, a slight variation of its length will result in dramatic change in the pressure. As a result, if the DNA is slightly longer, it would be difficult to package it into the capsid during the assembly. If the DNA is slightly shorter, the pressure may be too low to pump the viral DNA out during the cell entry.
There isn't enough data to give a clear answer to this question, but I can at least explain what I know.
First, it's not 100% certain that genome ejection of tailed phage and herpesviruses depends on stored pressure in the capsid. This is called the continuum mechanics model; but another possibility, the hydrodynamic model, suggests that the difference in osmotic pressure between the cytoplasm and outside environment allows water to flow through the capsid and tail into the the cell, dragging the DNA payload with it. Personally, I am skeptical of this second model because it doesn't seem to explain herpesvirus genome ejection, and it's not consistent with the lethality of R- and F-type pyocins, which are essentially just decapitated phage tails. But there is still some question as to how the genome gets fully out of the capsid.
Assuming that the continuum mechanics model is closest to correct, the nature of the pressure generated when DNA is loaded into the capsid by the packaging ATPases is not intuitive. From a 2013 review:
At this concentration, DNA is highly condensed, and much of the water that normally hydrates the DNA and its counterions must be removed in order to package a complete genome. Water removal during the packaging process occurs by reverse osmosis, the energy for which is derived from the activity of terminase.
Only about 10% of the energy stored in the packaged phage DNA is due to bending DNA more tightly than its persistence length. Most of the energy internal to the capsid is due to the dehydrated state of the DNA, which is reflected by internal osmotic pressures that reach tens of atmospheres.
...And from the herpesvirus paper linked above:
DNA can fill as much as 60% of the internal capsid volume, with the remaining volume fraction occupied by water molecules and small ions that freely diffuse through the capsid wall.
So, despite what we'd expect from our macro-scale experiences, the DNA IS compressible almost like a gas. Small differences in the length packaged won't change the final pressure dramatically.
Also, many of these viruses use a so-called "headfull" packaging method. The viral genome is copied continuously, with the end of one copy linked directly to the beginning of the next copy. The ATPase motor packs this continuous chain of genomes into the capsid until the pressure reaches a certain level, then the motor stops packaging and cuts the DNA chain into a piece inside and a piece outside.
When a threshold amount of DNA, representing about 103% of the SPP1 genome, has been packaged (headful) a sequence-independent DNA cleavage terminates the encapsida- tion cycle (Fig. 1A).
So what will happen to a variant of the phage mentioned here, SPP1, if an insertion mutation increases the length of its genome by more than 3%? I don't know, but in my experience with capsid assembly, it's not uncommon for a small number of large capsids to be produced along with the normal capsids, so possibly large-genome mutants can get by until the structural proteins co-evolve to make the larger capsids the new genome requires. Alternately, even if individual virions no longer contain the whole genome, if multiple virions infect a single cell, all genes will be present in at least one copy, again giving the structural genes time to evolve.